/* ==========================================================================
   Seoulvivor — shared stylesheet
   --------------------------------------------------------------------------
   The app is a passport: paper, ink, and rubber stamps. The site used to be a
   neon CRT terminal, which meant someone who downloaded it arrived somewhere
   that looked like a different product. Tokens below are lifted from the app's
   own SeoulTheme (Seoulvivor/Core/DesignSystem.swift) so the two agree.

   Motion follows the rules this was refactored against: nothing over 300ms,
   custom easing only, transform and opacity only, and movement removed — not
   all animation — under prefers-reduced-motion.
   ========================================================================== */

:root {
  /* SeoulTheme, light */
  --paper:        #F2F2F5;  /* paperSand  */
  --card:         #FFFFFF;  /* cardSolid  */
  --ink:          #1C1C1E;  /* inkCarbon  */
  --ink-soft:     #56565f;
  --ink-faint:    #8b8b96;
  --rule:         #dcdce3;
  --stamp-blue:   #0D47A1;
  --stamp-red:    #7E0B0B;
  --stamp-green:  #1B5E20;
  --accent-wash:  #eaeff8;

  /* Emil's curves. Never the built-in keywords, never ease-in. */
  --ease-out:     cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out:  cubic-bezier(0.77, 0, 0.175, 1);

  --press:        160ms;
  --enter:        220ms;

  --measure:      68ch;

  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
          "Malgun Gothic", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121214; --card: #1C1C1E; --ink: #F5F5F7;
    --ink-soft: #a6a6b0; --ink-faint: #75757f;
    --rule: #33333a;
    --stamp-blue: #64B5F6; --stamp-red: #FF5252; --stamp-green: #81C784;
    --accent-wash: #17202b;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* --- The document sheet every page sits on ------------------------------- */

.sheet {
  max-width: 54rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1.1rem, 5vw, 2.5rem) 6rem;
}

/* --- Type ---------------------------------------------------------------- */

h1, h2, h3 { text-wrap: balance; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem); font-weight: 800; line-height: 1.08; }
h2 { font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.6rem); font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }

p, li { max-width: var(--measure); }
p { margin: 0 0 1rem; }

a { color: var(--stamp-blue); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 700; }

/* The label idiom the app uses everywhere: mono, uppercase, tracked out. */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.75rem;
}

.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: var(--measure); }

/* --- Masthead: an arrival card ------------------------------------------- */

.masthead {
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 1.25rem;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.masthead .bureau {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--stamp-blue);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* --- Cards --------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
}

.card--quiet { border: 1px solid var(--rule); border-radius: 12px; }

/* --- Sections ------------------------------------------------------------ */

section { margin-top: 3rem; }
section > h2 { padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.1rem; }

/* Numbered clauses, for the legal pages. */
ol.clauses { list-style: none; margin: 0; padding: 0; counter-reset: clause; }
ol.clauses > li { counter-increment: clause; margin: 0 0 2rem; max-width: none; }
ol.clauses > li > h2 { margin-bottom: 0.85rem; }
ol.clauses > li > h2::before {
  content: counter(clause) ". ";
  font-family: var(--mono);
  color: var(--ink-faint);
  font-weight: 700;
}
/* The Korean half of a bilingual heading, one step quieter than the English. */
.ko { color: var(--ink-faint); font-weight: 600; }

dl.faq { margin: 0; }
dl.faq dt { font-weight: 700; margin-top: 1.6rem; }
dl.faq dd { margin: 0.4rem 0 0; color: var(--ink-soft); max-width: var(--measure); }

/* --- Stamp: the one flourish, used sparingly ----------------------------- */

.stamp {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp-red);
  border: 2px solid var(--stamp-red);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  transform: rotate(-6deg);
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.4rem;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition: transform var(--press) var(--ease-out);
}
.btn--ghost { background: transparent; color: var(--ink); }

/* Pressable things must answer the finger. 0.97 is felt, not seen. */
.btn:active { transform: scale(0.97); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); }
}

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

.colophon {
  margin-top: 4.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  align-items: center;
}
.colophon a { color: var(--ink-soft); text-decoration: none; }
.colophon a:hover { color: var(--ink); text-decoration: underline; }
.colophon .wordmark { font-weight: 800; color: var(--ink); letter-spacing: 0.18em; }

/* --- Entry motion -------------------------------------------------------- */

/* Nothing appears from nothing: 0.98, never 0. Stagger stays inside 80ms so the
   page is never waiting on itself. */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}
.rise { animation: rise var(--enter) var(--ease-out) both; }
.rise:nth-of-type(2) { animation-delay: 50ms; }
.rise:nth-of-type(3) { animation-delay: 100ms; }
.rise:nth-of-type(4) { animation-delay: 150ms; }

@media (prefers-reduced-motion: reduce) {
  /* Fewer animations, not none — the fade stays, the movement goes. */
  .rise { animation: none; opacity: 1; transform: none; }
  .btn { transition: none; }
  .btn:active, .btn:hover { transform: none; }
}

/* --- Wide content never pushes the page sideways ------------------------- */

.scroll-x { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 30rem; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint);
}

:focus-visible { outline: 2px solid var(--stamp-blue); outline-offset: 3px; border-radius: 3px; }
