/* =========================================================
   Nate Douglas / filmstrip front door
   Matas-faithful: white, minimal, near-black, inset margins.
   No brand color system here. That lives on the case studies.
   ========================================================= */

:root {
  --paper:      #ffffff;
  --ink:        #141414;
  --ink-soft:   #6f6f6f;
  --ink-faint:  #a6a6a6;
  --hair:       #ececec;
  --frame:      #1a1a1a;
  --screen:     #f3f3f1;

  --slot: min(48vw, 640px);
  --gap:  clamp(52px, 6vw, 112px);

  --inset:  clamp(28px, 6vw, 104px);
  --inset-y: clamp(22px, 3.4vw, 42px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* night mode: dark ground, light ink, lighter device frames */
body.night {
  --paper:      #101014;
  --ink:        #ededf0;
  --ink-soft:   #a3a3ab;
  --ink-faint:  #6a6a73;
  --hair:       #2a2a31;
  --frame:      #33333a;
  --screen:     #f3f3f1;
}
body.night .detail-backdrop { background: rgba(16, 16, 20, 0.9); }
body.night .about-card { background: rgba(16, 16, 20, 0.86); }
body.night .screen-embed { background: #101014; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
}

body { overflow-x: hidden; }
body.detail-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

::selection { background: #141414; color: #fff; }

/* ---------- header (Matas: big stacked name left, muted links stacked right,
   both pushed inward and down, generous margin all around) ---------- */

.site-head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(40px, 7vh, 100px) var(--inset) 0;
  pointer-events: none;
}
.site-head > * { pointer-events: auto; }

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.16;
}
.brand .name {
  font-size: clamp(25px, 2.5vw, 33px);
  font-weight: 400;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.brand .year {
  font-size: clamp(25px, 2.5vw, 33px);
  font-weight: 400;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: clamp(13px, 0.95vw, 15px);
  font-weight: 400;
  line-height: 1.35;
}
.nav a,
.nav button {
  color: #9a9a9a;
  padding: 1px 0;
  transition: color 0.3s var(--ease);
}
.nav a:hover,
.nav button:hover,
.nav a:focus-visible,
.nav button:focus-visible { color: var(--ink); }

/* ---------- filmstrip stage ---------- */

/* ---------- static intro (front-door positioning, sits above the filmstrip) ----------
   Deliberately plain: no pin, no ScrollTrigger, no entrance animation. Its height feeds
   the filmstrip pin start, which the JS recomputes via ScrollTrigger.refresh(). */
.intro {
  /* shorter than the viewport on purpose so the first project device peeks below it (Job 3) */
  padding: max(clamp(118px, 17vh, 188px), calc(clamp(40px, 7vh, 100px) + 132px)) var(--inset) clamp(14px, 2.4vh, 30px);
  max-width: 1100px;
  /* Keep the positioning statement close to the identity block while preserving the
     filmstrip's measured start position and the laptop reveal below it. */
  transform: none;
}
.intro-headline {
  margin: 0;
  font-size: clamp(28px, 4.4vw, 56px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 20ch;
  text-wrap: balance;
}
.intro-support {
  margin: clamp(18px, 2.4vh, 28px) 0 0;
  font-size: clamp(15px, 1.5vw, 20px);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 52ch;
}
.intro-principle {
  margin: clamp(14px, 1.8vh, 20px) 0 0;
  font-size: clamp(14px, 1.15vw, 17px);
  line-height: 1.55;
  color: var(--ink-faint);
  max-width: 60ch;
}

/* The intro is visible by default. The two supporting lines fade only when JavaScript is healthy. */
.intro { will-change: opacity; }
.intro-support,
.intro-principle {
  opacity: 1;
  transform: none;
}
body.intro-ready .intro-support,
body.intro-ready .intro-principle {
  animation: introFade 0.7s ease-out both;
}
body.intro-ready .intro-support { animation-delay: 0.14s; }
body.intro-ready .intro-principle { animation-delay: 0.24s; }
@keyframes introFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Job 3: the floating project caption and colophon stay hidden until the filmstrip is actually engaged */
.filmstrip-caption { opacity: 0; }
body.strip-live:not(.detail-open) .filmstrip-caption { opacity: 1; }
.corner-meta { opacity: 0; }
body.strip-live:not(.detail-open) .corner-meta { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .intro-support,
  .intro-principle,
  body.intro-ready .intro-support,
  body.intro-ready .intro-principle { opacity: 1; transform: none; animation: none; }
  .intro { opacity: 1 !important; }
  .filmstrip-caption,
  .filmstrip-caption .cap-inner,
  .corner-meta { transition: none !important; }
}

.filmstrip {
  height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  margin-top: -117px;
}
@media (min-width: 1800px) {
  .filmstrip { margin-top: -72px; }
}

.track {
  display: flex;
  align-items: center;
  height: 100vh;
  gap: var(--gap);
  /* left/right centering padding is set by JS from the real first/last widths */
  will-change: transform;
}

.panel {
  flex: 0 0 auto;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-open {
  display: block;
  will-change: transform;
  outline: none;
}
.panel-open:focus-visible .device {
  outline: 2px solid var(--ink);
  outline-offset: 14px;
  border-radius: 6px;
}

/* ---------- devices (fixed widths so gaps between device edges stay equal) ---------- */

.device {
  position: relative;
  margin: 0 auto;
  transition: filter 0.4s var(--ease);
}
.device-laptop  { width: clamp(460px, 40vw, 600px); }
.device-phone   { width: clamp(200px, 16vw, 250px); }
.device-browser { width: clamp(470px, 41vw, 620px); }

/* shared screen media */
.shot {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.shot-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--screen);
  color: var(--ink-soft);
}
.shot-fallback span { font-size: 17px; font-weight: 500; color: var(--ink); }
.shot-fallback small { font-size: 12px; letter-spacing: 0.04em; text-transform: lowercase; }
.device.no-shot .shot { display: none; }
.device.no-shot .shot-fallback { display: flex; }

/* laptop */
.laptop-screen {
  position: relative;
  border: 10px solid var(--frame);
  border-radius: 14px;
  background: var(--frame);
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.screen-scroll {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.screen-scroll.detail-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.screen-scroll::-webkit-scrollbar { width: 8px; }
.screen-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 8px; }
.shot-tall { width: 100%; height: auto; display: block; }

.screen-embed {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.screen-embed.show { opacity: 1; pointer-events: auto; }
.screen-embed iframe { width: 100%; height: 100%; border: 0; display: block; }

.laptop-base {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 116%;
  height: 12px;
  background: linear-gradient(#e6e6e6, #c3c3c3 55%, #ababab);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 7px 12px -7px rgba(0,0,0,0.28);
}
.laptop-base::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 13%;
  height: 5px;
  background: #9d9d9d;
  border-radius: 0 0 7px 7px;
}

/* phone */
.phone-screen {
  position: relative;
  border: 9px solid var(--frame);
  border-radius: 24px;
  background: var(--frame);
  aspect-ratio: 9 / 19.5;
  overflow: hidden;
}
.phone-screen::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 15px;
  background: var(--frame);
  border-radius: 0 0 12px 12px;
}

/* browser window */
.browser-frame {
  border: 1px solid var(--hair);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 30px 70px -34px rgba(0,0,0,0.42), 0 2px 6px -2px rgba(0,0,0,0.08);
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(#fbfbfa, #f3f3f0);
  border-bottom: 1px solid var(--hair);
}
.browser-dots { display: flex; gap: 7px; }
.browser-dots i {
  width: 11px; height: 11px; border-radius: 50%;
  display: block;
}
.browser-dots i:nth-child(1) { background: #ff5f57; }
.browser-dots i:nth-child(2) { background: #febc2e; }
.browser-dots i:nth-child(3) { background: #28c840; }
.browser-url {
  flex: 1;
  max-width: 60%;
  margin: 0 auto;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 5px 14px;
  letter-spacing: 0.01em;
}
.browser-screen {
  position: relative;
  aspect-ratio: 16 / 10.6;
  background: var(--screen);
  overflow: hidden;
}

/* ---------- floating caption (horizontal mode) ---------- */

.filmstrip-caption {
  position: fixed;
  left: 0; right: 0;
  bottom: clamp(56px, 7vh, 108px);
  z-index: 35;
  padding: 0 var(--inset);
  text-align: center;
  pointer-events: none;
}
.filmstrip-caption .cap-inner {
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease);
}
.filmstrip-caption.is-swap .cap-inner {
  opacity: 0;
  transform: translateY(6px);
}
.cap-name {
  margin: 0 0 6px;
  font-size: clamp(20px, 2.3vw, 29px);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.cap-year {
  font-size: 0.58em;
  font-weight: 400;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  vertical-align: middle;
  margin-left: 7px;
}
.cap-read {
  margin: 0;
  font-size: clamp(12.5px, 1.05vw, 14px);
  color: var(--ink-soft);
  letter-spacing: 0.005em;
}

/* scroll hint */
.scroll-hint {
  position: fixed;
  right: var(--inset);
  bottom: clamp(26px, 4.5vw, 56px);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  transition: opacity 0.5s var(--ease);
}
.scroll-hint .line {
  width: 34px; height: 1px; background: var(--ink-faint);
  transform-origin: left;
  animation: hintline 2.4s var(--ease) infinite;
}
@keyframes hintline {
  0%, 100% { transform: scaleX(0.4); opacity: 0.5; }
  50%      { transform: scaleX(1);   opacity: 1; }
}
.scroll-hint.gone { opacity: 0; pointer-events: none; }

/* on-page meta: colophon, centered at the very bottom */
.corner-meta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: clamp(12px, 1.8vh, 24px);
  z-index: 35;
  text-align: center;
  padding: 0 var(--inset);
}
.night-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  margin-right: -7px;
  color: var(--ink-soft);
  border-radius: 50%;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.night-toggle:hover,
.night-toggle:focus-visible { color: var(--ink); background: rgba(0, 0, 0, 0.05); }
body.night .night-toggle:hover,
body.night .night-toggle:focus-visible { background: rgba(255, 255, 255, 0.08); }
.night-toggle .icon-sun { display: none; }
body.night .night-toggle .icon-moon { display: none; }
body.night .night-toggle .icon-sun { display: inline; }
.site-colophon {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-faint);
  letter-spacing: 0.015em;
  pointer-events: none;
}
body.static-mode .corner-meta { display: none; }

/* ---------- detail (zoom in place) ---------- */

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}
body.detail-open .detail-backdrop { opacity: 1; pointer-events: auto; }

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 4vw, 68px);
  padding: clamp(64px, 8vw, 120px) var(--inset);
  pointer-events: none;
}
body.detail-open .detail-overlay { pointer-events: auto; }

.detail-stage {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.detail-stage .device-laptop  { width: min(60vw, 760px); }
.detail-stage .device-phone   { width: min(24vh, 200px); }
.detail-stage .device-browser { width: min(60vw, 780px); }

/* E-ZPass dual frame: desktop laptop + mobile phone side by side */
.detail-stage { gap: clamp(16px, 2.4vw, 40px); }
.detail-stage .ezpass-lap { width: min(46vw, 560px); }
.detail-stage .detail-extra.device-phone { width: min(20vh, 172px); }
.detail-extra {
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.detail-extra.show { opacity: 1; }

/* mirror reflection beneath the zoomed device (Chrome and Safari) */
.detail-stage .device {
  -webkit-box-reflect: below 4px linear-gradient(transparent 55%, rgba(0, 0, 0, 0.22));
}
body.night .detail-stage .device {
  -webkit-box-reflect: below 4px linear-gradient(transparent 55%, rgba(0, 0, 0, 0.35));
}

.detail-info {
  flex: 0 1 360px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s 0.22s var(--ease), transform 0.5s 0.22s var(--ease);
}
body.detail-open .detail-info { opacity: 1; transform: none; }

/* clear the front-door furniture while a drilldown is open */
.filmstrip-caption,
.scroll-hint,
.corner-meta { transition: opacity 0.35s var(--ease); }
body.detail-open .filmstrip-caption,
body.detail-open .scroll-hint,
body.detail-open .corner-meta { opacity: 0; pointer-events: none; }

.detail-eyebrow {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin: 0 0 14px;
}
.detail-title {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  line-height: 1.05;
}
.detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 18px;
  margin: 0 0 20px;
  font-size: 13.5px;
}
.detail-meta dt { color: var(--ink-faint); }
.detail-meta dd { margin: 0; color: var(--ink); }
.detail-desc {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 26px;
}
.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
  transition: gap 0.3s var(--ease);
}
.detail-link:hover { gap: 15px; }

.detail-back {
  position: fixed;
  top: var(--inset-y);
  left: var(--inset);
  z-index: 57;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s 0.15s var(--ease), gap 0.3s var(--ease);
}
.detail-back:hover { gap: 14px; }
body.detail-open .detail-back { opacity: 1; pointer-events: auto; }

/* ---------- inline caption (static / mobile mode) ---------- */

.panel-caption { display: none; }

/* ---------- about card ---------- */

.about-card {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--inset);
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.about-card.open { opacity: 1; pointer-events: auto; }
.about-inner {
  max-width: 440px;
  transform: translateY(12px);
  transition: transform 0.45s var(--ease);
}
.about-card.open .about-inner { transform: none; }
.about-inner p {
  font-size: clamp(17px, 1.7vw, 20px);
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}
.about-inner .about-meta {
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.about-close {
  position: fixed;
  top: var(--inset-y);
  right: var(--inset);
  font-size: 14px;
  color: var(--ink);
}

/* =========================================================
   STATIC MODE  (reduced motion + mobile): clean vertical stack
   ========================================================= */

body.static-mode .filmstrip { height: auto; display: block; overflow: visible; margin-top: 0; }
body.static-mode .track {
  flex-direction: column;
  height: auto;
  gap: clamp(72px, 12vw, 130px);
  padding: clamp(270px, 53vw, 410px) var(--inset) clamp(90px, 16vw, 130px);
}

/* Verdigence brand panel */
.brand-panel {
  display: grid;
  place-items: center;
  background: #000d32;
}
.verdigence-logo {
  width: min(39%, 242px);
  height: auto;
  object-fit: contain;
}
body.static-mode .panel {
  width: 100%;
  flex: 0 0 auto;
  height: auto;
  flex-direction: column;
  gap: 26px;
}
body.static-mode .panel-open { width: 100%; cursor: default; }
body.static-mode .device { transform: none !important; filter: none !important; }
body.static-mode .device-laptop  { width: min(560px, 100%); }
body.static-mode .device-phone   { width: min(220px, 66%); }
body.static-mode .device-browser { width: min(600px, 100%); }

/* Mobile fix: the Orchid device keeps its screenshot inside an absolutely
   positioned .screen-scroll, so on the stacked mobile layout the laptop screen
   has no in-flow content and collapses to zero height, hiding the image.
   E-ZPass works because its <img> is a direct in-flow child. In static mode
   only, flatten .screen-scroll out of the box tree so the Orchid shot becomes
   an in-flow child of .laptop-screen (like E-ZPass) and fills the 16/10 window
   as a top-anchored cover crop. Desktop and the other devices are untouched. */
body.static-mode .device-laptop .screen-scroll { display: contents; }
body.static-mode .device-laptop .shot-tall {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

body.static-mode .scroll-hint { display: none; }
body.static-mode .filmstrip-caption,
body.static-mode .corner-meta { display: none !important; }

body.static-mode .panel-caption {
  display: block;
  text-align: left;
  max-width: 560px;
}
.panel-caption h2 {
  font-size: clamp(21px, 5vw, 27px);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.panel-caption p {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.panel-caption a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
}

/* colophon only shows in the stacked view, quietly */
.colophon {
  display: none;
  padding: 0 var(--inset) clamp(60px, 12vw, 90px);
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}
body.static-mode .colophon { display: block; }

@media (max-width: 860px) {
  .site-head { padding: 24px 22px 0; }
  .brand .name { font-size: 20px; }
  .brand .year { font-size: 14px; }
  .nav { font-size: 14px; }
  .detail-overlay { flex-direction: column; }

  /* Mobile only: make the header a solid, sticky top bar with the nav links in
     a single horizontal row, so the nav no longer floats as a vertical column
     over the project devices while scrolling. Scoped to body.static-mode (which
     is always on at this width). Desktop nav layout and styling are untouched. */
  body.static-mode .site-head {
    padding: 10px 16px;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    z-index: 45;
    pointer-events: auto;
  }
  body.static-mode .intro {
    padding-inline: 16px;
  }
  body.static-mode .brand .name { font-size: 17px; color: #111; }
  body.static-mode .brand .year { font-size: 12px; color: #111; }
  body.static-mode .nav {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 13px;
    font-size: 13px;
  }
}
