/* HayWire site chrome -- the one stylesheet for the masthead bar, the main
 * nav and the mobile menu. scripts/site_nav.py owns the nav markup and links
 * this file into every public page; generators link it too. Before 2026-09-03
 * the nav was styled sixteen different ways across the site, and the design
 * below lived in editorial-mobile.css, which only some pages linked, so the
 * nav visibly changed between the homepage and /prices. Selectors are kept at
 * the specificity editorial-mobile.css used (nav.main ...) because that file
 * is cached immutable with no ?v= token and returning visitors still load it.
 *
 * Bump the ?v= token in site_nav.NAV_CSS whenever this file changes.
 */
.masthead-bar {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 32px;
  background: var(--ink, #1a1612); color: var(--paper, #f5efe1);
  font: 500 11px "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 1.6px; text-transform: uppercase;
}
.masthead-bar .mb-l, .masthead-bar .mb-r { display: flex; align-items: center; gap: 18px; }
.masthead-bar .mb-sep { color: rgba(245, 239, 225, .3); }
.masthead-bar .hide-sm { display: inline; }

nav.main {
  position: sticky; top: 0; z-index: 40; box-sizing: border-box;
  /* 3-column grid so the centre links stay centred whatever the logo and the
     right-hand actions measure; space-between shifted them page to page. */
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 71px !important; padding: 14px 32px;
  border-bottom: 1px solid var(--rule, #d9d0b8);
  background: rgba(245, 239, 225, .92);
  backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
nav.main a { color: inherit; text-decoration: none; }
nav.main > a { justify-self: start; }
nav.main .nav-links { justify-self: center; }
nav.main .nav-right { justify-self: end; }
.nav-logo-img { display: block; width: auto; height: 30px; }
nav.main .nav-links { display: flex; align-items: center; gap: 28px; }
nav.main .nav-links a {
  padding: 4px 0; border-bottom: 1px solid transparent;
  color: var(--ink-3, #4a443c); font: 500 13.5px "DM Sans", sans-serif;
  transition: color .15s, border-color .15s;
}
nav.main .nav-links a:hover { color: var(--ink, #1a1612); }
nav.main .nav-links a[aria-current="page"] { border-bottom-color: var(--field-green, #3a5a23); color: var(--field-green, #3a5a23); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-login {
  padding: 4px 0; border-bottom: 1px solid transparent;
  color: var(--ink-3, #4a443c); font: 500 13.5px "DM Sans", sans-serif; white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.nav-login:hover { color: var(--ink, #1a1612); border-bottom-color: var(--ink, #1a1612); }
nav.main .nav-cta, .mobile-menu .nav-cta {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 22px; border: 1px solid transparent; border-radius: 2px;
  background: var(--ink, #1a1612); color: var(--paper, #f5efe1);
  font: 600 14px "DM Sans", sans-serif; white-space: nowrap; cursor: pointer;
  transition: background .15s;
}
nav.main .nav-cta:hover, .mobile-menu .nav-cta:hover { background: var(--field-green-2, #2e4719); }
.nav-burger {
  display: none; width: 40px; height: 40px; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--ink, #1a1612); border-radius: 2px; background: transparent; color: var(--ink, #1a1612); cursor: pointer;
}
.nav-burger svg { display: block; }

.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 60;
  flex-direction: column; padding: 64px 24px 24px; background: var(--paper, #f5efe1); overflow-y: auto;
}
.mobile-menu.open { display: flex; }
/* Lock background scroll while the overlay is open. */
body:has(.mobile-menu.open) { overflow: hidden; }
.mobile-menu a {
  padding: 16px 0; border-bottom: 1px solid var(--rule, #d9d0b8); color: var(--ink, #1a1612); text-decoration: none;
  font-family: "Fraunces", Georgia, serif; font-size: 32px; font-weight: 500; letter-spacing: -.6px;
}
.mobile-menu a[aria-current="page"] { color: var(--field-green, #3a5a23); }
.mobile-menu .nav-cta { width: 100%; height: 56px; margin-top: 24px; padding: 0; border-bottom-color: transparent; font-size: 16px; letter-spacing: 0; }
.mobile-menu .mm-close {
  position: absolute; top: 16px; right: 20px; width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--ink, #1a1612); cursor: pointer;
}

@media (max-width: 860px) {
  .masthead-bar { padding: 8px 20px !important; font-size: 10px !important; letter-spacing: 1.2px !important; }
  .masthead-bar .hide-sm { display: none !important; }
  .masthead-bar .mb-r { display: flex !important; }
  /* the 3-col grid collapses once the links hide: on phones it is logo + burger */
  nav.main { display: flex !important; justify-content: space-between !important; height: 67px !important; min-height: 67px; padding: 13px 20px !important; }
  nav.main .nav-logo-img { width: auto !important; height: 30px !important; max-width: none !important; }
  nav.main .nav-links, nav.main .nav-right .nav-cta, nav.main .nav-right .nav-login { display: none; }
  .nav-burger { display: inline-flex; }
}
@media (max-width: 560px) {
  .masthead-bar { padding: 7px 16px !important; font-size: 9.5px !important; letter-spacing: .9px !important; }
  nav.main { padding: 10px 16px !important; }
  .mobile-menu a { font-size: 28px; padding: 14px 0; }
}

/* LIVE WIRE ticker: sits under the nav on every public page; haywire-ticker.js
   fills it from /api/index.json and hides it when the feed is thin. */
.ticker { position: relative; background: var(--ink, #1a1612); color: var(--paper, #f5efe1); height: 38px; overflow: hidden; display: flex; align-items: stretch; }
.ticker-live {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 16px; height: 100%;
  background: var(--barn-red, #9b3923); color: var(--paper, #f5efe1);
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; font-weight: 600; letter-spacing: 1.6px;
  flex-shrink: 0; z-index: 2; box-shadow: 4px 0 8px -2px rgba(0,0,0,.4);
}
.ticker-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--paper, #f5efe1); animation: tickerPulse 1.4s infinite; }
@keyframes tickerPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.ticker-viewport {
  flex: 1; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
}
.ticker-track { display: inline-flex; align-items: center; height: 100%; animation: tickerScroll 80s linear infinite; white-space: nowrap; will-change: transform; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tickerScroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.ticker-item {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 0 24px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: .4px;
  color: rgba(245,239,225,.7); border-right: 1px solid rgba(245,239,225,.1);
}
.ticker-item .t-loc { color: var(--paper, #f5efe1); font-weight: 500; }
.ticker-item .t-px { color: var(--paper, #f5efe1); font-weight: 600; }
.ticker-item .t-chg { font-weight: 500; }
.ticker-item .t-chg.up { color: #f59076; }
.ticker-item .t-chg.dn { color: #8dc63f; }
.ticker-item .t-chg.flat { color: rgba(245,239,225,.5); }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }
