/* ============================================================
   INDEX / 78 — 09 · The Hermit
   Single normalized stylesheet (Swiss / International style).
   Tokens → base → layout → components → guided mode → responsive.
   ============================================================ */

:root {
  /* Color */
  --paper: #f4f2ed;
  --ink: #111111;
  --muted: #77736a;
  --red: #e1241b;
  --panel: rgba(244, 242, 237, .94);
  --divider: rgba(17, 17, 17, .28);

  /* Type */
  --font: "Helvetica Neue", Helvetica, Arial, ui-sans-serif, system-ui, sans-serif;

  /* Spacing */
  --gutter: 18px;

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base ---------- */

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

html,
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-left: var(--gutter);
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

img { display: block; }

/* ---------- App shell ---------- */

.app {
  position: relative;
  width: calc(100vw - var(--gutter));
  height: 100vh;
  min-height: 560px;
  background: var(--paper);
  isolation: isolate;
}

/* ---------- Masthead ---------- */

.masthead {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  border-top: 8px solid var(--ink);
}

.brand,
.mode {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 232px;
  height: 100%;
  padding-right: var(--gutter);
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  line-height: 1.05;
}

.brand strong,
.brand small { display: block; }

.brand strong { font-size: 11px; }

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .06em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 100%;
  color: var(--paper);
  background: var(--red);
  font-size: 15px;
}

.mode {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 31;
  display: flex;
}

.mode button {
  min-width: 76px;
  padding: 8px 11px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: color .2s ease, background .2s ease;
}

.mode button:hover,
.mode button[aria-pressed="true"] {
  color: var(--paper);
  background: var(--ink);
}

/* ---------- Scenes ---------- */

.scene-stack {
  position: absolute;
  inset: 70px 0 60px;
}

.scene {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: stretch;
  padding: 18px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(18px);
  transition: opacity .35s linear, transform .45s var(--ease), visibility .35s;
}

.scene.active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.copy {
  grid-column: 1 / 7;
  align-self: center;
  padding-right: var(--gutter);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 34px;
  height: 4px;
  background: var(--red);
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  line-height: .82;
  letter-spacing: -.065em;
  text-wrap: balance;
}

h1 { font-size: clamp(64px, 7.6vw, 108px); }
h2 { font-size: clamp(58px, 6.8vw, 96px); }

h1 em,
h2 em {
  color: var(--red);
  font-style: normal;
}

.lede {
  max-width: 50ch;
  margin: 22px 0 0;
  font-size: clamp(14px, 1.15vw, 17px);
  font-weight: 700;
  line-height: 1.3;
}

.scene[data-scene="0"] .lede { margin-top: 20px; }

.lesson-note {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 14px;
  margin-top: 20px;
  padding-top: 9px;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.lesson-note b {
  color: var(--red);
  font-size: 10px;
  letter-spacing: .08em;
}

/* ---------- Visual ---------- */

.visual {
  position: absolute;
  top: -70px;
  right: 0;
  bottom: -60px;
  width: 48vw;
  background: var(--paper);
  overflow: hidden;
}

.visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s var(--ease);
}

/* ---------- Guided mode (audio-synced reveal) ---------- */

body.guided .scene.active .eyebrow,
body.guided .scene.active h1,
body.guided .scene.active h2,
body.guided .scene.active .lede,
body.guided .scene.active .lesson-note {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity .25s linear, transform .42s var(--ease);
}

body.guided .scene.active .visual {
  opacity: 0;
  transform: translateX(48px);
  transition: opacity .25s linear, transform .42s var(--ease);
}

body.guided .scene.active.cue-title .eyebrow,
body.guided .scene.active.cue-title h1,
body.guided .scene.active.cue-title h2,
body.guided .scene.active.cue-copy .lede,
body.guided .scene.active.cue-note .lesson-note,
body.guided .scene.active.cue-art .visual {
  opacity: 1;
  transform: none;
}

body.guided .scene.active.cue-art .visual img { transform: scale(1.02); }

/* ---------- Transport ---------- */

.transport {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 12;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 6px;
  align-items: center;
  width: min(760px, calc(100vw - 56px));
  height: 40px;
  transform: translateX(-50%);
}

.arrow {
  width: 36px;
  height: 36px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.arrow:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--paper);
  background: var(--red);
}

.arrow:disabled {
  opacity: .2;
  cursor: default;
}

.arrow.next { justify-self: end; }

.chapters {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: 36px;
  border: 1px solid var(--ink);
  background: var(--panel);
}

.chapter {
  height: 34px;
  border: 0;
  border-right: 1px solid var(--divider);
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .03em;
  text-align: center;
  text-transform: uppercase;
  transition: color .2s ease, background .2s ease;
}

.chapter:last-child { border-right: 0; }

.chapter:hover:not(.active) { color: var(--ink); }

.chapter.active {
  color: var(--paper);
  background: var(--red);
}

.guided-progress {
  position: absolute;
  left: 50%;
  bottom: 56px;
  z-index: 14;
  width: min(760px, calc(100vw - 56px));
  height: 3px;
  background: rgba(17, 17, 17, .22);
  transform: translateX(-50%);
}

.guided-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--red);
}

body.guided .guided-progress span { width: var(--scene-progress, 0%); }

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  body { padding: 10px; }

  .app {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    min-height: 720px;
    border-top: 8px solid var(--ink);
    overflow: hidden;
  }

  .masthead {
    height: 64px;
    border-top: 0;
  }

  .brand { font-size: 8px; }
  .brand-mark { width: 38px; }

  .mode {
    top: 18px;
    right: 10px;
  }

  .mode button {
    min-width: 70px;
    padding: 8px;
  }

  .scene-stack { inset: 66px 0 78px; }

  .scene {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: auto 1fr;
    gap: 16px;
    padding: 10px 0;
  }

  .visual {
    position: relative;
    inset: auto;
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    max-height: 40vh;
    border: 2px solid var(--ink);
  }

  .visual img { padding: 8px; }

  .copy {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: start;
    padding: 0;
  }

  h1,
  h2 { font-size: clamp(44px, 13vw, 70px); }

  .lede {
    margin-top: 14px;
    font-size: 13px;
  }

  .lesson-note { display: none; }

  .transport {
    width: calc(100vw - 40px);
    height: 38px;
    bottom: 10px;
    grid-template-columns: 38px 1fr 38px;
  }

  .guided-progress {
    bottom: 50px;
    width: calc(100vw - 40px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }

  body.guided .scene.active .eyebrow,
  body.guided .scene.active h1,
  body.guided .scene.active h2,
  body.guided .scene.active .lede,
  body.guided .scene.active .lesson-note,
  body.guided .scene.active .visual { transform: none; }
}
