/* ==========================================================================
   NOA KELLER — PRODUCT DESIGNER PORTFOLIO
   Design system: variables → base → layout → components → sections → pages
   ========================================================================== */

/* -------------------------------------------------------------------------
   0. TOKENS
   ------------------------------------------------------------------------- */
:root{
  /* -- light theme (default) -- */
  --bg: #F5F5F2;
  --bg-soft: #ECECE6;
  --surface: #E9E9E3;
  --text: #111111;
  --text-secondary: #707070;
  --border: rgba(17,17,17,0.12);
  --border-strong: rgba(17,17,17,0.22);
  --accent: #E1481F;
  --accent-text: #F5F5F2;
  --cursor-mix: #111111;

  /* placeholder cover tones — deliberately theme-independent (art directed) */
  --tone-1: linear-gradient(158deg,#20232f 0%,#5c6b8a 55%,#c3cbe0 100%);
  --tone-2: linear-gradient(158deg,#2e1c16 0%,#8a4b3a 55%,#e6b895 100%);
  --tone-3: linear-gradient(158deg,#141f1c 0%,#3f6b5e 55%,#b7d9cb 100%);
  --tone-4: linear-gradient(158deg,#1e1830 0%,#6b4b8a 55%,#d4bce6 100%);
  --tone-5: linear-gradient(158deg,#2a2313 0%,#8a7a3f 55%,#e6d9ab 100%);
  --tone-6: linear-gradient(158deg,#141b26 0%,#3f5c7a 55%,#aecde6 100%);

  /* type */
  --font-display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;

  --fs-hero: clamp(2.6rem, 8.6vw, 8.4rem);
  --fs-display: clamp(2.1rem, 5.6vw, 4.6rem);
  --fs-h2: clamp(1.5rem, 2.8vw, 2.1rem);
  --fs-lead: clamp(1.15rem, 1.7vw, 1.5rem);
  --fs-body-lg: clamp(1.05rem, 1.3vw, 1.2rem);
  --fs-body: 1rem;
  --fs-meta: 0.72rem;
  --fs-num: clamp(3.6rem, 11vw, 10rem);

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --max: 1680px;
  --section-pad: clamp(4.5rem, 10vw, 9rem);
  --project-gap: clamp(6rem, 15vw, 13rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.32s;
  --dur: 0.6s;
  --dur-slow: 1.1s;

  --z-nav: 500;
  --z-cursor: 900;
  --z-preloader: 1000;
  --z-toast: 800;

  color-scheme: light;
}

html[data-theme="dark"]{
  --bg: #0D0D0F;
  --bg-soft: #16161A;
  --surface: #19191D;
  --text: #F4F4F4;
  --text-secondary: #9A9A9A;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --accent: #FF6A3D;
  --accent-text: #0D0D0F;
  --cursor-mix: #F4F4F4;
  color-scheme: dark;
}

/* -------------------------------------------------------------------------
   1. RESET / BASE
   ------------------------------------------------------------------------- */
*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd{ margin: 0; }
ul[class], ol[class]{ margin: 0; padding: 0; list-style: none; }
img, picture, svg{ display: block; max-width: 100%; }
a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea{ font: inherit; color: inherit; }

html{
  scroll-behavior: auto; /* Lenis owns real smoothing when available */
}
body{
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  overflow-x: hidden;
}
body.no-scroll{ overflow: hidden; }

::selection{ background: var(--accent); color: var(--accent-text); }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* fine grain film-like texture over the whole page, very subtle */
.grain{
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container{
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.bleed{
  width: 100vw;
  margin-inline: calc(50% - 50vw);
}

/* -------------------------------------------------------------------------
   2. TYPOGRAPHY UTILITIES
   ------------------------------------------------------------------------- */
.eyebrow{
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--font-body);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.eyebrow .dot{
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: none;
}
.display{
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.02;
}
.lead{
  font-size: var(--fs-lead);
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 38ch;
}
.text-secondary{ color: var(--text-secondary); }
.mono-num{
  font-family: var(--font-display);
  font-feature-settings: "tnum";
}

/* -------------------------------------------------------------------------
   3. GRAIN / NOISE ph (placeholder image) COMPONENT
   ------------------------------------------------------------------------- */
.ph{
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background-color: var(--surface);
  isolation: isolate;
}
.ph::after{
  content: "";
  position: absolute; inset: 0;
  opacity: 0.15; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ph__surface{
  position: absolute; inset: 0;
  background-size: 140% 140%;
  background-position: 50% 50%;
  transform: scale(1.06);
  transition: transform 1.4s var(--ease);
}
.ph--tone-1 .ph__surface{ background-image: var(--tone-1); }
.ph--tone-2 .ph__surface{ background-image: var(--tone-2); }
.ph--tone-3 .ph__surface{ background-image: var(--tone-3); }
.ph--tone-4 .ph__surface{ background-image: var(--tone-4); }
.ph--tone-5 .ph__surface{ background-image: var(--tone-5); }
.ph--tone-6 .ph__surface{ background-image: var(--tone-6); }

.ph--landscape{ aspect-ratio: 16 / 9.5; }
.ph--wide{ aspect-ratio: 21 / 8; }
.ph--portrait{ aspect-ratio: 4 / 5.2; }
.ph--square{ aspect-ratio: 1 / 1; }
.ph--mobile{ aspect-ratio: 9 / 17; max-width: 320px; }

/* These containers already give their .ph an explicit height, so
   aspect-ratio has no layout purpose on them — and Chromium's mobile
   viewport calculation misfires when aspect-ratio is combined with an
   already-explicit height (worst with a viewport-relative width too, as on
   the full-bleed jarallax cover). Drop it wherever height is already set. */
.project__cover .ph,
.cs-hero__cover .ph,
.cs-next .ph{ aspect-ratio: auto; }

.ph__mark{
  position: absolute;
  right: 0.7em; bottom: 0.4em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.5rem, 9vw, 6rem);
  color: rgba(255,255,255,0.16);
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}
.ph__label{
  position: absolute;
  left: 1.1rem; bottom: 1rem;
  z-index: 2;
  color: rgba(255,255,255,0.85);
  font-size: var(--fs-meta);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  display: flex; align-items: center; gap: 0.5em;
}
.ph__label::before{
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
/* hover breathing for gallery items inside a hovering link */
a:hover .ph .ph__surface,
.project__cover:hover .ph__surface{
  transform: scale(1.0);
}

/* Jarallax targets carry their gradient as a real CSS background (required
   for the plugin to find and animate it) instead of the .ph__surface child —
   this also means a plain CSS background still renders if the script fails
   to load, so the cover never goes blank. */
.ph.jarallax{
  background-size: cover;
  background-position: 50% 50%;
}
.ph.jarallax .ph__surface{ display: none; }

/* -------------------------------------------------------------------------
   4. PRELOADER
   ------------------------------------------------------------------------- */
#preloader{
  position: fixed; inset: 0; z-index: var(--z-preloader);
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.25rem;
  transition: opacity 0.7s var(--ease), visibility 0.7s var(--ease);
  /* safety net: self-dismiss even if the CDN scripts never load */
  animation: preloaderFallback 0.01s 6s forwards;
}
@keyframes preloaderFallback{ to{ opacity: 0; visibility: hidden; pointer-events: none; } }
#preloader.is-hidden{ opacity: 0; visibility: hidden; pointer-events: none; }
.preloader__mark{
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.preloader__bar{
  width: min(220px, 60vw); height: 1px; background: var(--border);
  position: relative; overflow: hidden;
}
.preloader__bar-fill{
  position: absolute; inset: 0; width: 0%;
  background: var(--text);
  transition: width 0.25s var(--ease);
}
.preloader__count{
  font-family: var(--font-display);
  font-size: var(--fs-meta);
  color: var(--text-secondary);
  letter-spacing: 0.1em;
}

/* -------------------------------------------------------------------------
   5. CUSTOM CURSOR (desktop only)
   ------------------------------------------------------------------------- */
#cursor{
  position: fixed; top: 0; left: 0; z-index: var(--z-cursor);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--cursor-mix);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--ease), width 0.35s var(--ease), height 0.35s var(--ease),
              background-color 0.35s var(--ease);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  will-change: transform;
}
body.has-cursor #cursor.is-visible{ opacity: 1; }
#cursor .cursor__label{
  opacity: 0; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
  color: var(--bg); text-transform: uppercase; line-height: 1.15;
  transition: opacity 0.2s var(--ease);
  font-family: var(--font-body);
}
#cursor .cursor__label span{ display: block; }
#cursor.is-active{
  width: 84px; height: 84px;
  background: var(--accent);
}
#cursor.is-active .cursor__label{ opacity: 1; }
body.has-cursor, body.has-cursor a, body.has-cursor button{ cursor: none; }

/* -------------------------------------------------------------------------
   6. NAVIGATION
   ------------------------------------------------------------------------- */
.nav{
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-nav);
  padding: 1.6rem var(--gutter);
  transition: padding var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-compact{
  padding: 0.9rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav__inner{
  max-width: var(--max); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
}
.nav__logo{
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  letter-spacing: -0.01em;
  display: flex; flex-direction: column; line-height: 1.1;
}
.nav__logo span{ font-size: 0.62rem; font-weight: 500; letter-spacing: 0.1em; color: var(--text-secondary); text-transform: uppercase; }
.nav__links{ display: flex; align-items: center; gap: 2.4rem; }
.nav__link{
  position: relative;
  font-size: 0.82rem; font-weight: 500; letter-spacing: 0.02em;
  padding-block: 0.3rem;
}
.nav__link::after{
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: var(--text);
  transition: right var(--dur-fast) var(--ease);
}
.nav__link:hover::after, .nav__link.is-active::after{ right: 0; }
.nav__actions{ display: flex; align-items: center; gap: 1.1rem; }

.theme-toggle{
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  position: relative;
}
.theme-toggle:hover{ border-color: var(--border-strong); transform: rotate(20deg); }
.theme-toggle svg{ width: 16px; height: 16px; }
.theme-toggle .icon-sun{ display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon{ display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun{ display: block; }

.nav__menu-btn{
  display: none; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border);
  align-items: center; justify-content: center;
}

.nav-mobile{
  position: fixed; inset: 0; z-index: calc(var(--z-nav) - 10);
  background: var(--bg);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 1.4rem; padding: 2rem var(--gutter);
  transform: translateY(-100%);
  transition: transform 0.6s var(--ease);
}
.nav-mobile.is-open{ transform: translateY(0); }
.nav-mobile__link{
  font-family: var(--font-display); font-size: clamp(2rem, 8vw, 2.6rem); font-weight: 600;
  position: relative;
}
.nav-mobile__link.is-active{ color: var(--text-secondary); }
.nav-mobile__theme{
  margin-top: 1rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  border: 1px solid var(--border); padding: 0.7rem 1.2rem; border-radius: 100px;
}

/* -------------------------------------------------------------------------
   7. HERO / INTRO
   ------------------------------------------------------------------------- */
.hero{
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(7rem, 14vh, 10rem) var(--gutter) clamp(3rem, 6vh, 5rem);
  overflow: hidden;
}
.hero__bg{
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.hero__bg-grid{
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(90deg, var(--border) 0 1px, transparent 1px 8.333%);
  opacity: 0.5;
}
.hero__bg-index{
  position: absolute; top: 6%; right: 2%;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(6rem, 22vw, 20rem);
  color: var(--text);
  opacity: 0.045;
  line-height: 0.8;
  user-select: none;
}
.hero__inner{ position: relative; z-index: 1; max-width: var(--max); margin-inline: auto; width: 100%; }
.hero__meta{
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.6rem;
  margin-bottom: clamp(1.8rem, 5vh, 3rem);
}
.hero__status{
  display: inline-flex; align-items: center; gap: 0.55em;
  font-size: var(--fs-meta); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600;
}
.hero__status-dot{
  width: 7px; height: 7px; border-radius: 50%; background: #4CAF6D; flex: none;
  box-shadow: 0 0 0 0 rgba(76,175,109,0.5);
  animation: pulse 2.2s var(--ease) infinite;
}
@keyframes pulse{
  0%{ box-shadow: 0 0 0 0 rgba(76,175,109,0.45); }
  70%{ box-shadow: 0 0 0 8px rgba(76,175,109,0); }
  100%{ box-shadow: 0 0 0 0 rgba(76,175,109,0); }
}

.hero__headline{
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 0.98;
}
.hero__line{ overflow: hidden; display: block; }
.hero__line-inner{
  display: block;
  transform: translateY(110%);
  transition: transform 1.1s var(--ease);
  transition-delay: 0.15s;
  /* safety net: reveal the headline even if body never gets .is-loaded */
  animation: revealFallback 0.01s 3s forwards;
}
.hero__line:nth-child(2) .hero__line-inner{ transition-delay: 0.3s; color: var(--text-secondary); }
.is-loaded .hero__line-inner{ transform: translateY(0); }

.hero__foot{
  margin-top: clamp(2.5rem, 7vh, 4.5rem);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem;
  flex-wrap: wrap;
}
.hero__bio{ max-width: 34ch; }
.hero__location{
  text-align: right;
  font-size: var(--fs-meta); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-secondary); line-height: 1.6;
}

.hero__scroll{
  position: absolute; bottom: clamp(1.5rem,4vh,2.5rem); left: var(--gutter);
  display: flex; align-items: center; gap: 0.7rem;
  z-index: 1;
}
.hero__scroll-line{
  width: 1px; height: 46px; background: var(--border-strong);
  position: relative; overflow: hidden;
}
.hero__scroll-line::after{
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 40%;
  background: var(--text);
  animation: scrollDown 2s var(--ease) infinite;
}
@keyframes scrollDown{
  0%{ transform: translateY(-100%); }
  60%{ transform: translateY(150%); }
  100%{ transform: translateY(150%); }
}
.hero__scroll-label{
  font-size: var(--fs-meta); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary);
  writing-mode: vertical-rl;
}

/* -------------------------------------------------------------------------
   8. SECTION HEAD (shared)
   ------------------------------------------------------------------------- */
.section-head{
  display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
  flex-wrap: wrap;
  padding-top: var(--section-pad);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid var(--border);
}
.section-head__left{ display: flex; align-items: baseline; gap: 1.4rem; }
.section-head__num{
  font-family: var(--font-display); font-size: 1rem; color: var(--text-secondary);
}
.section-head__title{
  font-size: var(--fs-display);
}
.section-head__intro{ max-width: 30ch; text-align: right; }

/* -------------------------------------------------------------------------
   9. FILTER
   ------------------------------------------------------------------------- */
.filter{
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--border);
}
.filter__list{
  display: flex; flex-wrap: wrap; gap: clamp(1.2rem, 3vw, 2.2rem);
}
.filter__item{
  font-size: 0.85rem; font-weight: 500; letter-spacing: 0.02em;
  color: var(--text-secondary);
  position: relative; padding-bottom: 0.4rem;
  transition: color var(--dur-fast) var(--ease);
}
.filter__item::after{
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: var(--accent); transition: right var(--dur-fast) var(--ease);
}
.filter__item:hover{ color: var(--text); }
.filter__item.is-active{ color: var(--text); }
.filter__item.is-active::after{ right: 0; }

/* -------------------------------------------------------------------------
   10. PROJECT STORY MODULE
   ------------------------------------------------------------------------- */
.project{
  padding-top: var(--project-gap);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), max-height 0.6s var(--ease);
}
.project.is-hiding{
  opacity: 0; transform: translateY(12px) scale(0.98);
  max-height: 0 !important; pointer-events: none;
}
.project.is-animating{ overflow: hidden; }
.project__row{
  display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}
.project__title-group{ display: flex; align-items: flex-start; gap: clamp(1rem, 3vw, 2rem); }
.project__index{
  font-family: var(--font-display); font-size: 1.1rem; color: var(--text-secondary);
  padding-top: 0.4em;
}
.project__title{
  font-size: var(--fs-display);
  transition: color var(--dur-fast) var(--ease);
}
.project__link{
  display: inline-flex; align-items: center; gap: 0.6em;
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em;
  padding-bottom: 0.3rem; border-bottom: 1px solid var(--border-strong);
  transition: border-color var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.project__link-arrow{ transition: transform var(--dur-fast) var(--ease); }
.project__link:hover{ border-color: var(--text); }
.project__link:hover .project__link-arrow{ transform: translateX(5px); }

.project__meta{
  display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-end;
  text-align: right;
}
.project__meta-cat{ font-size: 0.85rem; color: var(--text-secondary); }
.project__meta-year{ font-family: var(--font-display); font-size: 1rem; }

.project__desc{ max-width: 46ch; margin-bottom: clamp(2.2rem, 6vw, 3.5rem); }
.project__desc + .project__link{ margin-top: -1.6rem; margin-bottom: clamp(2.2rem, 6vw, 3.5rem); display: block; width: fit-content; }

.project__cover{ margin-bottom: clamp(2.5rem, 6vw, 4rem); display: block; }
.project__cover .ph{ height: clamp(50vh, 80vh, 88vh); }
.project__cover--offset-r{ margin-left: clamp(0px, 10vw, 8rem); }
.project__cover--offset-l{ margin-right: clamp(0px, 10vw, 8rem); }

.project__gallery{
  display: flex; flex-wrap: wrap; gap: clamp(0.9rem, 2vw, 1.6rem);
  align-items: flex-end;
}
.project__gallery > .ph{ flex: 1 1 260px; }
.project__gallery > .ph.g-grow{ flex: 2.2 1 420px; }
.project__gallery > .ph.g-shrink{ flex: 1 1 200px; max-width: 340px; }
.project__gallery > .ph.g-up{ transform: translateY(-6%); }
.project__gallery > .ph.g-down{ transform: translateY(6%); }

.project--reverse .project__row{ flex-direction: row-reverse; }
.project--reverse .project__meta{ align-items: flex-start; text-align: left; order: -1; }

.project__divider{
  margin-top: var(--project-gap);
  border-top: 1px solid var(--border);
}

/* -------------------------------------------------------------------------
   11. SCROLL REVEAL UTILITIES
   ------------------------------------------------------------------------- */
.reveal{
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  will-change: transform, opacity;
}
.reveal.is-visible{ opacity: 1; transform: translateY(0); }

.reveal-mask{ overflow: hidden; }
.reveal-mask__inner{
  display: block; transform: translateY(105%);
  transition: transform 0.9s var(--ease);
}
.reveal-mask.is-visible .reveal-mask__inner{ transform: translateY(0); }

.reveal-scale .ph__surface{ transform: scale(1.14); }
.reveal-scale.is-visible .ph__surface{ transform: scale(1.0); }

.reveal-stagger > *{
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal-stagger.is-visible > *{ opacity: 1; transform: translateY(0); }
.reveal-stagger.is-visible > *:nth-child(1){ transition-delay: 0.02s; }
.reveal-stagger.is-visible > *:nth-child(2){ transition-delay: 0.1s; }
.reveal-stagger.is-visible > *:nth-child(3){ transition-delay: 0.18s; }
.reveal-stagger.is-visible > *:nth-child(4){ transition-delay: 0.26s; }
.reveal-stagger.is-visible > *:nth-child(5){ transition-delay: 0.34s; }
.reveal-stagger.is-visible > *:nth-child(6){ transition-delay: 0.42s; }

/* Safety net: everything above is revealed by an IntersectionObserver in
   main.js. If the CDN scripts never load, force the end-state after a
   long delay so the page is never permanently invisible. The delay is
   deliberately long (most visitors scroll well within it) so this only
   ever fires as a last resort, not as a race against real scroll-reveal. */
@keyframes revealFallback{ to{ opacity: 1; transform: none; } }
.reveal,
.reveal-mask__inner,
.reveal-stagger > *{ animation: revealFallback 0.01s 25s forwards; }
.reveal-scale .ph__surface{ animation: scaleFallback 0.01s 25s forwards; }
@keyframes scaleFallback{ to{ transform: scale(1); } }

/* -------------------------------------------------------------------------
   12. CONTACT
   ------------------------------------------------------------------------- */
.contact{
  padding-block: var(--section-pad);
  border-top: 1px solid var(--border);
}
.contact__head{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(3.4rem, 13vw, 11rem);
  line-height: 0.94;
  letter-spacing: -0.02em;
  margin-bottom: clamp(2.5rem, 7vw, 5rem);
}
.contact__head .contact__line{
  display: block;
  background-image: var(--tone-2);
  background-size: 100% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.contact__head .contact__line:nth-child(2){ background-image: var(--tone-4); margin-left: clamp(0.5rem, 4vw, 3rem); }
.contact__head .contact__line:nth-child(3){ background-image: var(--tone-6); margin-left: clamp(1rem, 8vw, 6rem); }

.contact__row{
  display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; flex-wrap: wrap;
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--border);
}
.contact__email-wrap{ position: relative; }
.contact__email-label{ margin-bottom: 0.6rem; }
.contact__email{
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  display: inline-flex; align-items: center; gap: 0.7rem;
  position: relative;
}
.contact__email::after{
  content: ""; position: absolute; left: 0; right: 100%; bottom: -0.1em; height: 2px;
  background: var(--accent); transition: right var(--dur) var(--ease);
}
.contact__email:hover::after{ right: 0; }
.contact__email-icon{ transition: transform var(--dur-fast) var(--ease); }
.contact__email:hover .contact__email-icon{ transform: rotate(45deg) translate(2px,-2px); }

.contact__aside{ display: flex; gap: clamp(2.5rem, 6vw, 5rem); flex-wrap: wrap; }
.contact__col{ display: flex; flex-direction: column; gap: 0.6rem; }
.contact__col-label{ margin-bottom: 0.2rem; }
.contact__social-link{
  font-size: 0.9rem; position: relative; width: fit-content;
}
.contact__social-link::after{
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1px;
  background: var(--text); transition: right var(--dur-fast) var(--ease);
}
.contact__social-link:hover::after{ right: 0; }

#toast{
  position: fixed; left: 50%; bottom: 2.4rem; z-index: var(--z-toast);
  transform: translate(-50%, 16px);
  background: var(--text); color: var(--bg);
  padding: 0.75rem 1.3rem; border-radius: 100px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
#toast.is-visible{ opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------------------------------
   13. FOOTER
   ------------------------------------------------------------------------- */
.site-footer{ padding-block: clamp(2.2rem, 5vw, 3.5rem); border-top: 1px solid var(--border); }
.site-footer__inner{
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.site-footer__col{ display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.site-footer__tagline{ font-style: italic; color: var(--text-secondary); font-size: 0.85rem; }
.site-footer__socials{ display: flex; gap: 1.4rem; }
.site-footer__socials a{ font-size: 0.82rem; position: relative; }
.site-footer__socials a::after{
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1px;
  background: var(--text); transition: right var(--dur-fast) var(--ease);
}
.site-footer__socials a:hover::after{ right: 0; }

/* -------------------------------------------------------------------------
   14. CASE STUDY PAGE
   ------------------------------------------------------------------------- */
.cs-hero{ padding: clamp(2.5rem, 5vh, 3.5rem) var(--gutter) 0; }
.cs-hero__top{
  max-width: var(--max); margin-inline: auto;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; flex-wrap: wrap;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.cs-hero__index{ font-family: var(--font-display); font-size: 1rem; color: var(--text-secondary); }
.cs-hero__title{
  font-size: clamp(2.6rem, 7vw, 6rem);
  max-width: 20ch;
}
.cs-hero__meta{
  display: flex; flex-direction: column; gap: 0.5rem; text-align: right; align-items: flex-end;
}
.cs-hero__meta-row{ font-size: 0.85rem; color: var(--text-secondary); }
.cs-hero__meta-row b{ color: var(--text); font-weight: 600; }
.cs-hero__cover{ max-width: var(--max); margin-inline: auto; }
.cs-hero__cover .ph{ height: clamp(55vh, 88vh, 92vh); }

.cs-section{
  max-width: var(--max); margin-inline: auto;
  padding: var(--section-pad) var(--gutter) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--section-pad);
}
.cs-section__head{ display: flex; align-items: baseline; gap: 1.2rem; margin-bottom: clamp(2.4rem, 6vw, 4rem); }
.cs-section__num{ font-family: var(--font-display); color: var(--text-secondary); }
.cs-section__title{ font-size: var(--fs-display); }

.cs-overview{ display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 4vw, 3rem); }
.cs-overview__item{ padding-top: 1.4rem; border-top: 1px solid var(--border); }
.cs-overview__label{ display: block; margin-bottom: 0.9rem; }
.cs-overview__text{ font-size: var(--fs-body-lg); }

.cs-process{ display: flex; flex-direction: column; }
.cs-process__item{
  display: grid; grid-template-columns: 90px 1fr;
  gap: 1.5rem; padding-block: clamp(1.8rem, 4vw, 2.6rem);
  border-top: 1px solid var(--border);
}
.cs-process__item:last-child{ border-bottom: 1px solid var(--border); }
.cs-process__num{ font-family: var(--font-display); font-size: 1.6rem; color: var(--text-secondary); }
.cs-process__title{ font-size: 1.3rem; margin-bottom: 0.7rem; }
.cs-process__text{ max-width: 60ch; color: var(--text-secondary); font-size: var(--fs-body-lg); }

.cs-final__gallery{ display: flex; flex-wrap: wrap; gap: clamp(1rem, 2.4vw, 1.8rem); }
.cs-final__gallery > .ph{ flex: 1 1 300px; }
.cs-final__gallery > .ph.g-grow{ flex: 2.4 1 460px; }

.cs-outcome{ display: flex; flex-direction: column; gap: clamp(2rem, 5vw, 3rem); padding-bottom: var(--section-pad); }
.cs-outcome__item{ display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; }
.cs-outcome__label{ padding-top: 0.3rem; }
.cs-outcome__text{ font-size: var(--fs-lead); color: var(--text); max-width: 62ch; }

.cs-next{ display: block; position: relative; margin-top: var(--project-gap); }
.cs-next .ph{ height: clamp(55vh, 75vh, 85vh); }
.cs-next__overlay{
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 0.8rem; color: #fff;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.35));
}
.cs-next__label{ letter-spacing: 0.14em; }
.cs-next__title{ font-family: var(--font-display); font-size: clamp(2.2rem, 7vw, 5rem); }
.back-link{
  max-width: var(--max); margin-inline: auto; padding: clamp(7rem, 14vh, 9rem) var(--gutter) 0;
  display: flex; align-items: center; gap: 0.6em; width: fit-content;
  font-size: 0.85rem; font-weight: 500;
}
.back-link:hover{ color: var(--text-secondary); }

/* -------------------------------------------------------------------------
   15. RESPONSIVE
   ------------------------------------------------------------------------- */
@media (max-width: 1024px){
  .nav__links{ display: none; }
  .nav__menu-btn{ display: flex; }
  .cs-overview{ grid-template-columns: 1fr; gap: 2rem; }
  .cs-process__item{ grid-template-columns: 60px 1fr; }
  .cs-outcome__item{ grid-template-columns: 1fr; gap: 0.6rem; }
  .project__cover--offset-r, .project__cover--offset-l{ margin-inline: 0; }
}

@media (max-width: 767px){
  .hero{ min-height: 92vh; padding-top: 6.5rem; }
  .hero__foot{ flex-direction: column; align-items: flex-start; gap: 1.2rem; }
  .hero__location{ text-align: left; }
  .hero__scroll{ display: none; }

  .section-head{ flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .section-head__intro{ text-align: left; }

  .project__row{ flex-direction: column !important; gap: 1rem; }
  .project__meta{ align-items: flex-start !important; text-align: left !important; order: 0 !important; }
  .project__cover .ph{ height: 62vh; }
  .project__gallery{ flex-direction: column; }
  .project__gallery > .ph, .project__gallery > .ph.g-grow, .project__gallery > .ph.g-shrink{
    flex-basis: auto; max-width: 100%; transform: none !important;
  }
  .ph--mobile{ max-width: 210px; margin-inline: auto; }

  .contact__row{ flex-direction: column; align-items: flex-start; gap: 2rem; }
  .contact__aside{ gap: 2rem; }

  .site-footer__inner{ flex-direction: column; align-items: flex-start; gap: 1rem; }

  .cs-hero__top{ flex-direction: column; gap: 1.2rem; }
  .cs-hero__meta{ align-items: flex-start; text-align: left; }
  .cs-final__gallery{ flex-direction: column; }
  .cs-final__gallery > .ph.g-grow{ flex-basis: auto; }
}

/* -------------------------------------------------------------------------
   16. MOTION SAFETY
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
    scroll-behavior: auto !important;
  }
  .hero__line-inner{ transform: none !important; }
  .reveal, .reveal-mask__inner, .reveal-stagger > *{ opacity: 1 !important; transform: none !important; }
}
