/* Horizon: HELM's established identity with a quieter, contemporary layout.
   This layer owns shared tokens, public navigation, and the site footer. */
:root {
  --modern-ink: #142f3e;
  --modern-ink-soft: #294957;
  --modern-copy: #526976;
  --modern-muted: #667d89;
  --modern-canvas: #f5f8f9;
  --modern-surface: #ffffff;
  --modern-surface-muted: #eef4f6;
  --modern-line: #dce6ea;
  --modern-line-strong: #b7cbd4;
  --modern-gold: #bea16d;
  --modern-gold-strong: #7b622f;
  --modern-aqua: #246579;
  --modern-radius: 6px;
  --modern-control-height: 46px;
  --modern-header-height: 86px;
  --modern-shadow-sm: 0 12px 32px rgb(20 47 62 / 6%);
  --modern-shadow-md: 0 22px 52px rgb(20 47 62 / 10%);
  --font-display: "Inter", "Segoe UI", Arial, sans-serif;
  --horizon-navy: #102c3b;
  --horizon-spring: cubic-bezier(.22, .9, .32, 1.18);
}

html[data-theme="dark"] {
  --modern-ink: #e9f1f4;
  --modern-ink-soft: #d2e0e6;
  --modern-copy: #bdcdd5;
  --modern-muted: #a5bbc7;
  --modern-canvas: #0d202c;
  --modern-surface: #122d3b;
  --modern-surface-muted: #183544;
  --modern-line: #2b4a5c;
  --modern-line-strong: #567486;
  --modern-gold-strong: #d8bf8b;
  --modern-aqua: #99cbd8;
}

body { font-size: 16px; }

/* Public pages have one light palette, even when a broker prefers a dark
   workspace. Body-level popups must receive the same palette as their fields. */
body:has(.site-shell:not(.site-shell-platform)) {
  color-scheme: light;
  --modern-ink: #153747;
  --modern-ink-soft: #294e61;
  --modern-copy: #536d7a;
  --modern-muted: #536d7a;
  --modern-canvas: #f8fafb;
  --modern-surface: #fff;
  --modern-surface-muted: #eff4f6;
  --modern-line: #dbe5e9;
  --modern-line-strong: #b9cbd3;
  --modern-gold-strong: #7e622f;
  --surface-card: #fff;
  --surface-card-strong: #eff4f6;
  --surface-border: #dbe5e9;
  --surface-soft-readable: #eff4f6;
}

.site-shell:not(.site-shell-platform) .container {
  width: min(1280px, calc(100% - clamp(2.5rem, 8vw, 8rem)));
}

html[data-theme] .site-shell:not(.site-shell-platform) .topbar {
  z-index: 100;
  min-height: var(--modern-header-height);
  color: #f5f8fa;
  background: #102c3b !important;
  border-bottom: 1px solid #38505e;
  box-shadow: none;
  backdrop-filter: none;
}

.site-shell:not(.site-shell-platform) .topbar .nav-shell {
  min-height: var(--modern-header-height);
  gap: 24px;
}

.site-shell:not(.site-shell-platform) .brand-lockup { gap: 13px; }
.site-shell:not(.site-shell-platform) .brand-logo {
  width: 58px;
  height: 58px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 5px;
  background: #fff;
  object-fit: contain;
}

html[data-theme] .site-shell:not(.site-shell-platform) .topbar .brand-text span {
  color: #fff !important;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: .12em !important;
}

html[data-theme] .site-shell:not(.site-shell-platform) .topbar .brand-text small {
  max-width: 155px;
  color: #c3d2d9 !important;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .09em !important;
  line-height: 1.5;
}

.site-shell:not(.site-shell-platform) .nav-links { margin-left: auto; gap: 8px; }
html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-link {
  min-height: 46px;
  padding: 0 14px;
  color: #dce7ec !important;
  font-size: 14px;
  font-weight: 500;
}

.site-shell:not(.site-shell-platform) .nav-link:not(:first-child)::before { display: none; }
html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-link:hover,
html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-link.is-active {
  color: #fff !important;
}

.site-shell:not(.site-shell-platform) .nav-link.is-active::after,
.site-shell:not(.site-shell-platform) .nav-link[aria-current="page"]::after {
  bottom: 0;
  height: 1px;
  background: #c6b184;
  box-shadow: none;
}

.site-shell:not(.site-shell-platform) .nav-actions { gap: 12px; }
/* Override the legacy login-link hiding rule on every public header width. */
html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-actions .nav-broker-portal-link { display: inline-flex !important; }
html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-actions .btn {
  min-height: 44px;
  border: 1px solid #6a8390;
  border-radius: 4px;
  padding: 11px 16px;
  color: #fff;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-actions .nav-buyer-login {
  border-color: transparent;
  padding-inline: 8px;
  color: #dce7ec;
}

html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-actions .btn:hover {
  background: #244655;
  border-color: #bdcfd8;
}

.site-shell:not(.site-shell-platform) .mobile-menu-toggle {
  flex: 0 0 44px;
  border: 1px solid #6a8390;
  border-radius: 4px;
  background: transparent;
}
.site-shell:not(.site-shell-platform) .mobile-menu-toggle span { background: #edf4f7; }
html[data-theme] .site-shell:not(.site-shell-platform) .mobile-nav {
  width: 100%;
  color: #153747;
  background: #102c3b;
  border-top-color: #38505e;
  box-shadow: none;
}
html[data-theme] .site-shell:not(.site-shell-platform) .mobile-nav.is-open {
  max-height: calc(100vh - var(--modern-header-height) - 1px);
  max-height: calc(100dvh - var(--modern-header-height) - 1px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Keep the menu surface and its text together; legacy theme rules also paint
   this inner panel, independently of the navy header behind it. */
html[data-theme] .site-shell:not(.site-shell-platform) .mobile-nav-inner {
  gap: 4px;
  padding: 12px;
  border: 1px solid #dbe5e9;
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
}
.site-shell:not(.site-shell-platform) .mobile-nav:not(.is-open) { display: none; }
html[data-theme] .site-shell:not(.site-shell-platform) .mobile-link {
  display: flex;
  align-items: center;
  min-height: 50px;
  color: #153747 !important;
  background: transparent;
  font-weight: 500;
  border-bottom-color: #dbe5e9;
  border-radius: 4px;
}
html[data-theme] .site-shell:not(.site-shell-platform) .mobile-link:is(:hover,:focus-visible,.is-active) {
  color: #153747 !important;
  background: #e8f1f5;
}
html[data-theme] .site-shell:not(.site-shell-platform) .mobile-link.is-active {
  font-weight: 600;
}
html[data-theme] .site-shell:not(.site-shell-platform) .mobile-link:focus-visible {
  outline: 2px solid #245f73 !important;
  outline-offset: -2px !important;
}
.site-shell:not(.site-shell-platform) .mobile-nav-row { gap: 12px; margin-top: 12px; }

html[data-theme] .main-site-footer {
  color: #dce7ec;
  background: #102c3b !important;
  border-top: 1px solid #38505e;
  box-shadow: none;
}
html[data-theme] .site-shell:not(.site-shell-platform) .main-site-footer :is(p, small, a, h3) { color: #c3d2da !important; }
html[data-theme] .site-shell:not(.site-shell-platform) .main-site-footer a:not(.btn):hover { color: #fff !important; }
html[data-theme] .main-site-footer .footer-command-strip {
  padding-block: 32px;
  border-color: #38505e;
  background: transparent;
}
html[data-theme] .site-shell:not(.site-shell-platform) .main-site-footer .footer-kicker {
  color: #d8c69e !important;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em !important;
}
html[data-theme] .main-site-footer .footer-demo-link {
  color: #fff;
  border: 1px solid #8097a3;
  background: transparent;
}
.main-site-footer .footer-toolbar { padding-block: 44px; }
.main-site-footer .footer-logo-lockup {
  width: min(230px, 100%);
  height: auto;
  max-height: 88px;
  object-fit: contain;
  object-position: left;
}
html[data-theme] .site-shell:not(.site-shell-platform) .main-site-footer .footer-link-group h3 { color: #f5f8fa !important; font-weight: 600; }
html[data-theme] .main-site-footer .footer-bottom-bar {
  border-color: #38505e;
  background: transparent;
}
html[data-theme] .site-shell:not(.site-shell-platform) .main-site-footer .footer-note-copy { color: #a9c0cb !important; }

/* Searchable select menus render outside the page shell. */
html[data-theme] body > .custom-select-menu {
  border: 1px solid var(--modern-line-strong) !important;
  border-radius: 6px;
  color: var(--modern-ink) !important;
  background: var(--modern-surface) !important;
  box-shadow: var(--modern-shadow-md);
}
html[data-theme] body > .custom-select-menu :is(.custom-select-option, .custom-select-empty) {
  min-height: 44px;
  color: var(--modern-ink) !important;
  background: transparent !important;
  font-size: 15px;
}
html[data-theme] body > .custom-select-menu .custom-select-option:is(:hover, :focus-visible, .is-selected, .is-focused) {
  color: var(--modern-ink) !important;
  background: var(--modern-surface-muted) !important;
}
html[data-theme] body > .custom-select-menu .custom-select-search {
  min-height: 44px;
  font-size: 16px;
  color: var(--modern-ink) !important;
  background: var(--modern-surface) !important;
  border-color: var(--modern-line-strong) !important;
}

html[data-theme] body > .custom-select-menu .custom-select-search::placeholder {
  color: var(--modern-copy) !important;
  opacity: 1;
}
html[data-theme] body > .custom-select-menu .custom-select-check { color: var(--modern-ink) !important; }

/* Notifications and confirmations are shared by public and broker routes. */
html[data-theme] .site-shell :is(.toast, .modal-card) {
  color: var(--modern-ink) !important;
  background: var(--modern-surface) !important;
  border-color: var(--modern-line-strong);
  border-radius: 6px;
  box-shadow: 0 16px 42px rgb(8 28 41 / 18%);
}
html[data-theme] .site-shell :is(.toast, .modal-card) :is(h3, strong) { color: var(--modern-ink) !important; }
html[data-theme] .site-shell :is(.toast, .modal-card) p { color: var(--modern-copy) !important; }
html[data-theme] .site-shell .toast-dismiss {
  min-height: 44px;
  color: var(--modern-ink) !important;
  background: var(--modern-surface-muted) !important;
  border: 1px solid var(--modern-line-strong);
  border-radius: 4px;
}
html[data-theme] .site-shell .toast-stack {
  position: fixed;
  inset: auto max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) auto;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(460px, calc(100dvh - 32px));
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: none;
}
html[data-theme] .site-shell .toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: start;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 12px 10px 12px 16px;
  pointer-events: auto;
}
html[data-theme] .site-shell .toast-content { min-width: 0; padding-top: 3px; overflow-wrap: anywhere; }
html[data-theme] .site-shell .toast-content strong { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 650; }
html[data-theme] .site-shell .toast-content p { margin: 5px 0 0; font-size: 14px; line-height: 1.55; }
html[data-theme] .site-shell .toast .toast-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  border-color: transparent;
  background: transparent !important;
}
html[data-theme] .site-shell .toast .toast-dismiss:hover { background: var(--modern-surface-muted) !important; }
html[data-theme] .site-shell .toast .toast-dismiss:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }
html[data-theme] .site-shell .modal-card .btn-danger {
  color: #fff !important;
  background: #a73333 !important;
  border-color: #a73333 !important;
}
.site-shell .modal-actions { flex-wrap: wrap; gap: 12px; }
.site-shell .modal-actions > .btn { min-height: 44px; white-space: normal; }

.btn { transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 220ms ease, transform 280ms var(--horizon-spring); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.99); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { transform: translateY(-2px); }
}

@media (min-width: 1181px) {
  .site-shell:not(.site-shell-platform) .mobile-nav { display: none !important; }
}

@media (max-width: 1180px) {
  .site-shell:not(.site-shell-platform) .topbar .nav-shell { gap: 16px; }
  .site-shell:not(.site-shell-platform) .nav-actions { margin-left: auto; }
}

@media (max-width: 760px) {
  :root { --modern-header-height: 76px; }
  .site-shell:not(.site-shell-platform) .container { width: calc(100% - 40px); }
  .site-shell:not(.site-shell-platform) .brand-logo { width: 44px; height: 44px; }
  .site-shell:not(.site-shell-platform) .brand-lockup { gap: 9px; }
  html[data-theme] .site-shell:not(.site-shell-platform) .topbar .brand-text span { font-size: 22px; }
  html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-actions { gap: 9px; }
  html[data-theme] .site-shell:not(.site-shell-platform) .topbar .nav-actions .nav-broker-portal-link {
    display: inline-flex;
    min-height: 44px;
    padding-inline: 12px;
    font-size: 13px;
  }
  .site-shell:not(.site-shell-platform) .topbar .nav-actions .nav-buyer-login { display: none; }
  .site-shell:not(.site-shell-platform) .topbar .nav-actions > .nav-profile-button { display: none; }
  .main-site-footer .footer-toolbar { padding-block: 32px; }
}

@media (max-width: 370px) {
  .site-shell:not(.site-shell-platform) .container { width: calc(100% - 28px); }
  .site-shell:not(.site-shell-platform) .topbar .brand-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .btn:hover:not(:disabled) { transform: none !important; }
}
