/* IKIMONO DISCOVER top only — Design v4 "Tenbyou no Inochi". */

.page-top {
  --tenbyou-abyss-1: oklch(30% 0.045 240);
  --tenbyou-abyss-2: oklch(17% 0.03 255);
  --tenbyou-silver: oklch(92% 0.01 250);
}

#depth-canopy,
#top-birthday,
#depth-waterline,
#top-hubs,
#top-archive {
  scroll-margin-top: 5.25rem;
}

/* Depth navigation: text → depth → tick → line. */
.depth-rail {
  position: fixed;
  top: 50%;
  right: clamp(0.75rem, 1.8vw, 1.5rem);
  z-index: 45;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  color: var(--sumi-soft);
  font-size: 0.66rem;
  transform: translateY(-50%);
  transition: color 200ms ease;
}

.tenbyou-ready .depth-rail { display: flex; }

.depth-rail__line {
  position: absolute;
  top: 0.65rem;
  right: 3px;
  bottom: 0.65rem;
  width: 1px;
  background: color-mix(in oklch, var(--sumi) 24%, transparent);
  transition: background-color 200ms ease;
}

.depth-rail__dot {
  position: absolute;
  top: 0.65rem;
  right: 0;
  z-index: 2;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--shu);
  transform: translateY(-50%);
  will-change: top;
}

.depth-rail__stop {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(5.5em, auto) 4.2em 0.7rem;
  gap: 0.5rem;
  align-items: center;
  min-height: 2rem;
  padding: 0.3rem 0;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.depth-rail__value {
  color: inherit;
  font-family: var(--font-serif);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.depth-rail__tick {
  width: 0.7rem;
  height: 1px;
  background: color-mix(in oklch, var(--sumi) 26%, transparent);
  transition: background-color 200ms ease;
}

.depth-rail__stop[aria-current="location"] {
  color: var(--sumi);
  font-weight: 700;
}

.depth-rail__stop[aria-current="location"] .depth-rail__value {
  color: var(--shu);
}

.depth-rail--inverse { color: oklch(88% 0.01 250); }
.depth-rail--inverse .depth-rail__line,
.depth-rail--inverse .depth-rail__tick {
  background: oklch(88% 0.01 250);
}
.depth-rail--inverse .depth-rail__stop[aria-current="location"] { color: oklch(88% 0.01 250); }
.depth-rail--inverse .depth-rail__stop[aria-current="location"] .depth-rail__value { color: var(--shu); }

.depth-rail__stop:focus-visible {
  outline: 2px solid var(--shu);
  outline-offset: 4px;
}

/* Hero: the v3 editorial grid remains, with a pointillist whale behind it. */
.page-top .hero--home {
  isolation: isolate;
  min-height: min(calc(100svh - 3.8rem), 58.75rem);
}

.page-top .tenbyou-life {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-top .tenbyou-life-fallback {
  position: absolute;
  inset: 22% auto auto 3.5%;
  z-index: 0;
  width: min(50%, 40rem);
  height: 36%;
  overflow: visible;
  color: var(--sumi);
  opacity: 0.22;
  pointer-events: none;
}

.page-top .tenbyou-life-fallback path { fill: currentColor; }
.page-top .tenbyou-life-fallback circle { fill: var(--shu); opacity: 0.9; }

.page-top .hero__inner {
  z-index: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  min-height: min(calc(100svh - 3.8rem), 58.75rem);
  padding-block: clamp(2.2rem, 5vw, 4.2rem) clamp(2.8rem, 5vw, 4rem);
}

.page-top .hero__stamp {
  grid-column: 1;
  grid-row: 1;
}

.page-top .hero__copy {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  max-width: 34rem;
  margin-left: clamp(6rem, 10vw, 8rem);
  padding: 0.15rem 0;
  border: 0;
  background: transparent;
  transform: none;
}

.page-top .hero__lead {
  max-width: 30rem;
  color: var(--sumi-soft);
  font-size: 0.96rem;
}

.page-top .hero__title {
  grid-column: 2;
  grid-row: 1 / span 3;
  line-height: 1.16;
  letter-spacing: 0.08em;
}

.page-top .hero__stats {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  max-width: 42rem;
  margin-bottom: 0.5rem;
}

.page-top .hero__stat {
  padding: 0.72rem 1rem 0.72rem 1.45rem;
}

.page-top .hero__stat::before {
  top: 0.6rem;
  right: auto;
  left: 0.55rem;
  width: 5px;
  height: 5px;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 0.95rem 0 -1px var(--paper), 0 0.95rem 0 0 var(--rule);
}

.page-top .hero__stat dd {
  font-size: clamp(2rem, 1.45rem + 2.5vw, 3.6rem);
}

.page-top .tenbyou-caption {
  grid-column: 1;
  grid-row: 3;
  max-width: 42rem;
  margin: 0;
  color: var(--sumi-soft);
  font-size: 0.74rem;
}

.page-top .tenbyou-caption strong {
  color: var(--shu);
}

.page-top .scroll-cue {
  left: 50%;
  bottom: 0.8rem;
  color: var(--sumi-soft);
  transform: translateX(-50%);
}

html[lang="en"] .page-top .hero__title {
  max-width: 8.5em;
  font-size: clamp(3rem, 2rem + 4.8vw, 6.8rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

/* The scientific-name marquee becomes the waterline in normal flow. */
.tenbyou-waterline {
  position: relative;
  z-index: 2;
  overflow: hidden;
  border-top: 1px solid color-mix(in oklch, var(--color-aqua) 40%, var(--rule));
  border-bottom: 1px solid color-mix(in oklch, var(--color-aqua) 40%, var(--rule));
  background: linear-gradient(180deg, var(--paper), color-mix(in oklch, var(--color-aqua) 7%, var(--paper)));
}

.page-top .sci-marquee {
  position: static;
  inset: auto;
  border-top: 0;
  background: transparent;
}

.page-top .sci-marquee__track {
  padding-block: 0.6rem;
}

.tenbyou-zone--surface {
  background-color: var(--paper);
}

.tenbyou-zone--water {
  background:
    repeating-linear-gradient(0deg, transparent 0 18px, var(--grid-rule) 18px 19px),
    repeating-linear-gradient(90deg, transparent 0 18px, var(--grid-rule) 18px 19px),
    linear-gradient(180deg, color-mix(in oklch, var(--color-aqua) 7%, var(--paper)), color-mix(in oklch, var(--color-aqua) 17%, var(--paper)) 78%, color-mix(in oklch, var(--tenbyou-abyss-1) 28%, var(--paper)));
}

.tenbyou-zone--water + .tenbyou-zone--water {
  background:
    repeating-linear-gradient(0deg, transparent 0 18px, var(--grid-rule) 18px 19px),
    repeating-linear-gradient(90deg, transparent 0 18px, var(--grid-rule) 18px 19px),
    linear-gradient(180deg, color-mix(in oklch, var(--color-aqua) 17%, var(--paper)), color-mix(in oklch, var(--tenbyou-abyss-1) 34%, var(--paper)));
}

/* The archive is the only dark band and the narrative endpoint. */
.page-top .tenbyou-zone--abyss {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--tenbyou-silver);
  background: linear-gradient(180deg, color-mix(in oklch, var(--tenbyou-abyss-1) 88%, var(--paper)) 0%, var(--tenbyou-abyss-1) 15%, var(--tenbyou-abyss-2) 70%);
}

.page-top .tenbyou-zone--abyss::after {
  opacity: 0.08;
  filter: invert(1);
}

.page-top .tenbyou-zone--abyss::before {
  color: color-mix(in oklch, var(--tenbyou-silver) 72%, transparent);
}

.page-top .tenbyou-snow {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-top .tenbyou-zone--abyss > .wrap {
  position: relative;
  z-index: 2;
}

.page-top .tenbyou-memory__mission {
  grid-column: 1 / -1;
  max-width: 25em;
  margin: 0 0 clamp(2.6rem, 5vw, 5rem);
  color: oklch(94% 0.008 250);
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 1.2rem + 3.2vw, 4.6rem);
  line-height: 1.45;
}

.page-top .tenbyou-zone--abyss .section__title,
.page-top .tenbyou-zone--abyss .archive-entry-card h3 a {
  color: oklch(94% 0.008 250);
}

.page-top .tenbyou-zone--abyss .section__note,
.page-top .tenbyou-zone--abyss .section__more,
.page-top .tenbyou-zone--abyss .archive-entry-card,
.page-top .tenbyou-zone--abyss .specimen-label {
  color: oklch(89% 0.01 250);
}

.page-top .tenbyou-zone--abyss .archive-entry-card {
  border-color: color-mix(in oklch, var(--tenbyou-silver) 28%, transparent);
  background: color-mix(in oklch, var(--tenbyou-silver) 5%, transparent);
}

.page-top .tenbyou-zone--abyss a:focus-visible {
  outline-color: oklch(94% 0.008 250);
}

@media (max-width: 980px) {
  .tenbyou-ready .depth-rail { display: none; }
}

@media (max-width: 760px) {
  .page-top .hero__inner {
    grid-template-columns: minmax(0, 1fr) minmax(5.6rem, 0.32fr);
    grid-template-rows: auto 1fr auto;
  }

  .page-top .hero__copy {
    margin-left: 5.3rem;
  }

  .page-top .hero__stats {
    grid-template-columns: 1fr;
    max-width: min(17rem, 72%);
  }

  .page-top .hero__stat {
    padding-block: 0.55rem;
  }

  .page-top .hero__stat dd {
    font-size: 2rem;
  }

  html[lang="en"] .page-top .hero__inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    min-height: 42rem;
  }

  html[lang="en"] .page-top .hero__title {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    max-width: 8em;
    margin-top: 2rem;
  }

  html[lang="en"] .page-top .hero__stats {
    grid-row: 3;
  }

  html[lang="en"] .page-top .tenbyou-caption {
    grid-row: 4;
  }
}

@media (max-width: 480px) {
  .page-top .hero__inner {
    min-height: 42rem;
    padding-bottom: 3rem;
  }

  .page-top .hero__copy {
    margin-left: 4.8rem;
    font-size: 0.9rem;
  }

  .page-top .hero__stats {
    max-width: calc(100% - 5.2rem);
  }

  .page-top .tenbyou-caption {
    padding-right: 4.5rem;
  }
}

@media (max-width: 360px) {
  .page-top .hero__copy {
    grid-column: 1 / -1;
    width: auto;
    max-width: none;
    margin-left: 4.1rem;
  }

  .page-top .hero__lead { min-width: 12em; }
}

@media (prefers-reduced-motion: reduce) {
  .depth-rail__dot { will-change: auto; }
  .depth-rail,
  .depth-rail__line,
  .depth-rail__tick { transition: none; }
}
