/* ==========================================================================
   Design tokens
   Editorial "paper" theme, with two swappable background presets.
   The active preset + accent are set as data-attributes on <body>,
   driven by _data/theme.yml (see _layouts/default.html).
   ========================================================================== */

:root {
  /* type
     Fraunces/Newsreader/Inter have no Hangul glyphs, so Korean text falls
     through to the next font in each stack: Nanum Myeongjo for the serif
     stacks, Pretendard for the sans (UI) stack. */
  --font-display: "Fraunces", "Nanum Myeongjo", "Iowan Old Style", "Palatino Linotype", serif;
  --font-serif: "Newsreader", "Nanum Myeongjo", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* spacing / shape */
  --measure: 34rem;
  --measure-wide: 46rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 2px;

  /* accent palette — used to color-code categories independent of theme */
  --accent-rust: #b0432c;
  --accent-ochre: #866016;   /* 4.96:1 on paper-cream (was #a6791f, 3.4:1) */
  --accent-moss: #59713f;
  --accent-plum: #6c4a6e;
  --accent-inkblue: #2f4858;
}

/* -- paper-cream (default) -------------------------------------------- */
body,
body[data-bg="paper-cream"] {
  --bg: #f5efe4;
  --bg-alt: #ece2cd;
  --card: #faf6ee;
  --ink: #221f1a;
  --ink-muted: #6b6255;
  --rule: #d9cdb4;
  --accent: var(--accent-rust);
  --accent-ink: #fbf3ea;
  --shadow: 0 1px 0 rgba(34, 31, 26, 0.06);
}

/* -- linen-gray ---------------------------------------------------------- */
body[data-bg="linen-gray"] {
  --bg: #eae7de;
  --bg-alt: #dcd7c9;
  --card: #f3f1e9;
  --ink: #24231f;
  --ink-muted: #6a6759;
  --rule: #cac4b0;
  --accent: var(--accent-inkblue);
  --accent-ink: #f4f2ea;
  --shadow: 0 1px 0 rgba(36, 35, 31, 0.06);
}

/* -- midnight (dark) ------------------------------------------------------ */
body[data-bg="midnight"] {
  --bg: #1b1815;
  --bg-alt: #242019;
  --card: #211d18;
  --ink: #ece4d3;
  --ink-muted: #a89d89;
  --rule: #3b352b;
  --accent: #e0824f;
  --accent-ink: #1b1815;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Korean breaks between words, not between syllables */
:lang(ko) {
  word-break: keep-all;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ==========================================================================
   Base typography
   ========================================================================== */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.lede {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

pre {
  background: var(--bg-alt);
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--gutter);
}
