/* whydunit.ai
   Palette: chalk paper, Prussian-blue ink, litmus for the player's hand.
   Type: IM Fell English (display, the period's own face) + Hanken Grotesk (body). */

:root {
  --chalk: #eef2ef;
  --white: #fbfcfb;
  --ink: #10304f;
  --slate: #536879;
  --wash: #d6e2e9;
  --litmus: #b92d55;
  --rule: #b9c8d2;

  --display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;

  --measure: 62ch;
  --page: 68rem;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--litmus); }

:focus-visible { outline: 3px solid var(--litmus); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(2.5rem, 6.4vw, 5.25rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.5rem; line-height: 1.2; }
p { margin: 0 0 1em; max-width: var(--measure); }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--gap); }

/* Header */
.site-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding-top: 1.5rem; padding-bottom: 1.5rem;
}
.wordmark { font-family: var(--display); font-style: italic; font-size: 1.75rem; text-decoration: none; }
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a { text-decoration: none; font-weight: 500; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--litmus); text-decoration-thickness: 2px; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.btn {
  display: inline-block; padding: 0.75rem 1.25rem; border-radius: 2px;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--white);
  font: 600 1rem var(--body); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--litmus); border-color: var(--litmus); color: var(--white); }
.btn.quiet { background: transparent; color: var(--ink); }
.btn.quiet:hover { background: transparent; color: var(--litmus); }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* Hero */
.hero { padding-top: clamp(2rem, 6vw, 5rem); padding-bottom: clamp(3rem, 7vw, 6rem); }
.hero h1 { max-width: 15ch; }
.hero h1 .who { color: var(--slate); }
.hero-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: end; margin-top: 2.5rem; }
.lede { font-size: 1.25rem; line-height: 1.5; }

/* The exchange: the one loud element. Player speaks in litmus Fell italic,
   the world answers in plain ink on a blue wash. */
.exchange { margin: 0; }
.turn { margin: 0; }
.turn + .turn { margin-top: 0.75rem; }
.turn .who-says { display: block; font: 600 0.875rem var(--body); color: var(--slate); margin-bottom: 0.2rem; }
.turn.move p { font-family: var(--display); font-style: italic; font-size: 1.375rem; line-height: 1.35; color: var(--litmus); margin: 0; }
.turn.world { background: var(--wash); padding: 1rem 1.25rem; border-left: 3px solid var(--ink); }
.turn.world p { margin: 0; }
.turn.world p + p { margin-top: 0.6em; }

.sealed {
  margin-top: 1rem; padding: 0.7rem 1.25rem; color: var(--white); font-weight: 500; font-size: 0.9375rem;
  background: repeating-linear-gradient(-45deg, var(--ink) 0 10px, #1b4168 10px 20px);
}

/* Sections */
.band { padding: clamp(2.5rem, 6vw, 5rem) 0; border-top: 1px solid var(--rule); }
.band > .wrap > h2 { margin-bottom: 1.5rem; max-width: 22ch; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: var(--gap); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: block; font-family: var(--display); font-size: 3rem; line-height: 1; color: var(--litmus); margin-bottom: 0.5rem; }
.steps h3 { margin-bottom: 0.5rem; }
.steps p { font-size: 1rem; }

.versus { width: 100%; border-collapse: collapse; max-width: 52rem; }
.versus th, .versus td { text-align: left; vertical-align: top; padding: 0.85rem 1rem 0.85rem 0; border-bottom: 1px solid var(--rule); }
.versus thead th { font-family: var(--display); font-size: 1.375rem; font-weight: 400; }
.versus tbody th { font-weight: 600; color: var(--slate); width: 9rem; }

/* Case list */
.page-intro { padding-top: clamp(1.5rem, 4vw, 3rem); padding-bottom: clamp(2rem, 4vw, 3rem); }
.page-intro h1 { font-size: clamp(2.25rem, 5vw, 4rem); max-width: 18ch; margin-bottom: 1.25rem; }

.case-list { list-style: none; margin: 0; padding: 0; }
.case-list li { border-top: 1px solid var(--ink); }
.case-list a {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: var(--gap);
  align-items: start; padding: 1.75rem 0; text-decoration: none;
}
.case-list a:hover { color: inherit; background: var(--wash); }
.case-list a:hover h2 { color: var(--litmus); }
.case-list h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
.case-list .setting { color: var(--slate); margin: 0.4rem 0 0; }
.case-list .hook { margin: 0; }
.case-list .open { font-weight: 600; white-space: nowrap; padding-top: 0.3rem; }

/* Case page */
.case-head { padding-top: clamp(1.5rem, 4vw, 3rem); padding-bottom: 2rem; }
.case-head .setting { color: var(--slate); margin-bottom: 0.5rem; }
.case-head h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); max-width: 16ch; }
.case-body { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); padding-bottom: 3rem; }
.brief h2 { font-size: 1.625rem; margin: 2rem 0 0.75rem; }
.brief h2:first-child { margin-top: 0; }
.brief ul { padding-left: 1.1rem; max-width: var(--measure); margin: 0 0 1em; }
.brief li { margin-bottom: 0.4em; }
.facts { margin: 0; padding: 1.25rem; background: var(--white); border: 1px solid var(--rule); align-self: start; }
.facts dt { font-weight: 600; color: var(--slate); font-size: 0.9375rem; }
.facts dd { margin: 0 0 1rem; }
.facts dd:last-child { margin-bottom: 0; }

/* Desk (play area) */
.desk { border-top: 1px solid var(--ink); padding: 2.5rem 0 4rem; }
.desk h2 { margin-bottom: 0.5rem; }
.desk-log { max-width: 46rem; margin: 1.5rem 0; }
.desk-log:empty { display: none; }
.desk form { max-width: 46rem; }
.desk label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.desk textarea {
  width: 100%; min-height: 6.5rem; padding: 0.85rem 1rem; resize: vertical;
  font: inherit; color: var(--ink); background: var(--white);
  border: 1.5px solid var(--ink); border-radius: 2px;
}
.desk .hint { color: var(--slate); font-size: 0.9375rem; margin-top: 0.5rem; }
.desk .notice { margin-top: 1rem; padding: 1rem 1.25rem; background: var(--white); border-left: 3px solid var(--litmus); max-width: 46rem; }
.desk .notice[hidden] { display: none; }

/* Replays */
.replay { padding: clamp(2.5rem, 5vw, 4rem) 0; border-top: 1px solid var(--ink); }
.replay-head { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); margin-bottom: 2.5rem; }
.replay-head .setting { color: var(--slate); margin-bottom: 0.5rem; }
.replay-head h2 { font-size: clamp(2.25rem, 5vw, 3.75rem); margin-bottom: 1rem; }

.session { list-style: none; margin: 0; padding: 0; }
.session > li { display: grid; grid-template-columns: 12rem minmax(0, 44rem); gap: var(--gap); padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.session .method { font-weight: 600; font-size: 0.9375rem; line-height: 1.4; color: var(--ink); margin: 0.2rem 0 0; }
.session .method span { display: block; font-weight: 400; color: var(--slate); margin-top: 0.25rem; }

.afterword { display: grid; grid-template-columns: 12rem minmax(0, 44rem); gap: var(--gap); padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.afterword h3 { font-size: 1.25rem; }
.afterword p { font-size: 1rem; }

.jump { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); padding: 2rem 0 3rem; color: var(--slate); font-size: 0.9375rem; }
.site-foot p { margin: 0; }

/* Small screens */
@media (max-width: 52rem) {
  .hero-grid, .case-body, .replay-head { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-list a { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .session > li, .afterword { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .versus tbody th { width: 6.5rem; }
}
@media (max-width: 30rem) {
  .steps { grid-template-columns: minmax(0, 1fr); }
  .site-nav { gap: 1rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .case-list a { transition: background-color 120ms ease, color 120ms ease; }
}

/* Casebook: one featured latest case, numbered back catalogue */
.issue { font-family: var(--display); color: var(--litmus); line-height: 0.8; }
.issue-line { font-weight: 600; font-size: 0.9375rem; color: var(--slate); margin: 0 0 0.5rem; display: block; }

.latest {
  display: grid; grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 0.7fr); gap: var(--gap);
  align-items: start; padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--white); border: 1.5px solid var(--ink);
}
.latest .issue { font-size: clamp(6rem, 16vw, 13rem); }
.latest h2 { font-size: clamp(2.25rem, 5vw, 4rem); }
.latest h2 a { text-decoration: none; }
.latest .setting { color: var(--slate); margin: 0.6rem 0 1rem; }
.latest .hook { font-size: 1.125rem; }
.latest .facts { background: var(--chalk); }

.earlier { padding-top: clamp(2.5rem, 5vw, 4rem); }
.earlier > h2 { font-size: 1.625rem; margin-bottom: 1rem; }
.backlist { list-style: none; margin: 0; padding: 0; }
.backlist li { border-top: 1px solid var(--ink); }
.backlist a {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1.3fr); gap: var(--gap);
  align-items: start; padding: 1.5rem 0; text-decoration: none;
}
.backlist a:hover { color: inherit; background: var(--wash); }
.backlist a:hover strong { color: var(--litmus); }
.backlist .issue { font-size: 4rem; padding-top: 0.5rem; }
.backlist strong { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.15; }
.backlist .setting { display: block; color: var(--slate); margin-top: 0.3rem; }

@media (max-width: 52rem) {
  .latest { grid-template-columns: minmax(0, 1fr); }
  .latest .issue { font-size: 6rem; }
  .backlist a { grid-template-columns: 3rem minmax(0, 1fr); }
  .backlist .hook { grid-column: 2; }
  .backlist .issue { font-size: 3rem; }
}
