/* Imagine That · site chrome.
   One night sky frames every public page: the header above (scripts/site_header.py writes its markup into
   each page and fails the build when a copy drifts; shared/site-header.js adds the phone menu) and the
   footer below (every page footer carries class="it-frame"). The chrome never takes its colour from the
   page underneath. It brings its own ground (the homepage sky's night and nebulae), its own stars (the
   Work sky's still star tile) and the starlit horizon (the homepage scan box's hairline) where it meets
   the page. Variants change only what their context needs: data-placement="flow|overlay" on the header,
   aria-current for the page and its section. Everything is namespaced it-* so the legacy .shared-header /
   .primary-nav rules that css/styles.css and shared/chrome.css keep for non-public pages cannot reach it. */

:root {
  /* The sky. Stars are still radial-gradient tiles in the Work sky's grammar (work/constellation.css draws
     its no-JS field the same way): --it-sky-stars for the header and footer bands, --it-sky-field (the Work
     tile itself plus two wider tiles, so no row repeats on a tall canvas) for whole pages. Behind them,
     --it-sky-night: two faint nebulae (the homepage sky's --n1 and --n2) over the night. Each *-size list
     pairs with its stars layer for layer. */
  --it-sky-stars:
    radial-gradient(1px 1px at 22px 34px, #faf7edaa, #0000),
    radial-gradient(1px 1px at 151px 61px, #78cdc699, #0000),
    radial-gradient(1.4px 1.4px at 83px 17px, #faf7edcc, #0000),
    radial-gradient(1px 1px at 214px 72px, #e5af5299, #0000),
    radial-gradient(1px 1px at 47px 129px, #faf7ed88, #0000),
    radial-gradient(1.2px 1.2px at 301px 57px, #faf7ed99, #0000),
    radial-gradient(1px 1px at 190px 150px, #faf7ed77, #0000);
  --it-sky-stars-size: 263px 173px, 373px 181px, 467px 197px, 263px 173px, 373px 181px, 467px 197px, 331px 173px;
  --it-sky-field:
    radial-gradient(1px 1px at 22px 34px, #faf7edaa, #0000),
    radial-gradient(1px 1px at 151px 92px, #78cdc699, #0000),
    radial-gradient(1.4px 1.4px at 83px 171px, #faf7edcc, #0000),
    radial-gradient(1px 1px at 214px 223px, #e5af5299, #0000),
    radial-gradient(1px 1px at 47px 251px, #faf7ed88, #0000),
    radial-gradient(1.2px 1.2px at 301px 57px, #faf7ed99, #0000),
    radial-gradient(1px 1px at 120px 310px, #faf7ed73, #0000),
    radial-gradient(1.1px 1.1px at 401px 133px, #78cdc680, #0000);
  --it-sky-field-size: 263px 281px, 373px 331px, 467px 409px, 263px 281px, 373px 331px, 467px 409px, 541px 457px, 613px 521px;
  --it-sky-night:
    radial-gradient(60% 150% at 84% 0%, #24407a59, #0000 72%),
    radial-gradient(45% 140% at 10% 100%, #3b2a6e3d, #0000 72%),
    linear-gradient(180deg, #06141d, #0a2130);
  --it-sky-base: #06141d;
  /* Where the sky meets the page: warm where the light comes from, cooler round the far side. */
  --it-sky-horizon: linear-gradient(90deg, #0000, rgb(255 227 176 / .7) 16%, rgb(180 156 255 / .45) 42%, rgb(110 200 255 / .32) 66%, rgb(255 140 200 / .5) 86%, #0000);
  --it-sky-glow: 0 14px 28px -20px rgb(107 91 208 / .75);
  --it-sky-ink: #faf7ed;
  --it-sky-muted: #b9cbd2;
  --it-sky-hover: #9ee2d9;
  --it-sky-focus: #9ee2d9;
  --it-sky-current: #ec7257;
  --it-sky-gutter: max(24px, calc((100% - 1328px) / 2));
}

.it-header {
  --ih-position: relative;
  --ih-inset: auto;
  --ih-pill: linear-gradient(108deg, #728bda38 0%, #64d4cc38 24%, #c995db40 49%, #ebc27940 71%, #6fceb438 100%), #102b3940;
  --ih-pill-line: #d9e9ef45;
  --ih-pill-shadow: inset 0 1px 0 #ffffff33, inset 0 -1px 0 #88b9c426, 0 8px 24px #00000014;
  --ih-pill-blur: blur(20px) saturate(1.5);
  --ih-cta: #ffffff14;
  --ih-cta-ink: #fff;
  --ih-cta-line: #ffffff36;
  --ih-panel: linear-gradient(130deg, #6b7fb91f, #7ac6ca20 25%, #cca6d820 55%, #e8ba7926 80%, #7bccb41a), #122b39f5;
  --ih-panel-line: #d9e9ef45;
  --ih-panel-shadow: 0 16px 32px #0000004d;
  --ih-row-hover: #ffffff12;
  --ih-font: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
}
.it-header[data-placement="overlay"] { --ih-position: absolute; --ih-inset: 0 0 auto 0; }
/* An overlay header floats only over a scene that exists. Without scripting, and while the page still shows
   content marked data-site-header-flow (Open Studio's fallback before its runtime renders), it sits in flow,
   so it never covers that content. */
@media (scripting: none) {
  .it-header[data-placement="overlay"] { --ih-position: relative; --ih-inset: auto; }
}
body:has([data-site-header-flow]) .it-header[data-placement="overlay"] { --ih-position: relative; --ih-inset: auto; }

/* The root keeps the class .site-header because shared/home-sky.js and measurement/measurement.js query it.
   css/styles.css still lays that class out for legacy pages (html:not(.js) .site-header is 0,2,1), so this
   one rule outranks it and every other rule here can stay plain. Position and stacking are !important:
   pages lift their body children with rules such as css/home-sky.css's
   `.sky-on > :not(.sky)… { position: relative; z-index: 1 }`, and the open phone panel must stay above
   every page layer. */
html .it-header.site-header[data-site-header] {
  position: var(--ih-position) !important;
  inset: var(--ih-inset);
  z-index: 60 !important;
  display: block;
  box-sizing: border-box;
  width: auto;
  max-width: none;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background-color: var(--it-sky-base);
  background-image: var(--it-sky-stars), var(--it-sky-night);
  background-size: var(--it-sky-stars-size), auto, auto, auto;
  box-shadow: var(--it-sky-glow);
  color: var(--it-sky-ink);
  font: 500 15px/1.3 var(--ih-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* The horizon: the header's lower edge, on every page. */
.it-header::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: var(--it-sky-horizon); pointer-events: none; }
.it-header *, .it-header *::before, .it-header *::after { box-sizing: border-box; }

.it-header .it-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
  padding: 16px var(--it-sky-gutter);
}

/* Brand: the white wordmark with its coral dot, at every width. */
.it-header .it-header__brand { display: inline-flex; align-items: center; flex-shrink: 0; min-width: 44px; min-height: 44px; border-radius: 4px; }
.it-header .it-header__logo { display: block; width: 164px; height: auto; }

/* Shared link and control language */
.it-header a { color: var(--it-sky-ink); text-decoration: none; }
.it-header .it-header__link,
.it-header .it-header__book {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 9px;
  border-radius: 999px;
  font: inherit;
  color: var(--it-sky-ink);
  text-decoration: none;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
  transition: color 180ms cubic-bezier(.22, .61, .36, 1), background-color 180ms cubic-bezier(.22, .61, .36, 1);
}
@media (hover: hover) {
  .it-header .it-header__link:hover,
  .it-header .it-header__book:hover,
  .it-header .it-header__menu:hover { color: var(--it-sky-hover); }
  .it-header .it-header__cta:hover { color: var(--ih-cta-ink); filter: brightness(1.15); }
}
/* aria-current="page" is this page; aria-current="true" is the section this page belongs to. */
.it-header .it-header__link[aria-current] { text-decoration-line: underline; text-decoration-color: var(--it-sky-current); }
.it-header a:focus-visible,
.it-header button:focus-visible { outline: 2px solid var(--it-sky-focus); outline-offset: 3px; }

/* Desktop navigation: one pill, the booking call to action at its end. */
.it-header .it-header__nav {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 5px 5px 5px 9px;
  border: 1px solid var(--ih-pill-line);
  border-radius: 999px;
  background: var(--ih-pill);
  box-shadow: var(--ih-pill-shadow);
  -webkit-backdrop-filter: var(--ih-pill-blur);
  backdrop-filter: var(--ih-pill-blur);
}
.it-header .it-header__list { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; }
.it-header .it-header__list > li { display: flex; margin: 0; padding: 0; }
.it-header .it-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ih-cta-line);
  border-radius: 999px;
  background: var(--ih-cta);
  color: var(--ih-cta-ink);
  font: inherit;
  white-space: nowrap;
  transition: filter 180ms cubic-bezier(.22, .61, .36, 1);
}

/* Phone and tablet: "Book" and "Menu" share the same pill; the navigation opens below the bar. */
.it-header .it-header__actions {
  display: none;
  align-items: center;
  padding: 0 2px 0 3px;
  border: 1px solid var(--ih-pill-line);
  border-radius: 999px;
  background: var(--ih-pill);
  box-shadow: var(--ih-pill-shadow);
  -webkit-backdrop-filter: var(--ih-pill-blur);
  backdrop-filter: var(--ih-pill-blur);
}
.it-header .it-header__menu {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin: 0;
  padding: 0 14px 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--it-sky-ink);
  font: inherit;
  cursor: pointer;
  transition: color 180ms cubic-bezier(.22, .61, .36, 1);
}
.it-header .it-header__menu-icon { display: flex; flex-direction: column; gap: 5px; }
.it-header .it-header__menu-icon span { display: block; width: 16px; height: 2px; border-radius: 1px; background: currentColor; transition: transform 180ms cubic-bezier(.22, .61, .36, 1); }
.it-header[data-open] .it-header__menu-icon span:first-child { transform: translateY(3.5px) rotate(45deg); }
.it-header[data-open] .it-header__menu-icon span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* data-placement="overlay" floats the header over the page's first scene; a later scene whose content must
   start below it reserves the height with an empty .it-header-space. */
.it-header-space { height: 88px; }

@media (max-width: 1279.98px) {
  .it-header-space { height: 72px; }
  .it-header .it-header__bar { min-height: 72px; padding: 12px 24px; }
  .it-header .it-header__actions { display: flex; }
  .it-header .it-header__nav {
    position: absolute;
    top: calc(100% - 4px);
    right: 24px;
    z-index: 1;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: min(360px, calc(100% - 48px));
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
    border-color: var(--ih-panel-line);
    border-radius: 18px;
    background: var(--ih-panel);
    box-shadow: var(--ih-panel-shadow);
  }
  .it-header[data-open] .it-header__nav { display: flex; }
  .it-header .it-header__list { flex-direction: column; align-items: stretch; }
  .it-header .it-header__link { flex: 1; min-height: 48px; padding: 0 14px; border-radius: 10px; font-size: 16px; }
  .it-header .it-header__link:active { background: var(--ih-row-hover); }
}
@media (max-width: 1279.98px) and (hover: hover) {
  .it-header .it-header__link:hover { background: var(--ih-row-hover); }
}
@media (max-width: 1279.98px) {
  .it-header .it-header__cta { min-height: 48px; }
}
@media (max-width: 539.98px) {
  .it-header .it-header__bar { gap: 12px; padding: 12px 20px; }
  .it-header .it-header__logo { width: 148px; }
  .it-header .it-header__nav { left: 16px; right: 16px; width: auto; }
}
/* Below 360px the wordmark and the Menu pill fill the bar; "Book a fit call" stays in the menu. */
@media (max-width: 359.98px) {
  .it-header .it-header__book { display: none; }
}

/* Without scripting the Menu button cannot open anything, so the navigation stays in flow. */
@media (scripting: none) and (max-width: 1279.98px) {
  .it-header .it-header__bar { flex-wrap: wrap; }
  .it-header .it-header__actions { display: none; }
  .it-header .it-header__nav {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    max-height: none;
    border-color: var(--ih-pill-line);
    border-radius: 24px;
    background: var(--ih-pill);
    box-shadow: var(--ih-pill-shadow);
  }
  .it-header .it-header__list { flex-direction: row; flex-wrap: wrap; }
  .it-header .it-header__link { flex: 0 0 auto; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .it-header *, .it-header *::before, .it-header *::after { transition: none !important; }
}

/* The frame's lower half. Every page footer carries class="it-frame" and stands on the same sky as the
   header, the horizon along its upper edge. Its layout stays the page family's own; footers without one
   (privacy, not found, Open Studio's fallback) take the default below, which has no specificity. */
html body footer.it-frame {
  position: relative;
  background-color: var(--it-sky-base);
  background-image: var(--it-sky-stars), var(--it-sky-night);
  background-size: var(--it-sky-stars-size), auto, auto, auto;
  color: var(--it-sky-muted);
  border-top: 0;
}
html body footer.it-frame::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: var(--it-sky-horizon); pointer-events: none; }
html body footer.it-frame :is(p, .foot__legal) { color: var(--it-sky-muted); }
html body footer.it-frame :is(a, button) { color: var(--it-sky-ink); }
html body footer.it-frame a[aria-current="page"] { text-decoration-line: underline; text-decoration-color: var(--it-sky-current); text-decoration-thickness: 2px; text-underline-offset: 6px; }
html body footer.it-frame :is(a, button):focus-visible { outline: 2px solid var(--it-sky-focus); outline-offset: 3px; }
@media (hover: hover) {
  html body footer.it-frame :is(a, button):hover { color: var(--it-sky-hover); }
}
html body footer.it-frame img { filter: none; opacity: 1; }
/* Every footer control is a 44px target (the cookie settings button and Open Studio's privacy link were not).
   Page families that lay their links out as flex or grid items keep doing so; their rules outrank this one. */
html body footer.it-frame :is(nav a, button) { display: inline-flex; align-items: center; min-height: 44px; }
:where(footer.it-frame:not(.shared-footer)) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin: 0;
  padding: 24px var(--it-sky-gutter);
  font: 14px/1.5 "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
}
:where(footer.it-frame:not(.shared-footer)) :where(p) { margin: 0; }
:where(footer.it-frame:not(.shared-footer)) :where(a, button) { display: inline-flex; align-items: center; min-height: 44px; }

/* A page whose own canvas is the night (the #BuildInPublic articles, privacy, the not-found page) carries
   body class="it-sky". The field is a fixed layer behind the page, so a long page keeps one sky while it
   scrolls, composited rather than repainted. */
body.it-sky { background-color: var(--it-sky-base); }
body.it-sky::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--it-sky-base);
  background-image: var(--it-sky-field), var(--it-sky-night);
  background-size: var(--it-sky-field-size), auto, auto, auto;
  pointer-events: none;
}

/* Skip link: first stop on every page, shown when focused (positioning is !important for the same reason). */
.it-skip {
  position: absolute !important;
  top: -200px;
  left: 12px;
  z-index: 100 !important;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 4px;
  background: #102d3b;
  color: #faf7ed;
  font: 500 15px/1 "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  text-decoration: none;
}
.it-skip:focus { top: 12px; outline: 2px solid #faf7ed; outline-offset: 0; box-shadow: 0 0 0 4px #102d3b; }

/* Print last, so it outranks every screen rule above: paper drops the sky (header, footer frame, night canvas,
   the horizon) and the chrome prints as ink. The homepage still prints its inline report without any chrome
   (report/report.css hides the header and footer there). */
@media print {
  .it-skip, .it-header .it-header__actions, .it-header .it-header__nav { display: none !important; }
  html .it-header.site-header[data-site-header], html body footer.it-frame, body.it-sky { background: none; box-shadow: none; color: #102d3b; }
  .it-header::after, html body footer.it-frame::before, body.it-sky::before { display: none; }
  .it-header .it-header__logo, html body footer.it-frame img { filter: brightness(0); }
  html body footer.it-frame :is(a, button, p, .foot__legal) { color: #102d3b; }
}
