/* Nav lockup, scrubbed by the scroll (the logo glides with the scroll, and back slowly).
   nav.js sets four custom properties on <html> from scrollY, every frame:
     --nav-x      the logo's offset to centre (px); the logo moves with it
     --nav-a      0..1: header background, bottom rule, links and Menu opacity (fades in the second half)
     --nav-badge  0..1: the paper badge behind the logo (appears at the end)
   There are no CSS transitions here: the scroll drives these values. html.nav-centred is set only when
   the glide is complete; it hides the links and Menu from the tab order and the hit area. */
.nav {
  background: color-mix(in srgb, var(--paper) calc(var(--nav-a, 1) * 100%), transparent);
  border-bottom-color: color-mix(in srgb, var(--rule) calc(var(--nav-a, 1) * 100%), transparent);
}
.nav__logo {
  position: relative;
  isolation: isolate;
  transform: translateX(var(--nav-x, 0px));
}
/* The badge is drawn behind the logo and sits outside the logo box, so the logo box (and its centre)
   does not change size when it appears. */
.nav__logo::before {
  content: "";
  position: absolute;
  inset: -10px -14px;
  z-index: -1;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, .08);
  opacity: var(--nav-badge, 0);
  pointer-events: none;
}
.nav__links,
.nav__menu {
  opacity: var(--nav-a, 1);
}
html.nav-centred .nav {
  pointer-events: none;
}
html.nav-centred .nav__logo {
  pointer-events: auto;
}
/* Only at the end of the glide: the links and Menu leave the tab order and the hit area. */
html.nav-centred .nav__links,
html.nav-centred .nav__menu {
  visibility: hidden;
  pointer-events: none;
}

/* Pinned sections (the glass fuse, the services stage) pin at the very top once the header is gone.
   Scoped to them: a body-level override also changed the hero's min-height, which caused a jump. */
html.nav-centred .prob,
html.nav-centred .story__stage { --nav-h: 0px; }

/* Chief: when floating, the whole badge is the link (its padding sits outside the logo box), shows a
   pointer, and answers hover with a slightly firmer edge. */
.nav__logo { cursor: pointer; }
html.nav-centred .nav__logo::before { pointer-events: auto; transition: border-color .2s; }
html.nav-centred .nav__logo:hover::before { border-color: rgba(0, 0, 0, .28); }

/* ---- The island: at the centred position the badge becomes a pill that opens to the nav links on hover,
   focus or tap. nav.js builds it from clones of the real logo and links (same hrefs, same data-wipe), and sets
   its top and width. It is visible only while html.nav-centred is set, so the hand-over at t == 1 is invisible. */
.island {
  --spring: linear(0, 0.06 4.4%, 0.23 9.2%, 0.69 20.4%, 0.87 26.6%, 0.99 33.4%, 1.04 39.4%, 1.05 45.7%, 1.03 54.5%, 1.0 66%, 0.997 80%, 1);
  position: fixed;
  left: 50%;
  top: 0;
  z-index: 21;
  transform: translateX(-50%);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 9px 13px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 12px;
  background: var(--paper);
  font: var(--t-small);
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: none;
  transition: width 520ms var(--spring) 190ms, box-shadow 300ms ease 0ms;
}
html.nav-centred .island { opacity: 1; visibility: visible; pointer-events: auto; }
html.nav-centred .nav__logo { opacity: 0; visibility: hidden; }
.island.is-open {
  box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
  transition: width 650ms var(--spring) 0ms, box-shadow 300ms ease 0ms;
}
.island.is-measure { width: max-content !important; transition: none !important; }
.island__logo, .island__rule, .island__links { flex: none; }
.island__logo img { display: block; }
.island__rule {
  width: 1px;
  height: 16px;
  margin: 0 12px;
  background: rgba(0, 0, 0, .12);
  opacity: 0;
  transition: opacity 140ms linear 0ms;
}
.island.is-open .island__rule { opacity: 1; transition: opacity 300ms ease 120ms; }
.island__links { display: flex; gap: 32px; }
.island__link {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  filter: blur(4px);
}
.island.is-open .island__link {
  opacity: 1;
  visibility: visible;
  transform: none;
  filter: none;
  transition: opacity 380ms cubic-bezier(.2, .7, .2, 1) calc(120ms + var(--i) * 40ms),
    transform 380ms cubic-bezier(.2, .7, .2, 1) calc(120ms + var(--i) * 40ms),
    filter 380ms cubic-bezier(.2, .7, .2, 1) calc(120ms + var(--i) * 40ms),
    visibility 0s linear 0s;
}
/* Leaving: opacity and translateY(-4px) only, reverse stagger (last link leaves first).
   nav.js keeps is-leaving for 200ms, the length of the longest exit (50ms + 140ms). */
.island.is-leaving .island__link {
  opacity: 0;
  visibility: visible;
  transform: translateY(-4px);
  filter: none;
  transition: opacity 140ms linear calc((2 - var(--i)) * 25ms),
    transform 140ms linear calc((2 - var(--i)) * 25ms),
    visibility 0s linear calc(140ms + (2 - var(--i)) * 25ms);
}
@media (max-width: 760px) {
  .island__links { gap: 16px; }
  .island__rule { margin: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .island, .island * { transition: none !important; }
}

/* Chief: no divider on phones so the open island fits (Contact was clipped by ~36px). */
@media (max-width: 760px) { .island__rule { display: none; } }

/* Shared draft tokens (Kassem, Nov 12: "all headers same size"). One opening-headline size for every
   page (home, Services, About); nav.css is the one stylesheet all drafts share. When the drafts move to
   the live site, move this into site.css's --t-display. */
:root { --t-display: 600 60px/66px var(--font); }
@media (max-width: 760px) { :root { --t-display: 600 40px/48px var(--font); } }
/* The closing headline is the opening's size, so both ends of a page share one voice. Resolves
   var(--t-display) at use time, so the phone override above cascades to it too. */
:root { --t-close: var(--t-display); }

/* ---- Page opening (shared by Services and About): full-bleed photo, bottom scrim, headline bottom-left ---- */
.open { position: relative; overflow: hidden; isolation: isolate; color: var(--paper); background: #2f3830;
  height: max(560px, calc(100svh - var(--nav-h, 80px))); }
/* 40px taller than the section, so the -40px parallax never uncovers the bottom edge. */
.open__img { position: absolute; left: 0; right: 0; top: 0; height: calc(100% + 40px); z-index: -2;
  background-color: #2f3830; will-change: transform; }
/* The photo itself is the page's (about.css, svc.css). Cover and centre by default; kept at :where() so a
   page's own .open__img rule can move the focal point (Services does) whatever order the sheets load in. */
:where(.open__img) { background-size: cover; background-position: center; }
.open__scrim { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(0deg, rgba(0, 0, 0, .74) 0%, rgba(0, 0, 0, .6) 40%, rgba(0, 0, 0, .3) 65%, rgba(0, 0, 0, 0) 85%); }
/* Chief (Kassem: "too low"): the opening text sits a fifth of the screen up, not on the floor. */
.open__text { position: absolute; left: var(--margin); right: var(--margin); bottom: clamp(96px, 20vh, 200px);
  display: grid; gap: 24px; justify-items: start; }
.open__title { color: var(--paper); margin: 0; }
.open__lead { font: var(--t-lead); color: rgba(255, 255, 255, .92); margin: 0; max-width: 30em; }
@media (max-width: 760px) {
  .open__text { bottom: 40px; }
}

/* ---- How we start (shared by home and Services) ---- */
/* How we start: the closing note reads as the page's one big spoken passage, so it takes the
   full measure of a column rather than the standard body size. The label keeps the left column
   and the paragraphs take the right, matching the two-column rhythm of the sections above. */
.start .prose {
  font: 400 32px/44px var(--font);
  color: var(--ink);
  max-width: 28em;
}
.start .prose + .prose { margin-top: 24px; }
@media (min-width: 961px) {
  .start { grid-template-columns: 1fr 1fr; column-gap: 48px; align-items: start; }
}
@media (max-width: 960px) {
  .start .prose{ font-size: 24px; line-height: 34px; }
}

.start__more { display: inline-block; margin-top: 32px; }

/* ---- Section title: a real heading where a section leads with one statement (Kassem, Nov 13: labels read tiny) ---- */
.sec-title { font: var(--t-h2); letter-spacing: -.02em; color: var(--ink); margin: 0; text-transform: none; }

/* ---- Arrow links share the Contact button's hover: the underline grows into the drifting four-colour fill (Kassem, Nov 13) ---- */
.link.go { isolation: isolate; }
.link.go::after { top: auto; bottom: -1px; left: 0; right: 0; height: 2px; z-index: -1;
  transition: height .35s var(--ease), left .35s var(--ease), right .35s var(--ease), transform .35s var(--ease); }
.link.go:hover::after, .link.go:focus-visible::after { top: auto; bottom: -2px; left: -6px; right: -6px; height: calc(100% + 4px); transform: scaleX(1);
  background: linear-gradient(90deg, var(--strategy), var(--design), var(--software), var(--result), var(--strategy)); background-size: 300% 100%; animation: drift 3s linear infinite; }
.link.go:hover, .link.go:focus-visible { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .link.go:hover::after, .link.go:focus-visible::after { animation: none; } }

/* ---- Close and night footer, shared by all three pages (was copied into each page's CSS).
   Kassem, Nov 13: the close took ~70% of a laptop screen; it now reads as an ending, not a page:
   72px above the title, 72px between the button and the footer. ---- */
.close { padding: 72px var(--margin) 0; }
.close .cloud { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -1; }
.footer--night { position: relative; margin: 72px calc(-1 * var(--margin)) 0; padding: 40px var(--margin); color: var(--paper);
  justify-content: flex-start; gap: 120px; }
.footer--night .muted { color: var(--on-ink-muted); }
@media (max-width: 760px) {
  .close { padding-top: 48px; }
  .footer--night { margin-top: 64px; gap: 32px; }
}

/* ---- Experience logos: one quiet grey at rest, their own colours on hover (Kassem, Nov 13,
   reversing the Nov 12 always-colour call). One file per logo; the filter does the grey. ---- */
.marquee img, .marquee__name { filter: grayscale(1); opacity: .55; transition: filter .3s var(--ease), opacity .3s var(--ease); }
.marquee li:hover img, .marquee li:hover .marquee__name { filter: none; opacity: 1; }

/* ---- Phones: tap targets and the legal line (Nov 13 measurements) ----
   Island links were 23px tall; vertical padding with an equal negative margin gives a 44px target
   without changing the island's size. The legal line read 2.1:1 where the terrain's bright dots sit
   behind it on phones; a soft dark backing under the footer text brings it above 4.5:1. */
@media (max-width: 760px) {
  .island__link { padding: 12px 0; margin: -12px 0; }
  .footer--night::before { content: ""; position: absolute; inset: -24px 0 0 0; z-index: -1; pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .78) 48px); }
}
/* Vitalize is set as text (no logo file yet); on hover it takes its own brand blue (#488CF4, from vitalize.care). */
.marquee li.marquee__name:hover { filter: none; opacity: 1; color: #488CF4; }

/* ---- Close: Daylight on every page. Morning sky to warm white, ink type; the terrain canvas is transparent
   (Art.terrain option clear), so the CSS ground shows through. ---- */
.close { background: linear-gradient(180deg, #dfe9f3 0%, #faf6ef 100%); color: var(--ink); }
.close__sub { color: #444; }
.cta--light::before { background: var(--ink); }
.footer--night { color: var(--ink); }
.footer--night .muted { color: #555; }
@media (max-width: 760px) {
  .footer--night::before { background: linear-gradient(180deg, rgba(250, 246, 239, 0) 0, rgba(250, 246, 239, .85) 48px); }
}

/* ---- Logo hover (Kassem, Nov 14): the mark rebuilds itself. The six bars part to either side, the
   meridian runs top to bottom in work order (strategy, design, software, result), and the bars snap
   back onto it one after another: built as one. Transforms only; reduced motion keeps it still. ---- */
.nav__mark { display: block; }
.nav__mark .mk { transform-box: fill-box; }
.nav__mark .mk-l, .nav__mark .mk-r { transition: transform 420ms cubic-bezier(.34, 1.56, .64, 1) calc(var(--i) * 70ms + 260ms); }
.nav__mark .mk-m { transform-origin: 50% 0; }
.nav__logo:hover .nav__mark .mk-l, .nav__logo:focus-visible .nav__mark .mk-l, .island__logo:hover .nav__mark .mk-l { animation: mk-part-l 760ms cubic-bezier(.65, 0, .35, 1) calc(var(--i) * 70ms) both; }
.nav__logo:hover .nav__mark .mk-r, .nav__logo:focus-visible .nav__mark .mk-r, .island__logo:hover .nav__mark .mk-r { animation: mk-part-r 760ms cubic-bezier(.65, 0, .35, 1) calc(var(--i) * 70ms) both; }
.nav__logo:hover .nav__mark .mk-m, .nav__logo:focus-visible .nav__mark .mk-m, .island__logo:hover .nav__mark .mk-m { animation: mk-run 520ms cubic-bezier(.22, 1, .36, 1) calc(var(--i) * 90ms + 120ms) both; }
@keyframes mk-part-l { 0% { transform: none; } 35% { transform: translateX(-42%); } 100% { transform: none; } }
@keyframes mk-part-r { 0% { transform: none; } 35% { transform: translateX(42%); } 100% { transform: none; } }
@keyframes mk-run { 0% { transform: scaleY(0); } 100% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .nav__logo .nav__mark .mk { animation: none !important; } }

/* Phones, open island (Chief, Nov 14): nav.js caps the open island at 100vw - 32px, and with the 140px logo
   Services and Contact overflowed it (the logo also touched Services). The island logo is shown at 108px and the
   links sit 16px from it, so all three links fit inside the island. */
@media (max-width: 760px) {
  .island__logo .nav__mark { width: 108px; height: 26px; }
  .island__links { gap: 14px; margin-left: 16px; }
}
