*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --white: #fafafa;
  --cream: #f7f5f0;
  --ink: #111;
  --ink-soft: #555;
  --accent: #e85d2a;
  --accent-glow: #ff6b35;
  --dark: #0a0a0a;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Syne", system-ui, sans-serif;
  --display-serif-size: clamp(2.5rem, 9vw, 7rem);
  --display-serif-size-mobile: clamp(2rem, 11vw, 3.75rem);
  --motto-serif-size: clamp(3rem, 11.5vw, 8.75rem);
  --motto-serif-size-mobile: clamp(2.35rem, 12.5vw, 4.5rem);
  --section-title-size: clamp(2.35rem, 4.2vw, 3.25rem);
  --section-title-size-mobile: clamp(1.95rem, 8vw, 2.85rem);
  --safe-top: env(safe-area-inset-top, constant(safe-area-inset-top, 0px));
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-top-effective: var(--safe-top);
  --viewport-h: 100dvh;
}

@media (hover: none) and (pointer: coarse) {
  :root {
    --safe-top-effective: max(var(--safe-top), 47px);
  }
}

html {
  font-size: clamp(15px, 1.05vw, 18px);
  background-color: var(--cream);
}

html[data-chrome="photo"] {
  background:
    url("assets/about-bg.png") center top / cover no-repeat,
    var(--cream);
}

@media (hover: none) and (pointer: coarse) {
  html,
  body {
    background-color: var(--cream);
  }
}

html.lenis,
html.lenis body {
  height: auto;
}

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
  min-height: var(--viewport-h);
  min-height: -webkit-fill-available;
}

body.home-page {
  background: var(--cream);
}

/* Loader — Instrument Serif */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("assets/hero-bg.png") center / cover no-repeat;
  color: var(--white);
  font-family: var(--serif);
  font-size: clamp(4rem, 18vw, 12rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
  pointer-events: none;
}

.loader__label {
  font-size: 0.4em;
  margin-left: 0.02em;
}

.loader::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.loader__pct,
.loader__label {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.loader.is-font-ready .loader__pct {
  opacity: 1;
}

.loader.is-font-ready .loader__label {
  opacity: 0.35;
}

/* Intro — dashboard hero photo + curved light reveal */
.intro {
  position: relative;
  background: transparent;
}

.intro__pin {
  position: relative;
  height: var(--viewport-h);
  min-height: -webkit-fill-available;
  overflow: hidden;
}

.intro__black,
.intro__dark,
.intro__reveal,
.intro__fill {
  position: absolute;
  inset: 0;
}

.intro__black {
  position: absolute;
  z-index: 0;
  background: url("assets/hero-bg.png") center top / cover no-repeat;
}

.intro__black::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.intro__dark {
  position: absolute;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
  pointer-events: none;
}

.hero__inner {
  text-align: center;
  padding: 2rem;
  will-change: transform;
}

.hero__welcome {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-style: italic;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.25rem;
}

.hero__title {
  font-family: var(--serif);
  font-size: clamp(4.5rem, 16vw, 11rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--white);
}

.hero__welcome .word,
.hero__title .word {
  overflow: hidden;
  display: inline-block;
  vertical-align: top;
}

.hero__welcome .word-inner,
.hero__title .word-inner {
  display: inline-block;
  will-change: transform;
  color: #fafafa;
}

.hero__welcome .word-inner {
  color: rgba(255, 255, 255, 0.65);
}

.hero__hint {
  position: absolute;
  bottom: 12vh;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  opacity: 0;
}

.intro__reveal {
  position: absolute;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

/* Wide ellipse — flat arc; copy lives inside so it never sits on black */
.intro__blob {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 3;
  width: 400vmax;
  height: 65vmax;
  margin-left: -200vmax;
  background: var(--cream);
  border-radius: 50%;
  transform: translateY(82%);
  transform-origin: 50% 100%;
  will-change: transform;
  pointer-events: none;
}

.intro__copy,
.intro__headline {
  display: none;
}

/* Solid white sheet — covers arc + text in one move, no grey fade */
.intro__fill {
  position: absolute;
  z-index: 7;
  background: var(--cream);
  will-change: transform;
  pointer-events: none;
}

@media (min-width: 769px) {
  .intro__fill::before {
    content: "";
    position: absolute;
    top: -14vh;
    left: 0;
    right: 0;
    height: 14vh;
    background: linear-gradient(to bottom, transparent, var(--cream));
    pointer-events: none;
  }
}

.intro__health {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(94vw, 52rem);
  padding: 0 clamp(1rem, 3vw, 2rem);
  text-align: center;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  will-change: transform, opacity;
}

.intro__health-text {
  font-family: var(--serif);
  font-size: clamp(3rem, 8.5vw, 6.25rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--ink);
  max-width: 11em;
  margin: 0 auto;
}

.intro__health-text .word {
  display: inline-block;
  overflow: visible;
  vertical-align: top;
}

.intro__health-text .word-inner {
  display: inline-block;
  color: #c4c4c4;
  opacity: 0;
  will-change: opacity;
}

.intro__relief {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(94vw, 52rem);
  padding: 0 clamp(1rem, 3vw, 2rem);
  text-align: center;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  overflow: visible;
  will-change: transform, opacity;
}

.intro__relief-text {
  font-family: var(--serif);
  font-size: clamp(3rem, 8.5vw, 6.25rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.04em;
  color: var(--ink);
  max-width: none;
  margin: 0 auto;
  font-style: italic;
  padding: 0.12em 0.15em;
  overflow: visible;
}

.intro__relief-text .word {
  display: inline-block;
  overflow: visible;
  vertical-align: top;
  padding-right: 0.2em;
  margin-right: -0.1em;
}

.intro__relief-text .word-inner {
  display: inline-block;
  overflow: visible;
  color: var(--ink);
  opacity: 0;
  will-change: opacity;
  padding-right: 0.06em;
}

.intro__motto {
  position: absolute;
  left: 50%;
  /* Sit in the lower white band while fill is only ~75–80% tall */
  top: 58%;
  z-index: 9;
  width: 100%;
  max-width: none;
  padding: 0 clamp(0.5rem, 2vw, 1.5rem);
  text-align: center;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  will-change: transform, opacity;
}

.intro__motto.is-centered {
  top: 50%;
}

.intro__motto-lead,
.intro__motto-em {
  font-family: var(--serif);
  font-size: var(--motto-serif-size);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.intro__motto-em {
  margin-top: 0.06em;
  font-style: italic;
  will-change: transform, opacity;
}

.intro__motto .word {
  display: inline-block;
  vertical-align: top;
}

.intro__motto .word-inner {
  display: inline-block;
  color: #c4c4c4;
}

.intro__motto-em .word-inner {
  font-style: italic;
}

/* Domain cards — sequential deck over motto */
.intro__cards {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.intro__card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(240px, 42vw, 480px);
  opacity: 0;
  visibility: hidden;
  transform-origin: center center;
  will-change: transform, opacity;
  filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.14));
}

.intro__card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
}

.intro__card-progress {
  position: absolute;
  left: clamp(1rem, 3vw, 2.75rem);
  top: 50%;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro__card-progress-num {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 10px rgba(17, 17, 17, 0.28);
}

.intro__card-progress-rail {
  position: relative;
  width: 1px;
  height: clamp(3.5rem, 9vh, 5.5rem);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.intro__card-progress-dot {
  position: absolute;
  left: 50%;
  top: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.7),
    0 1px 4px rgba(17, 17, 17, 0.18);
  transform: translate(-50%, -50%);
}

@media (max-width: 768px) {
  .intro__pin,
  .intro__fill,
  .intro__black,
  .intro__dark,
  .intro__health,
  .intro__relief,
  .intro__motto {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  .intro__health-text {
    font-size: clamp(2.35rem, 9.5vw, 3.75rem);
    max-width: 10em;
  }

  .intro__relief-text {
    font-size: clamp(2.35rem, 9.5vw, 3.75rem);
    max-width: none;
  }

  .intro__motto-lead,
  .intro__motto-em {
    font-size: var(--motto-serif-size-mobile);
    letter-spacing: -0.03em;
    white-space: normal;
  }

  .intro__card {
    width: clamp(240px, 78vw, 100%);
  }

  .intro__card-progress {
    left: 0.85rem;
  }
}

/* Word split */
[data-split] .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

[data-split] .word-inner {
  display: inline-block;
  will-change: transform;
}

/* Opacity reveals — don't clip italic serifs (global [data-split] hides overflow for hero slide-up) */
.intro__health-text[data-split] .word,
.intro__health-text [data-split] .word,
.intro__relief-text[data-split] .word {
  overflow: visible;
}

.intro__health-text .word {
  padding: 0 0.04em;
}

.intro__relief-text .word {
  padding-right: 0.2em;
  margin-right: -0.1em;
}

.intro__relief-text .word:last-child {
  padding-right: 0.28em;
  margin-right: 0;
}

/* Motto color-wipe only (no slide reveal) — keep overflow visible so italic glyphs aren't clipped */
.intro__motto .word {
  overflow: visible;
}

.intro__motto-em .word {
  padding-right: 0.1em;
}

.intro__motto-em .word:last-child {
  padding-right: 0.14em;
}

/* Story — pinned crossfade */
.story {
  background: var(--white);
}

.story__pin {
  position: relative;
  min-height: var(--viewport-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
}

.story__slides {
  position: relative;
  width: min(640px, 100%);
  min-height: 420px;
}

.story-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

.story-slide__visual {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.story-slide__visual--spectrum {
  background: #1a1a1a;
}

.spectrum-bar {
  display: flex;
  gap: 4px;
  width: 100%;
  align-items: flex-end;
  height: 48px;
}

.spectrum-bar__seg {
  flex: 1;
  border-radius: 4px;
  height: 100%;
  background: linear-gradient(180deg, #4ade80, #facc15, #f472b6);
  opacity: 0.85;
  transform-origin: bottom;
}

.spectrum-bar__seg:nth-child(odd) { height: 70%; }
.spectrum-bar__seg:nth-child(3n) { height: 90%; background: linear-gradient(180deg, #f472b6, #facc15); }

.story-slide__visual--timeline {
  background: linear-gradient(135deg, #c45c26 0%, #8b3a1a 50%, #5c2410 100%);
  flex-direction: column;
  gap: 1.5rem;
}

.timeline {
  display: flex;
  gap: 1.5rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  font-weight: 600;
}

.timeline .is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
}

.timeline-pill {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.story-slide__visual--chat {
  background: linear-gradient(160deg, #6b4423 0%, #3d2817 100%);
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.chat-bubble--user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.chat-bubble--ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.story-slide__visual--chart {
  background: linear-gradient(160deg, #1e3a5f 0%, #0f172a 100%);
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.chart-mock__label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.chart-mock__value {
  font-size: 0.85rem;
  color: #4ade80;
  font-weight: 600;
}

.chart-mock__bars {
  height: 80px;
  background: linear-gradient(90deg, transparent 0%, rgba(74, 222, 128, 0.3) 40%, rgba(74, 222, 128, 0.6) 70%, transparent 100%);
  border-radius: 8px;
  margin-top: 0.5rem;
}

.story-slide__copy {
  text-align: center;
  max-width: 36ch;
}

.story-slide__copy h3 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.story-slide__copy p {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.story__rail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

.story__step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.story__step.is-active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.story__connector {
  width: 32px;
  height: 1px;
  background: rgba(0, 0, 0, 0.12);
}

/* Gallery — 3D cards */
.gallery {
  background: var(--white);
}

.gallery__pin {
  min-height: var(--viewport-h);
  padding: 10vh 6vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4rem;
}

.gallery__title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 400;
  text-align: center;
  max-width: 16ch;
}

.gallery__scene {
  position: relative;
  width: min(900px, 100%);
  height: 420px;
  perspective: 1200px;
  transform-style: preserve-3d;
}

.gallery-card {
  position: absolute;
  width: 200px;
  height: 260px;
  border-radius: 14px;
  overflow: hidden;
  background: #e8e8e8;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  transform-style: preserve-3d;
  will-change: transform;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}

.gallery-card span {
  position: relative;
  z-index: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.gallery-card__fill {
  position: absolute;
  inset: 0;
}

.gallery-card__fill--water {
  background: linear-gradient(180deg, #38bdf8 0%, #0e7490 60%, #164e63 100%);
}

.gallery-card__fill--mono {
  background: linear-gradient(180deg, #a8a29e 0%, #57534e 100%);
}

.gallery-card__fill--skin {
  background: linear-gradient(180deg, #fcd34d 0%, #d97706 100%);
}

.gallery-card__fill--stress {
  background: linear-gradient(180deg, #c4b5fd 0%, #6d28d9 100%);
}

.gallery-card--hero {
  width: 280px;
  height: 320px;
  z-index: 5;
}

.gallery-card:nth-child(1) { left: 0; top: 60px; }
.gallery-card:nth-child(2) { left: 50%; top: 20px; transform: translateX(-50%); }
.gallery-card:nth-child(3) { right: 80px; top: 100px; }
.gallery-card:nth-child(4) { right: 0; top: 180px; }
.gallery-card:nth-child(5) { left: 120px; bottom: 0; }

/* Path — dark timeline */
.path {
  background: var(--dark);
  color: var(--white);
}

.path__pin {
  min-height: var(--viewport-h);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10vh 6vw;
  overflow: hidden;
}

.path__title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  text-align: center;
  max-width: 14ch;
  margin-bottom: 4rem;
  position: relative;
  z-index: 2;
}

.path__svg {
  position: absolute;
  width: min(320px, 70vw);
  height: 70vh;
  color: var(--accent-glow);
  filter: drop-shadow(0 0 12px rgba(255, 107, 53, 0.5));
  z-index: 1;
}

.path__curve {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  stroke-linecap: round;
}

.path__milestones {
  position: relative;
  z-index: 2;
  width: min(520px, 100%);
  min-height: 400px;
}

.milestone {
  position: absolute;
  opacity: 0;
  transform: translateY(20px);
  max-width: 200px;
}

.milestone--1 { top: 5%; left: 0; }
.milestone--2 { top: 42%; right: 0; text-align: right; }
.milestone--3 { bottom: 8%; right: 10%; text-align: right; }

.milestone__age {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-glow);
  margin-bottom: 0.35rem;
}

.milestone__title {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.milestone ul {
  list-style: none;
  font-size: 0.75rem;
  opacity: 0.65;
  line-height: 1.7;
}

/* Outro */
.outro {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10vh 6vw;
  text-align: center;
  background: var(--white);
}

.outro__logo {
  font-family: var(--serif);
  font-size: clamp(4rem, 14vw, 9rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent) 0%, #c2410c 40%, #1a1a1a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.outro__tag {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.outro__cta {
  margin-top: 2.5rem;
  padding: 1rem 2.5rem;
  background: var(--ink);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform 0.2s, background 0.2s;
}

.outro__cta:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .gallery-card {
    width: 140px;
    height: 180px;
  }
  .gallery-card--hero {
    width: 200px;
    height: 240px;
  }
  .gallery-card:nth-child(3),
  .gallery-card:nth-child(4),
  .gallery-card:nth-child(5) {
    display: none;
  }
}
