/* Eva gold palette, from matome-app/spec.md §4. No pure white. */
:root {
  --gold: #e1b346;
  --gold-deep: #b98a1f;
  --on-gold: #221e16;

  --serif: "Newsreader", "Noto Serif JP", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;

  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

[data-theme="light"] {
  --bg: #f6f4ef;
  --surface: #fdfcf9;
  --border: #e7e2d7;
  --text: #221e16;
  --text-2: #585249;
  --muted: #655d4f;
  --gold-text: #8b6a29;
  --gold-soft: #f6e8c0;
  --line: rgba(34, 30, 22, 0.16);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #1a1714;
  --surface: #252119;
  --border: #38322a;
  --text: #f4f1e9;
  --text-2: #c4bcad;
  --muted: #aaa08d;
  --gold-text: #e1b346;
  --gold-soft: #3a2d10;
  --line: rgba(244, 241, 233, 0.14);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.6s var(--ease), color 0.6s var(--ease);
}

:lang(ja) body,
html:lang(ja) {
  --serif: "Noto Serif JP", "Newsreader", serif;
}

::selection {
  background: var(--gold);
  color: var(--on-gold);
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: min(1100px, 100% - 3rem);
  margin-inline: auto;
}

.wrap--narrow {
  width: min(560px, 100% - 3rem);
}

/* ---------- Top bar ---------- */

.bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s, border-color 0.4s;
}

.bar.is-scrolled {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom-color: var(--border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* Where the logo docks. The logo itself is .brand, placed by main.js. */
.bar__mark {
  display: block;
  width: 30px;
  height: 30px;
}

.bar__tools {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.lang {
  display: flex;
  gap: 0.25rem;
}

.lang button,
.theme {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  transition: color 0.3s;
}

.lang button:hover,
.theme:hover {
  color: var(--text);
}

.lang button[aria-pressed="true"] {
  color: var(--gold-text);
}

.lang button[lang="ja"] {
  letter-spacing: 0.04em;
}

.theme svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.theme path {
  fill: currentColor;
  stroke: none;
}

/* ---------- 1. Hero ---------- */

.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

/* ---------- Logo: written once, then docked ---------- */

.hero__logo {
  width: clamp(120px, 24vmin, 240px);
  aspect-ratio: 1;
  margin: 0 auto clamp(2rem, 5vh, 3.25rem);
}

.brand {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 11;
  display: block;
  width: 30px;
  height: 30px;
  visibility: hidden;
}

.brand.is-placed {
  visibility: visible;
}

.brand svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.brand__frame,
.brand__ma {
  fill: none;
  stroke: var(--text);
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transition: stroke 0.6s var(--ease);
}

.brand__frame {
  stroke-width: 5;
  animation: write 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.2s forwards;
}

/* マ in its stroke order: the hooked stroke first, then the short one. */
.brand__ma {
  stroke-width: 3.2;
}

.brand__ma--1 {
  animation: write 0.5s cubic-bezier(0.5, 0, 0.3, 1) 1.1s forwards;
}

.brand__ma--2 {
  animation: write 0.3s cubic-bezier(0.5, 0, 0.3, 1) 1.7s forwards;
}

/* The corner folds last, in gold, from the corner outwards. */
.brand__fold {
  fill: var(--gold);
  transform-box: view-box;
  transform-origin: 0 100px;
  transform: scale(0);
  animation: fold 0.55s cubic-bezier(0.3, 1.4, 0.5, 1) 2.05s forwards;
}

[data-theme="light"] .brand__fold {
  fill: var(--gold-deep);
}

@keyframes write {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fold {
  to {
    transform: none;
  }
}

.hero__stage {
  position: relative;
  text-align: center;
  padding-inline: 1.5rem;
}

.hero__name {
  margin: 0;
  font: 300 clamp(3rem, 9vw, 5.5rem) / 1 "Cormorant Garamond", serif;
  letter-spacing: 0.02em;
}

.hero__slogan {
  margin: 1.25rem 0 0;
  font: 300 italic clamp(1.2rem, 2.8vw, 1.8rem) / 1.35 var(--serif);
  color: var(--text-2);
}

html:lang(ja) .hero__slogan {
  font-style: normal;
  letter-spacing: 0.12em;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}

.hero__scroll i {
  display: block;
  width: 1px;
  height: 40px;
  background: linear-gradient(var(--gold), transparent);
}

/* ---------- Shared section type ---------- */

.about,
.waitlist {
  padding-block: clamp(6rem, 18vh, 12rem);
}

.eyebrow {
  margin: 0 0 1.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold-text);
}

.title {
  margin: 0;
  max-width: 18ch;
  font: 300 clamp(2rem, 4.6vw, 3.5rem) / 1.12 var(--serif);
  letter-spacing: -0.005em;
}

html:lang(ja) .title {
  max-width: 16em;
  font-size: clamp(1.7rem, 3.6vw, 2.8rem);
  line-height: 1.45;
  letter-spacing: 0.04em;
}

.lead {
  margin: 1.75rem 0 0;
  max-width: 38rem;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-2);
}

/* ---------- 2. Story: sticky scene, acts that scroll past it ---------- */

.story {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  margin-top: clamp(3rem, 8vh, 6rem);
}

.scene {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  height: 100vh;
  height: 100svh;
  margin: 0;
}

.scene__svg {
  display: block;
  width: min(100%, 600px);
  height: auto;
  overflow: visible;
  font-family: var(--sans);
}

.scene__progress {
  display: flex;
  gap: 0.6rem;
}

.scene__progress i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background-color 0.4s, transform 0.4s var(--ease);
}

.scene__progress i.is-on {
  background: var(--gold);
  transform: scale(1.3);
}

.acts {
  margin: 0;
  padding: 0 0 12vh;
  list-style: none;
}

.act {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 85vh;
  opacity: 0.22;
  transition: opacity 0.6s var(--ease);
}

.act.is-active {
  opacity: 1;
}

.act__eyebrow {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-text);
}

.act__title {
  margin: 0;
  max-width: 16ch;
  font: 300 clamp(1.7rem, 3vw, 2.4rem) / 1.18 var(--serif);
}

html:lang(ja) .act__title {
  max-width: 14em;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.act__body {
  margin: 1.25rem 0 0;
  max-width: 30rem;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-2);
}

/* ---------- Scene drawing ---------- */

.scene__svg .s-caption,
.scene__svg .s-ai-label {
  fill: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Under a department the note reads as a quiet annotation, not a tag. */
.scene__svg .s-note {
  fill: var(--muted);
  font: italic 300 14px var(--serif);
}

html:lang(ja) .scene__svg .s-note {
  font-style: normal;
  font-size: 12px;
}


.scene__svg .s-name {
  fill: var(--text);
  font: 400 19px var(--serif);
}

html:lang(ja) .scene__svg .s-name {
  font-size: 17px;
}

html:lang(ja) .scene__svg .s-caption {
  letter-spacing: 0.1em;
}

.scene__svg .s-space {
  transition: opacity 0.8s var(--ease);
}

.scene__svg .s-ring {
  fill: var(--bg);
  stroke: var(--gold);
  stroke-opacity: 0.6;
  transition: stroke-opacity 0.3s, stroke-width 0.3s;
}

.scene__svg .s-ring.is-pulse {
  stroke-opacity: 1;
  stroke-width: 2.5;
}

.scene__svg .s-page {
  fill: var(--surface);
  stroke: var(--text-2);
  stroke-width: 1;
  stroke-linejoin: round;
}

.scene__svg .s-page.is-back {
  stroke-opacity: 0.45;
}

.scene__svg .s-lines {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.scene__svg .s-act {
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}

.scene[data-act="1"] .s-act-1,
.scene[data-act="2"] .s-act-2,
.scene[data-act="3"] .s-act-3,
.scene[data-act="4"] .s-act-4 {
  opacity: 1;
}

.scene[data-act="2"] .s-space-fin,
.scene[data-act="2"] .s-space-jur,
.scene[data-act="3"] .s-space-jur {
  opacity: 0.3;
}

/* Act 1 */
.scene__svg .s-track {
  fill: none;
  stroke: var(--gold);
  stroke-opacity: 0.5;
  stroke-dasharray: 2 6;
}

.scene__svg .s-track.is-still {
  stroke: var(--line);
  stroke-opacity: 1;
  stroke-dasharray: none;
}

.scene__svg .s-bead {
  fill: var(--gold);
}

.scene__svg .s-spin {
  transform-box: view-box;
  animation: spin var(--spin) linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Act 2 */
.scene__svg .s-ai-halo {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.2;
  stroke-dasharray: 3 5;
  transform-box: fill-box;
  transform-origin: center;
  animation: ai-halo 6s var(--ease) infinite;
}

.scene__svg .s-switch {
  fill: none;
  stroke: var(--gold);
  animation: ai-switch 6s var(--ease) infinite;
}

.scene__svg .s-knob {
  fill: var(--gold);
  animation: ai-knob 6s var(--ease) infinite;
}

.scene__svg .s-ai-label {
  fill: var(--gold-text);
  letter-spacing: 0.16em;
}

@keyframes ai-halo {
  0%, 15%, 88%, 100% { opacity: 0; transform: scale(0.92); }
  30%, 72% { opacity: 1; transform: none; }
}

@keyframes ai-switch {
  0%, 15%, 88%, 100% { fill: transparent; }
  30%, 72% { fill: var(--gold-soft); }
}

@keyframes ai-knob {
  0%, 15%, 88%, 100% { transform: none; }
  30%, 72% { transform: translateX(18px); }
}

/* Act 3 */
.scene__svg .s-person {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.2;
}

.scene__svg .s-grant {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.4s var(--ease) 0.2s;
}

.scene[data-act="3"] .s-grant {
  stroke-dashoffset: 0;
}

.scene__svg .s-denied {
  stroke: var(--muted);
  stroke-width: 1.2;
  stroke-dasharray: 3 4;
  opacity: 0;
  transition: opacity 0.8s var(--ease) 0.5s;
}

.scene[data-act="3"] .s-denied {
  opacity: 1;
}

.scene__svg .s-lock {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.3;
  opacity: 0;
  transition: opacity 0.6s var(--ease) 0.9s;
}

.scene__svg .s-lock rect {
  fill: var(--bg);
}

.scene[data-act="3"] .s-lock {
  opacity: 1;
}

/* Act 4 */
.scene__svg .s-baseline {
  stroke: var(--text-2);
  stroke-opacity: 0.5;
}

.scene__svg .s-drop {
  stroke: var(--line);
  stroke-dasharray: 2 4;
}

.scene__svg .s-tick {
  fill: var(--gold);
}

.scene__svg .s-tick.is-static {
  fill: var(--muted);
  opacity: 0.5;
}

/* ---------- 3. Waitlist ---------- */

.waitlist {
  text-align: center;
  border-top: 1px solid var(--border);
}

.waitlist .title,
.waitlist .lead {
  margin-inline: auto;
}

.form {
  display: grid;
  gap: 0.75rem;
  margin-top: 3rem;
}

.field input {
  width: 100%;
  padding: 1rem 0.25rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  font: inherit;
  color: var(--text);
  text-align: center;
  transition: border-color 0.3s;
}

.field input::placeholder {
  color: var(--muted);
}

.field input:focus {
  outline: none;
  border-bottom-color: var(--gold);
}

.field input[aria-invalid="true"] {
  border-bottom-color: #b23a2e;
}

[data-theme="dark"] .field input[aria-invalid="true"] {
  border-bottom-color: #ff6b75;
}

.button {
  justify-self: center;
  margin-top: 1.5rem;
  padding: 1rem 2.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--on-gold);
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s var(--ease);
}

.button:hover {
  background: var(--gold-deep);
}

.button:active {
  transform: scale(0.98);
}

.form__note {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.form__done {
  margin: 3rem 0 0;
  font: 300 italic 1.4rem/1.45 var(--serif);
  color: var(--gold-text);
}

html:lang(ja) .form__done {
  font-style: normal;
  font-size: 1.2rem;
}

.waitlist.is-done .form,
.waitlist.is-done .form__note {
  display: none;
}

/* ---------- Footer ---------- */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1.25rem, 4vw, 2.5rem);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .story {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .scene {
    top: 70px;
    z-index: 2;
    height: auto;
    gap: 0.9rem;
    padding-block: 0.75rem 1rem;
    background: var(--bg);
    transition: background-color 0.6s var(--ease);
  }

  /* Text slides under the scene; a short fade softens the edge. */
  .scene::after {
    content: "";
    position: absolute;
    inset: 100% 0 auto;
    height: 2.5rem;
    background: linear-gradient(var(--bg), transparent);
    pointer-events: none;
  }

  .scene__svg {
    width: 100%;
  }

  /* At phone width the drawing speaks alone: names only, set larger. */
  .scene__svg .s-note,
  .scene__svg .s-caption {
    display: none;
  }

  .scene__svg .s-name {
    font-size: 28px;
  }

  html:lang(ja) .scene__svg .s-name {
    font-size: 26px;
  }

  .scene__svg .s-ai-label {
    font-size: 20px;
  }

  .act {
    justify-content: flex-start;
    min-height: 55vh;
    padding-top: 1.5rem;
  }
}

@media (max-width: 720px) {
  .foot {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ---------- Reduced motion: everything present, nothing moving ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    animation: none !important;
  }

  .brand__frame,
  .brand__ma {
    stroke-dashoffset: 0;
  }

  .brand__fold {
    transform: none;
  }
}
