/* Homepage: nav, pinned 3D stage (sections 0 to 3), workings split (4). Lower sections: lower.css. */

body.home { background: #4f7565; }

/* ---------- Nav ---------- */
.nav {
  transition: transform 0.6s var(--ease-out), background-color 0.4s var(--ease-out), color 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 0 var(--gutter);
  color: var(--ivory);
  border-bottom: 1px solid transparent;
}
.nav.is-hidden { transform: translateY(-110%); }
.nav.is-solid {
  background: rgba(12, 34, 30, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.nav.is-light {
  background: rgba(251, 248, 241, 0.86);
  color: var(--forest);
  border-bottom-color: var(--hair-light);
}
.nav.is-light .nav__cta { border-color: rgba(27, 61, 44, 0.45); color: var(--forest); }
.nav__brand { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; }
.nav__mark { width: 30px; height: 30px; fill: currentColor; }
.nav__word {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.01em;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.nav__sub {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.32em;
  opacity: 0.7;
}
.nav__links { display: flex; gap: 40px; font-size: 15px; font-weight: 500; }
.nav__links a { position: relative; padding: 6px 0; }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__cta { border-color: rgba(255, 255, 255, 0.6); }
.nav__menu { display: none; width: 44px; height: 44px; position: relative; }
.nav__menu i {
  position: absolute;
  left: 11px; right: 11px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s var(--ease-out), top 0.3s var(--ease-out);
}
.nav__menu i:first-of-type { top: 18px; }
.nav__menu i:last-of-type { top: 25px; }
.nav__menu[aria-expanded="true"] i:first-of-type { top: 21.5px; transform: rotate(45deg); }
.nav__menu[aria-expanded="true"] i:last-of-type { top: 21.5px; transform: rotate(-45deg); }

.menu-sheet {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--forest-900);
  padding: calc(var(--nav-h) + 24px) var(--gutter) 40px;
}
.menu-sheet nav { display: flex; flex-direction: column; gap: 4px; }
.menu-sheet a {
  font-family: var(--serif);
  text-transform: uppercase;
  font-size: 34px;
  line-height: 1.25;
  padding: 6px 0;
  border-bottom: 1px solid var(--hair-dark);
}
.menu-sheet__cta { color: var(--signal); }

/* ---------- Duck film layer ---------- */
.media {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, #607253 0 52%, #81ad90 52% 100%);
}
.media__layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  display: block;
  will-change: transform, opacity;
  transform-origin: 0 0;
}
/* Safari can clear its native poster before presenting the first video frame. Keep the same still
   beneath the video pixels, on the same element so its crop and motion remain identical. */
.media__layer[data-layer="float"] {
  background: url("../assets/img/duck-still.webp?v=w2") center / cover no-repeat;
}
/* the underwater loop stays hidden until the film layer fades it in over the scrubbed shot */
.media__layer[data-layer="swim"] { opacity: 0; visibility: hidden; }
/* portrait screens show the film as a band: the film's own colours continue above and below it, each
   with a soft edge over the band. They only ever move (media-stage.js), so nothing repaints as the band
   follows the duck. */
.media__edge { display: none; }
.media.is-portrait .media__edge {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  will-change: transform;
  transform-origin: 0 0;
}
.media-glow {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100lvh;
  z-index: 1;
  object-fit: cover;
  object-position: 66% 50%;
  transform: scale(1.08);
  filter: brightness(0.74) saturate(1.1);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

/* The small head script prepares only an eligible intro. Without it all copy stays visible. */
html.intro-pending .hero-title .line__in { transform: translate3d(0, 105%, 0); }
html.intro-pending .hero-lower,
html.intro-pending .stats { opacity: 0; transform: translate3d(0, 16px, 0); }
html.intro-framing .media__layer[data-layer="float"] {
  width: var(--intro-w);
  height: var(--intro-h);
  transform: translate3d(var(--intro-x), var(--intro-y), 0);
}
html.intro-framing.intro-portrait .media__edge {
  display: block;
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: var(--intro-viewport);
}
html.intro-framing.intro-portrait [data-edge="sky"] {
  background: linear-gradient(180deg, rgb(96, 114, 83) 0 calc(var(--intro-viewport) - var(--intro-fade)), rgba(96, 114, 83, 0) var(--intro-viewport));
  transform: translate3d(0, var(--intro-sky), 0);
}
html.intro-framing.intro-portrait [data-edge="ground"] {
  background: linear-gradient(180deg, rgba(129, 173, 144, 0) 0, rgb(129, 173, 144) var(--intro-fade));
  transform: translate3d(0, var(--intro-ground), 0);
}

/* ---------- Pinned stage ---------- */
.stage-track { position: relative; height: 640vh; }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  z-index: 3;
}


/* Layout-sheet guides (opacity driven by JS) */
.guides { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.guide { position: absolute; background: rgba(255, 255, 255, 0.2); }
.guide--v { top: 0; bottom: 0; width: 1px; }
.guide--h { left: 0; right: 0; height: 1px; }

/* Hero copy */
.hero-copy { position: absolute; inset: 0; pointer-events: none; }
.hero-copy::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48vh;
  background: linear-gradient(0deg, rgba(6, 26, 20, 0.66) 0%, rgba(6, 26, 20, 0.34) 45%, rgba(6, 26, 20, 0) 100%);
  pointer-events: none;
}
.hero-copy a, .hero-copy button { pointer-events: auto; }
.hero-title {
  position: absolute;
  left: var(--gutter);
  top: calc(var(--nav-h) + 6.5vh);
  font-size: var(--fs-hero);
  color: var(--ivory);
  z-index: 2;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.hero-title .line__in { display: inline-block; will-change: transform; }
.hero-title .line--indent { padding-left: 0.7em; }
.hero-title .o-mark { position: relative; display: inline-block; color: transparent; }
.hero-title .o-mark .mark-glyph { position: absolute; left: 50%; top: 50%; translate: -50% -46%; margin: 0; }
.hero-title .mark-glyph {
  width: 0.62em;
  height: 0.62em;
  margin: 0 0.02em;
  vertical-align: 0.02em;
  fill: var(--signal);
}
.hero-lower {
  position: absolute;
  left: calc(var(--gutter) + var(--fs-hero) * 0.7);
  bottom: 5.5vh;
  width: min(440px, 36vw);
  z-index: 2;
}
.hero-sub {
  font-size: 15px;
  line-height: 1.45;
  max-width: 34ch;
  margin-bottom: 36px;
  color: var(--ivory);
  text-shadow: 0 1px 12px rgba(6, 26, 20, 0.5);
}
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }
.stats {
  position: absolute;
  right: var(--gutter);
  bottom: 5.5vh;
  display: flex;
  gap: 12px;
  z-index: 2;
}
.stat.glass { background: rgba(8, 32, 26, 0.46); border-color: rgba(255, 255, 255, 0.22); }
.stat {
  position: relative;
  width: clamp(190px, 16vw, 240px);
  height: clamp(112px, 15.6vh, 132px);
  padding: 18px 18px 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat__num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.stat__label { font-size: 14px; line-height: 1.3; max-width: 15ch; color: var(--ivory); }
.stat__icon { position: absolute; right: 18px; bottom: 18px; width: 20px; height: 20px; color: var(--ivory); }

/* Acts 2 and 3 */
.act {
  position: absolute;
  left: var(--gutter);
  top: calc(var(--nav-h) + 2.5vh);
  width: min(980px, 58vw);
  z-index: 2;
  opacity: 0;
  visibility: hidden;
}
.act::before {
  content: "";
  position: absolute;
  inset: -90px -160px -110px -120px;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(16, 44, 33, 0.3), rgba(16, 44, 33, 0.12) 60%, transparent);
  pointer-events: none;
}
.act__title { font-size: clamp(44px, 5.8vw, 104px); line-height: 0.98; color: var(--ivory); text-shadow: 0 1px 24px rgba(12, 36, 27, 0.25); }
.act__title > span { display: block; white-space: nowrap; }
.act__sub {
  margin-top: clamp(16px, 1.8vw, 26px);
  max-width: 46ch;
  font-size: clamp(16px, 1.3vw, 21px);
  font-weight: 500;
  line-height: 1.45;
  color: var(--ivory);
  text-shadow: 0 1px 14px rgba(12, 36, 27, 0.45);
}
/* no will-change here: it made every letter (and its copies inside the bubble lenses) a permanent GPU layer */
.act .ch { display: inline-block; }

/* Bubbles: soap-bubble lenses. Each one magnifies what is behind it (the film, drawn into its
   canvas, and a scaled copy of the act headline), with an iridescent rim and two highlights. */
.bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.bubble {
  --s: 150px;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  opacity: 0;
  box-shadow: 0 10px 30px rgba(6, 30, 26, 0.16);
  will-change: transform, opacity;
}
.bubble__lens { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; visibility: hidden; }
.bubble__text { position: absolute; left: 0; top: 0; z-index: 1; display: none; transform-origin: 0 0; pointer-events: none; }
.bubble__text .act { position: absolute; left: 0; top: 0; opacity: 1; visibility: visible; }
.bubble__text .act::before { display: none; }
/* the film of water over the lens, the rim's thin-film colours, then the highlights */
.bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  background:
    conic-gradient(from 200deg, rgba(255, 120, 200, 0.75), rgba(120, 210, 255, 0.75), rgba(150, 255, 190, 0.7), rgba(255, 236, 140, 0.75), rgba(255, 150, 120, 0.7), rgba(255, 120, 200, 0.75));
  -webkit-mask: radial-gradient(circle closest-side, transparent 80%, rgba(0, 0, 0, 0.35) 89%, #000 96%, rgba(0, 0, 0, 0.6) 100%);
  mask: radial-gradient(circle closest-side, transparent 80%, rgba(0, 0, 0, 0.35) 89%, #000 96%, rgba(0, 0, 0, 0.6) 100%);
  opacity: 0.42; /* plain alpha: a blend mode here made phones redraw every bubble offscreen each frame */
}
.bubble::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 15% 10% at 31% 22%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 100%),
    radial-gradient(ellipse 34% 22% at 34% 24%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 100%),
    radial-gradient(circle at 72% 79%, rgba(255, 255, 255, 0.55) 0 2.2%, rgba(255, 255, 255, 0) 6%),
    radial-gradient(circle closest-side, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.1) 86%, rgba(255, 255, 255, 0.5) 97%, rgba(255, 255, 255, 0.15) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38), inset -8px -12px 26px rgba(255, 255, 255, 0.14), inset 6px 10px 22px rgba(4, 30, 26, 0.12);
}
.bubble__label {
  position: relative;
  z-index: 4;
  font-family: var(--serif);
  text-transform: uppercase;
  font-size: calc(var(--s) * 0.135);
  line-height: 1;
  letter-spacing: 0.01em;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(10, 40, 34, 0.5), 0 0 14px rgba(10, 40, 34, 0.4);
  max-width: 82%;
}
.bubble__label i { font-style: italic; }

/* ---------- Workings split ---------- */
.workings-track { position: relative; height: 420vh; z-index: 3; }
.workings {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-columns: 37.7% 1fr;
}
.panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 5.5vh, 56px) clamp(24px, 2.8vw, 44px) clamp(24px, 4vh, 40px);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(214, 233, 222, 0.12), transparent 60%),
    linear-gradient(180deg, #5f8a78 0%, #3f6a5a 55%, #33594b 100%);
  color: var(--ivory);
  overflow: hidden;
}
.panel__top { display: flex; justify-content: space-between; align-items: center; }
.panel__count { font-size: 14px; opacity: 0.85; }
.panel__title { margin-top: 26px; font-size: clamp(30px, 3.1vw, 50px); }
.panel__title > span { display: block; }
.panel__title .indent { padding-left: 1.25em; }
.items { margin-top: auto; }
.item { border-top: 1px solid rgba(255, 255, 255, 0.22); }
.item:first-child { border-top: 0; }
.item__head {
  font-family: var(--serif);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(17px, 1.55vw, 23px);
  line-height: 1.1;
  padding: 18px 0;
  display: flex;
  gap: 0.35em;
  align-items: baseline;
}
.item__head .num { font-size: 1.05em; }
.item__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.75s var(--ease-out), opacity 0.5s var(--ease-out);
  opacity: 0;
}
.item__inner { overflow: hidden; min-height: 0; }
.item.is-open .item__body { grid-template-rows: 1fr; opacity: 1; }
.item__body p { font-size: 14px; line-height: 1.45; max-width: 46ch; color: rgba(244, 239, 228, 0.88); }
.item__art {
  margin: 16px 0 20px;
  height: clamp(110px, 17vh, 150px);
  border-radius: var(--radius-well);
  background: rgba(10, 30, 22, 0.2);
  display: grid;
  place-items: center;
}
.item__art svg { height: 86%; width: auto; max-width: 92%; overflow: visible; }
/* Workings art draws on each time its item opens (slots in --i, see tools/make_work_art.py) */
.item__art .bar { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.item__art .pl { opacity: 0; transform: translate3d(0, 12px, 0); }
.item__art .cc,
.item__art .nd { transform-box: fill-box; transform-origin: 50% 50%; transform: scale(0); }
.item__art .ln { stroke-dasharray: 1 2; stroke-dashoffset: 1; }
.item__art .dt { opacity: 0; }
.item.is-open .item__art .bar { transform: none; transition: transform 0.8s var(--ease-out) calc(0.3s + var(--i, 0) * 90ms); }
.item.is-open .item__art .pl { opacity: 1; transform: none; transition: opacity 0.6s ease calc(0.3s + var(--i, 0) * 160ms), transform 0.9s var(--ease-out) calc(0.3s + var(--i, 0) * 160ms); }
.item.is-open .item__art .cc { transform: none; transition: transform 0.75s var(--ease-out) calc(0.3s + var(--i, 0) * 120ms); }
.item.is-open .item__art .nd { transform: none; transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) calc(0.3s + var(--i, 0) * 120ms); }
.item.is-open .item__art .ln { stroke-dashoffset: 0; transition: stroke-dashoffset 1s var(--ease-out) calc(0.3s + var(--i, 0) * 120ms); }
.item.is-open .item__art .dt { opacity: 1; transition: opacity 0.6s ease calc(0.3s + var(--i, 0) * 120ms); }
@media (prefers-reduced-motion: reduce) {
  .item__art .bar, .item__art .pl, .item__art .cc, .item__art .nd { transform: none; opacity: 1; }
  .item__art .ln { stroke-dashoffset: 0; }
  .item__art .dt { opacity: 1; }
}
.split-window { position: relative; height: 100%; }

/* ---------- Film modal ---------- */
.film-modal {
  margin: auto;
  width: min(1280px, 94vw);
  max-height: 94vh;
  border: 0;
  padding: 0;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  color: var(--ivory);
}
.film-modal::backdrop { background: rgba(6, 18, 12, 0.82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.film-modal__video { width: 100%; aspect-ratio: 16 / 9; background: #000; }
.film-modal__close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
}
.film-modal__close svg { width: 16px; height: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { left: calc(var(--gutter) + var(--fs-hero) * 0.7); right: auto; bottom: 4vh; }
  .stat { height: 96px; width: 180px; }
  .hero-lower { bottom: calc(4vh + 112px); }
}
@media (max-width: 820px) {
  .nav__links, .nav__cta { display: none; }
  .nav__menu { display: block; }
  .hero-title { top: calc(var(--nav-h) + 3vh); }
  .act { width: auto; right: var(--gutter); }
  .workings { grid-template-columns: 1fr; grid-template-rows: 42% 58%; }
  .split-window { grid-row: 1; }
  .panel { grid-row: 2; padding-top: 22px; }
  .panel__title { margin-top: 14px; font-size: 30px; }
  .item__head { padding: 12px 0; font-size: 17px; }
  .item__art { height: 92px; margin: 10px 0 12px; }
  .bubble { --s: 112px; }
}
@media (max-width: 520px) {
  :root { --fs-hero: 15.2vw; }
  .hero-lower { left: var(--gutter); right: var(--gutter); width: auto; bottom: calc(3vh + 100px); }
  .hero-sub { margin-bottom: 20px; font-size: 14.5px; }
  .hero-ctas .btn { --h: 50px; font-size: 16px; padding: 0 22px; }
  .hero-ctas .btn--outline { padding: 0 20px 0 5px; }
  .btn__disc { width: 40px; height: 40px; }
  .stats { left: var(--gutter); right: var(--gutter); bottom: 2.4vh; gap: 8px; }
  .stat { flex: 1; width: auto; height: 86px; padding: 12px 12px 10px 14px; border-radius: 16px; }
  .stat__num { font-size: 28px; }
  .stat__label { font-size: 12px; }
  .stat__icon { display: none; }
  .act__sub { font-size: 14.5px; }
  .act__title { font-size: 10.4vw; }
  .act__title .indent { padding-left: 0.7em; }
}

/* ---------- Layering with the lower sections ---------- */
main > section:not(.stage-track):not(.workings-track),
.site-footer { position: relative; z-index: 3; }
body[data-media="off"] .media,
body[data-media="off"] .media-glow { visibility: hidden; }

html.menu-open, html.menu-open body { overflow: hidden; }

/* ---------- Pause motion ---------- */
.nav__motion {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  display: grid;
  place-items: center;
  color: inherit;
  transition: border-color 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}
.nav__motion:hover { border-color: currentColor; background: rgba(255, 255, 255, 0.06); }
.nav__motion svg { width: 14px; height: 14px; }
.nav__motion .i-play { display: none; }
.nav__motion[aria-pressed="true"] .i-play { display: block; }
.nav__motion[aria-pressed="true"] .i-pause { display: none; }
.nav.is-light .nav__motion { border-color: rgba(27, 61, 44, 0.45); }
.menu-sheet__motion {
  margin-top: 28px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 15px;
}
html.motion-off *, html.motion-off *::before, html.motion-off *::after { animation-play-state: paused !important; }
html.modal-open, html.modal-open body { overflow: hidden; }
#main:focus { outline: none; }

/* ---------- Short phones ---------- */
@media (max-width: 520px) and (max-height: 720px) {
  :root { --fs-hero: 12.6vw; }
  .hero-title { top: calc(var(--nav-h) + 1.5vh); }
  .hero-sub { font-size: 13.5px; margin-bottom: 12px; }
  .hero-ctas .btn { --h: 46px; }
  .stat { height: 70px; }
  .stat__num { font-size: 22px; }
  .stat__label { font-size: 11px; }
  .panel { padding-top: 14px; }
  .panel__title { margin-top: 8px; font-size: 24px; }
  .item__head { padding: 9px 0; font-size: 15px; }
  .item__body p { font-size: 13px; }
  .item__art { height: 64px; margin: 8px 0 10px; }
}
@media (max-width: 820px) {
  .nav__motion { display: none; }
}

/* ---------- Wordmark lockup: TECH stacked under QUATTRO, starting just past the Q (as in the logo) ---------- */
.nav__word { flex-direction: column; align-items: flex-start; gap: 3px; font-size: 23px; }
.nav__sub { margin-left: 36%; font-size: 8.5px; letter-spacing: 0.34em; line-height: 1; opacity: 0.78; }
