/* Portalham header — dark newsroom treatment inspired by the approved reference. */

:root {
  --ph-header-navy: #071a31;
  --ph-header-navy-deep: #05162b;
  --ph-header-panel: #0d2747;
  --ph-header-panel-hover: #12355f;
  --ph-header-line: rgba(155, 184, 218, 0.18);
  --ph-header-text: #f7faff;
  --ph-header-muted: #aabbd0;
  --ph-header-accent: #ff9818;
  --ph-header-blue: #1671d9;
  --ph-header-gutter: 16px;
  --ph-header-control-size: 44px;
}

.ph-topbar,
.ph-site-header {
  color-scheme: dark;
}

.ph-topbar {
  min-height: 31px;
  border: 0;
  border-bottom: 1px solid var(--ph-header-line);
  background: var(--ph-header-navy-deep);
  color: var(--ph-header-muted);
  font-size: 10.5px;
}

.ph-topbar > .ph-container,
.ph-site-header > .ph-container {
  width: min(1280px, calc(100% - (var(--ph-header-gutter) * 2))) !important;
  max-width: none;
  margin-inline: auto;
}

.ph-topbar__inner {
  min-height: 31px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
}

.ph-topbar__links,
.ph-topbar__status,
.ph-topbar__quick-links {
  min-width: 0;
  display: flex;
  align-items: center;
}

.ph-topbar__links {
  gap: 0;
}

.ph-topbar__links > a {
  position: relative;
  padding-inline: 10px;
  color: var(--ph-header-muted) !important;
  white-space: nowrap;
}

.ph-topbar__links > a::before {
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 11px;
  background: var(--ph-header-line);
  content: "";
  transform: translateY(-50%);
}

.ph-topbar__links > a:hover,
.ph-topbar__links > a:focus-visible {
  color: #fff !important;
}

.ph-topbar__status {
  justify-content: flex-start;
  gap: 12px;
  overflow: hidden;
}

.ph-topbar__ticker {
  min-width: 0;
  max-width: none;
  display: flex;
  gap: 5px;
  overflow: hidden;
  color: var(--ph-header-text) !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-topbar__ticker strong {
  flex: 0 0 auto;
  color: var(--ph-header-accent);
}

.ph-topbar__ticker span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ph-topbar__date {
  padding-inline-start: 12px;
  border-inline-start: 1px solid var(--ph-header-line);
  text-align: left;
  color: var(--ph-header-muted);
  white-space: nowrap;
}

.ph-topbar__quick-links {
  direction: ltr;
  gap: 7px;
}

.ph-topbar__quick-links a,
.ph-theme-toggle--topbar {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--ph-header-line);
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.025) !important;
  color: var(--ph-header-muted) !important;
  box-shadow: none !important;
}

.ph-topbar__quick-links svg,
.ph-theme-toggle--topbar svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: currentColor;
}

.ph-topbar__quick-links a:hover,
.ph-topbar__quick-links a:focus-visible,
.ph-theme-toggle--topbar:hover,
.ph-theme-toggle--topbar:focus-visible {
  border-color: rgba(255, 152, 24, 0.5);
  background: rgba(255, 152, 24, 0.08) !important;
  color: var(--ph-header-accent) !important;
}

.ph-theme-toggle--topbar {
  margin-left: 8px;
  cursor: pointer;
}

.ph-site-header,
body.ph-header-is-compact .ph-site-header {
  position: relative !important;
  top: auto !important;
  z-index: 100 !important;
  padding-top: 0 !important;
  border: 0;
  background: var(--ph-header-navy) !important;
  box-shadow: 0 7px 22px rgba(2, 12, 25, 0.2) !important;
  color: var(--ph-header-text);
}

.ph-header-main,
body.ph-header-is-compact .ph-header-main {
  min-height: 69px !important;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(260px, 550px) 44px;
  gap: 16px;
  align-items: center;
  padding: 10px 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.ph-brand {
  min-width: 0;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ph-header-text) !important;
}

.ph-brand__artwork {
  display: block;
  width: 100%;
  max-width: 360px;
  line-height: 0;
}

.ph-brand__artwork img {
  display: block;
  width: 100%;
  height: auto;
}

.ph-brand:focus-visible {
  outline: 2px solid var(--ph-header-accent);
  outline-offset: 4px;
  border-radius: 3px;
}

@media (max-width: 1023px) {
  .ph-brand__artwork {
    width: 130px;
    max-width: 100%;
  }
}

.ph-logo,
body.ph-header-is-compact .ph-logo {
  width: 50px !important;
  height: 50px !important;
  flex: 0 0 50px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50% !important;
  background-color: #fff !important;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.24) !important;
}

.ph-brand__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ph-brand__title,
body.ph-header-is-compact .ph-brand__title {
  color: var(--ph-header-text) !important;
  font-size: 20px !important;
  font-weight: 850;
  line-height: 1.35;
}

.ph-brand__subtitle,
body.ph-header-is-compact .ph-brand__subtitle {
  max-height: none !important;
  display: block !important;
  overflow: visible !important;
  margin-top: 2px;
  color: var(--ph-header-muted) !important;
  font-size: 10.5px;
  line-height: 1.55;
  opacity: 1 !important;
  transform: none !important;
}

.ph-header-search {
  width: min(100%, 550px);
  min-width: 0;
  justify-self: end;
}

/* Fixed grid tracks keep the input, clear action and submit button stable while typing. */
body.portalham-site .ph-header-search {
  height: var(--ph-header-control-size);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 48px;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--ph-header-panel);
  box-shadow: inset 0 0 0 1px rgba(155, 184, 218, 0.28);
  transition: box-shadow 160ms ease;
}

body.portalham-site .ph-header-search:focus-within {
  box-shadow: inset 0 0 0 1px var(--ph-header-accent), 0 0 0 3px rgba(255, 152, 24, 0.12);
}

/* Theme control now sits at the far left of the main header row. */
body.portalham-site .ph-site-header .ph-theme-toggle--header {
  width: var(--ph-header-control-size) !important;
  height: var(--ph-header-control-size) !important;
  min-width: var(--ph-header-control-size) !important;
  min-height: var(--ph-header-control-size) !important;
  justify-self: end;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(155, 184, 218, 0.28);
  border-radius: 8px !important;
  color: var(--ph-header-text) !important;
  background: var(--ph-header-panel) !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: pointer;
}
.ph-theme-toggle--header svg { width: 20px; height: 20px; display: block; fill: currentColor; }
body.portalham-site .ph-site-header .ph-theme-toggle--header:hover {
  color: var(--ph-header-accent) !important;
  border-color: var(--ph-header-accent);
}
body.portalham-site .ph-site-header .ph-theme-toggle--header:focus-visible {
  outline: 2px solid var(--ph-header-accent);
  outline-offset: 3px;
}

body.portalham-site .ph-header-search .ph-header-search__input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: var(--ph-header-control-size);
  min-height: var(--ph-header-control-size) !important;
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  margin: 0;
  padding: 0 14px 0 4px !important;
  border: 0 !important;
  border-radius: 0 8px 8px 0 !important;
  background: transparent !important;
  color: var(--ph-header-text) !important;
  font-size: 12px;
  line-height: normal;
  text-overflow: ellipsis;
  box-shadow: none !important;
  outline: none;
  appearance: none;
  transition: none !important;
}

.ph-header-search__input::placeholder {
  color: var(--ph-header-muted) !important;
  opacity: 1;
}

body.portalham-site .ph-header-search .ph-header-search__button,
body.portalham-site .ph-header-search .ph-header-search__clear {
  box-sizing: border-box;
  position: static !important;
  inset: auto;
  width: 100% !important;
  height: var(--ph-header-control-size) !important;
  min-width: 44px !important;
  min-height: var(--ph-header-control-size) !important;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease !important;
}

body.portalham-site .ph-header-search .ph-header-search__button {
  border-radius: 8px 0 0 8px !important;
  background: var(--ph-header-accent) !important;
  color: var(--ph-header-navy) !important;
}

body.portalham-site .ph-header-search .ph-header-search__button:hover {
  background: #ffad3e !important;
}

body.portalham-site .ph-header-search .ph-header-search__clear {
  border-radius: 6px !important;
  background: transparent;
  color: var(--ph-header-muted);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.portalham-site .ph-header-search:has(.ph-header-search__input:not(:placeholder-shown)) .ph-header-search__clear {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

body.portalham-site .ph-header-search .ph-header-search__clear::before {
  content: none;
}

body.portalham-site .ph-header-search .ph-header-search__clear:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ph-header-text);
}

body.portalham-site .ph-header-search .ph-header-search__button:focus-visible,
body.portalham-site .ph-header-search .ph-header-search__clear:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -5px;
}

body.portalham-site .ph-header-search button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  pointer-events: none;
}

.ph-submit-news {
  min-height: 40px;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid rgba(255, 190, 92, 0.5);
  border-radius: 7px;
  background: var(--ph-header-accent);
  color: #1b2635 !important;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(255, 142, 0, 0.18);
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ph-submit-news svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.ph-submit-news:hover,
.ph-submit-news:focus-visible {
  background: #ffad35;
  color: #101b29 !important;
  box-shadow: 0 7px 17px rgba(255, 142, 0, 0.25);
  transform: translateY(-1px);
}

/* Keep the existing link animation and ::after underline untouched. */
.ph-nav,
body.ph-header-is-compact .ph-nav {
  min-height: 39px;
  position: relative !important;
  top: auto !important;
  z-index: 120 !important;
  display: block;
  padding: 2px 0 3px;
  border: 0;
  border-top: 1px solid var(--ph-header-line);
  background: var(--ph-header-navy);
  color: var(--ph-header-muted);
}

.ph-nav > .ph-nav__list {
  min-height: 33px;
  align-items: center;
}

.ph-nav > .ph-nav__list > li > a {
  color: #c7d4e4 !important;
  font-size: 11.5px;
  font-weight: 650;
}

.ph-nav > .ph-nav__list > li > a:hover,
.ph-nav > .ph-nav__list > li > a:focus-visible,
.ph-nav > .ph-nav__list > li > a[aria-current="page"],
.ph-nav .current-menu-item > a,
.ph-nav .current-menu-ancestor > a {
  background: rgba(22, 113, 217, 0.17);
  color: #fff !important;
}

.ph-nav .sub-menu {
  border-color: rgba(135, 168, 204, 0.24);
  background: #0a213d;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.ph-nav .sub-menu a {
  color: #c7d4e4 !important;
}

/* Enable the existing compact navigation before the full menu stops fitting. */
@media (max-width: 1279px) {
  .ph-nav,
  body.ph-header-is-compact .ph-nav {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
  }

  .ph-nav::-webkit-scrollbar {
    display: none;
  }

  .ph-nav .sub-menu {
    display: none !important;
  }
}

@media (max-width: 900px) {
  :root {
    --ph-header-gutter: 13px;
  }

  .ph-topbar__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .ph-topbar__quick-links {
    display: none;
  }

  .ph-topbar__status {
    justify-content: flex-start;
  }

  .ph-topbar__ticker {
    max-width: none;
  }

  .ph-header-main,
  body.ph-header-is-compact .ph-header-main {
    grid-template-columns: minmax(130px, 1fr) minmax(200px, 440px) 44px;
    gap: 13px;
  }

  .ph-header-search {
    width: 100%;
  }

  .ph-submit-news {
    width: 42px;
    padding: 0;
  }

  .ph-submit-news span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .ph-topbar {
    min-height: 29px;
  }

  .ph-topbar__inner {
    min-height: 29px;
    grid-template-columns: minmax(0, 1fr);
  }

  .ph-topbar__links > a:nth-of-type(n + 2),
  .ph-topbar__date {
    display: none;
  }

  .ph-topbar__links > a:first-of-type {
    padding-inline: 7px;
    font-size: 10px;
  }

  .ph-topbar__status {
    min-width: 0;
  }

  .ph-topbar__ticker {
    max-width: none;
    font-size: 9.5px;
  }

  .ph-header-main,
  body.ph-header-is-compact .ph-header-main {
    min-height: 116px !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding-block: 9px !important;
  }

  .ph-brand {
    min-width: 0;
    min-height: 44px;
  }

  .ph-brand__artwork {
    width: 110px;
  }

  .ph-logo,
  body.ph-header-is-compact .ph-logo {
    width: 42px !important;
    height: 42px !important;
    flex-basis: 42px;
  }

  .ph-brand__title,
  body.ph-header-is-compact .ph-brand__title {
    font-size: 17px !important;
  }

  .ph-brand__subtitle,
  body.ph-header-is-compact .ph-brand__subtitle {
    font-size: 9.5px;
  }

  .ph-theme-toggle--header {
    grid-column: 2;
    grid-row: 1;
  }

  .ph-header-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .ph-nav,
  body.ph-header-is-compact .ph-nav {
    min-height: 40px;
    padding-block: 3px;
  }

  .ph-nav > .ph-nav__list > li > a {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ph-submit-news,
  body.portalham-site .ph-header-search,
  body.portalham-site .ph-header-search button {
    transition: none !important;
  }
}
