/*
 * The site's own sheet, built on the generated tokens in `/tokens.css` so it shares one visual
 * system with the app rather than inventing a second palette. Reading is the only job here, so the
 * measure is capped and the type scale is the token scale.
 *
 * The faces are the app's, subsetted to what these pages say — see `scripts/build-brand-assets.py`.
 * The lock is the app's too: MaruBuri carries titles and question stems, Pretendard carries body,
 * choices and buttons. `swap` because a reader should get the words immediately and the right
 * shapes a moment later, never the other way round.
 */

@font-face {
  font-family: MaruBuri;
  src: url("/brand/maruburi-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: MaruBuri;
  src: url("/brand/maruburi-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: Pretendard;
  src: url("/brand/pretendard-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Pretendard;
  src: url("/brand/pretendard-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ab-paper);
  color: var(--ab-ink);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.75;
}

a { color: var(--ab-ink); }

/*
 * Rail beside stage on a desktop; rail stacked above it on a phone. One grid, one breakpoint, and
 * the rail is a real column rather than a drawer — there is one nav item today and it should be
 * visible, not behind a button.
 */
.shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

@media (min-width: 900px) {
  .shell { grid-template-columns: 15rem 1fr; }
  .rail {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    border-right: 1px solid var(--ab-line);
    border-bottom: 0;
  }
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 20px;
  background: var(--ab-surface);
  border-bottom: 1px solid var(--ab-line);
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
}

.mark-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: none;
}

.wordmark {
  font-family: MaruBuri, Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.01em;
}

.rail-label {
  margin: 0 0 8px;
  color: var(--ab-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.rail-nav ul { list-style: none; margin: 0; padding: 0; }

.rail-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 15px;
  text-decoration: none;
}

.rail-item.is-current {
  background: var(--ab-soft);
  font-weight: 600;
}

/*
 * Pushed to the bottom of the rail where it is a signature rather than a headline — and only there.
 * Stacked above the questions on a phone it is one more thing between the reader and the first
 * question, and the footer already says it.
 */
.rail-foot { display: none; }

@media (min-width: 900px) {
  .rail-foot {
    display: block;
    margin: auto 0 0;
    color: var(--ab-muted);
    font-size: 12px;
  }
}

.stage { display: flex; flex-direction: column; min-width: 0; }

.stage-head { padding: 24px 16px 0; }

.stage-head h1 {
  font-family: MaruBuri, Georgia, serif;
  max-width: 40rem;
  margin: 0 auto 16px;
  font-size: 24px;
  line-height: 1.3;
}

/*
 * The tab strip stays while the questions move past it: on a page of ten, knowing which Part you
 * are in — and being able to leave for another — should not require scrolling back up. The title
 * above it does scroll away; it says the same thing on all ten pages and the tab says the part.
 *
 * Opaque, because it now passes over cards. Sideways-scrolling rather than wrapping on a phone,
 * with `scroll-snap` so the movement lands on a tab instead of halfway through one.
 */
.parts {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  /*
   * `safe center` rather than plain `center`: centred while the tabs fit, and start-aligned the
   * moment they do not. Plain `center` on a scrolling row pushes the overflow off *both* ends and
   * makes the first tabs unreachable — you cannot scroll to something that starts before the
   * scroll origin. On a phone ten tabs never fit, so that is the case, not the edge case.
   */
  justify-content: safe center;
  gap: 4px;
  padding: 4px 16px 0;
  background: var(--ab-paper);
  border-bottom: 1px solid var(--ab-line);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

/* Wide enough to hold them all: wrap instead of scroll, so ten Parts are ten visible Parts. */
@media (min-width: 900px) {
  .parts {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* So an in-page link does not land a question underneath the strip that is now covering the top. */
html { scroll-padding-top: 120px; }

.part-tab {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: none;
  scroll-snap-align: start;
  min-height: 52px;
  padding: 6px 14px;
  border-bottom: 2px solid transparent;
  color: var(--ab-muted);
  text-decoration: none;
}

.part-tab.is-current {
  border-bottom-color: var(--ab-accent);
  color: var(--ab-ink);
}

.part-tab-n {
  font-size: 11px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.part-tab-title { font-size: 14px; font-weight: 600; white-space: nowrap; }

/* One column, capped at a comfortable measure. Long lines are the main way a reading page fails. */
.page {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.page > h1 {
  font-family: MaruBuri, Georgia, serif;
  font-size: 28px;
  line-height: 1.25;
  margin: 24px 0 8px;
}

.part-title {
  font-family: MaruBuri, Georgia, serif;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 24px 0 8px;
  font-size: 26px;
  line-height: 1.25;
}

.part-title-n {
  color: var(--ab-accent);
  font-family: Pretendard, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.lead {
  color: var(--ab-muted);
  margin: 0 0 32px;
}

.q {
  background: var(--ab-surface);
  border: 1px solid var(--ab-line);
  border-radius: 12px;
  padding: 24px;
  margin: 0 0 16px;
}

.q h2 {
  font-family: MaruBuri, Georgia, serif;
  font-size: 20px;
  line-height: 1.5;
  margin: 0 0 12px;
}

.q-number {
  display: inline-block;
  min-width: 2ch;
  color: var(--ab-accent);
  font-variant-numeric: tabular-nums;
}

.q-intent { margin: 0 0 8px; }

/* The Part's own line, once, under its title. */
.part-blurb {
  color: var(--ab-muted);
  margin: 0 0 24px;
}

/*
 * The question's tone, in a word. It sits with the stem rather than above it because it qualifies
 * the question — "걱정" and "웃음" are different invitations to the same kind of asking.
 */
.q-mood {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--ab-soft);
  color: var(--ab-muted);
  font-family: Pretendard, sans-serif;
  font-size: 12px;
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}

/*
 * What a choice stands for. Four plausible answers read as one blur without it; named, they read as
 * four different things a person might want.
 */
.q-choice-value {
  display: block;
  margin-top: 4px;
  color: var(--ab-accent);
  font-size: 13px;
  font-style: normal;
}

.q-example {
  margin: 0 0 16px;
  color: var(--ab-muted);
  font-size: 15px;
}

.q-label {
  font-size: 13px;
  color: var(--ab-muted);
  margin: 0 0 8px;
  font-weight: 400;
}

.q-choices {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.q-choices li {
  border: 1px solid var(--ab-line);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 8px;
  background: var(--ab-paper);
}

.q-why summary {
  cursor: pointer;
  font-size: 15px;
  color: var(--ab-muted);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.q-why p { margin: 0; font-size: 15px; }

/* Reserved, not filled. Holding the height keeps the layout from shifting when a unit arrives. */
.ad-slot {
  min-height: 100px;
  margin: 32px 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 32px 0;
}

.pager a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 20px;
  border-radius: 999px;
  text-decoration: none;
}

.pager-prev { border: 1px solid var(--ab-line); }

.pager-next {
  flex-direction: column;
  padding: 8px 24px;
  background: var(--ab-ink);
  color: var(--ab-surface);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

.pager-next-part {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.75;
}

/*
 * The end of the pack is a different destination, not a further page. It is also the only accent
 * control on that screen: reaching the sheet is the reader's own goal, and it outranks ours.
 */
.pager-next.is-result {
  justify-content: center;
  background: var(--ab-accent);
}

.pager-progress {
  color: var(--ab-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.cta {
  background: var(--ab-soft);
  border-radius: 12px;
  padding: 24px;
  margin: 48px 0 0;
}

.cta h2 { margin: 0 0 8px; font-size: 20px; }
.cta p { margin: 0 0 16px; }

/*
 * Ink, not accent. On the last Part this sits a few lines under 결과 보기, and two accent pills
 * competing there would put our funnel level with the thing the reader actually came for. The
 * panel's own tint already separates it from the page.
 */
.cta-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--ab-ink);
  color: var(--ab-surface);
  font-weight: 600;
  text-decoration: none;
}

.cards { list-style: none; margin: 24px 0 0; padding: 0; }

.card {
  background: var(--ab-surface);
  border: 1px solid var(--ab-line);
  border-radius: 12px;
  padding: 24px;
  margin: 0 0 16px;
}

.card h2 { margin: 0 0 8px; font-size: 20px; }
.card p { margin: 0; }
.card-meta { color: var(--ab-muted); font-size: 14px; margin-top: 8px !important; }

.foot {
  padding: 24px 16px 48px;
  text-align: center;
  color: var(--ab-muted);
  font-size: 13px;
}

.foot-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 8px;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ab-muted);
}

/* Standing pages are prose. The measure is the reading column's; the rhythm is looser than a card. */
.prose { margin: 0 0 32px; }

.prose h2 {
  font-family: MaruBuri, Georgia, serif;
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 12px;
}

.prose p { margin: 0 0 16px; }

.prose-contact {
  margin: 0 0 32px;
  font-size: 19px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Answering. The choices are labels around real inputs, so the whole row is a target. */
.q-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
}

.q-choice input { margin-top: 6px; flex: none; }

.q-undiscussed {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ab-muted);
  font-size: 15px;
  cursor: pointer;
}

/* The sheet. A reflection: no score, no verdict, nothing that ranks. */
.result-count { font-weight: 600; margin: 24px 0 8px; }
.result-note { color: var(--ab-muted); margin: 0 0 24px; }

.result-undiscussed {
  background: var(--ab-soft);
  border-radius: 12px;
  padding: 24px;
  margin: 0 0 32px;
}

.result-undiscussed h2 { margin: 0 0 4px; font-size: 18px; }
.result-undiscussed p { margin: 0 0 12px; color: var(--ab-muted); }
.result-undiscussed ul { margin: 0; padding-left: 20px; }

.result-chapter { margin: 0 0 32px; }
.result-chapter h2 { font-size: 18px; margin: 0 0 12px; }
.result-chapter ul { list-style: none; margin: 0; padding: 0; }

.result-chapter li {
  border-left: 2px solid var(--ab-line);
  padding: 0 0 0 16px;
  margin: 0 0 16px;
}

.result-q { margin: 0 0 4px; color: var(--ab-muted); font-size: 15px; }
.result-a { margin: 0; }

.result-clear-note { color: var(--ab-muted); font-size: 14px; margin: 32px 0 8px; }

.result-clear {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--ab-line);
  background: transparent;
  color: var(--ab-ink);
  font: inherit;
  cursor: pointer;
}
