/* CheekPouch docs — vanilla CSS, zero external deps */

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

/* ─── Tokens ─── */
:root {
  /* Color — light mode (paper/walnut/cheek-pouch warm tones) */
  --bg:           #ECE3D3;
  --bg-paper:     #FBF7F0;
  --bg-elev:      #FFFFFF;
  --ink:          #1F1812;
  --ink-2:        #6B5D4A;
  --ink-3:        #A8997F;
  --ink-4:        #C7B89C;
  --line:         rgba(60, 42, 20, 0.09);
  --line-strong:  rgba(60, 42, 20, 0.16);
  --accent:       #8B6F47;  /* walnut, primary */
  --accent-soft:  rgba(139, 111, 71, 0.12);
  --danger:       #B5483C;
  --shadow-card:  0 1px 2px rgba(31, 24, 18, 0.04), 0 4px 14px rgba(31, 24, 18, 0.06);
  --shadow-pop:   0 8px 32px rgba(31, 24, 18, 0.18);

  /* Type */
  --font-sans:
    -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕",
    system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Spacing & radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #1A1510;
    --bg-paper:     #25201A;
    --bg-elev:      #2E2820;
    --ink:          #ECE3D3;
    --ink-2:        #B8AC95;
    --ink-3:        #847765;
    --ink-4:        #5C5448;
    --line:         rgba(236, 227, 211, 0.08);
    --line-strong:  rgba(236, 227, 211, 0.18);
    --accent:       #C5A07A;
    --accent-soft:  rgba(197, 160, 122, 0.16);
    --danger:       #E07060;
    --shadow-card:  0 1px 2px rgba(0,0,0,0.20), 0 4px 14px rgba(0,0,0,0.30);
    --shadow-pop:   0 8px 32px rgba(0,0,0,0.50);
  }
}

/* ─── Base ─── */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 32px) 80px;
}

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.25; margin: 0; }
h1 { font-size: clamp(28px, 4.4vw, 40px); font-weight: 700; }
h2 { font-size: clamp(22px, 3.2vw, 28px); font-weight: 700; margin-top: 48px; margin-bottom: 16px; }
h3 { font-size: clamp(17px, 2.4vw, 20px); font-weight: 600; margin-top: 28px; margin-bottom: 10px; }
h4 { font-size: 15px; font-weight: 600; margin-top: 18px; margin-bottom: 6px; }
p  { margin: 10px 0; }
small, .small { font-size: 12.5px; color: var(--ink-3); }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: var(--accent); }

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
pre { padding: 14px 16px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; }

hr { border: none; border-top: 0.5px solid var(--line-strong); margin: 32px 0; }

ul, ol { padding-left: 22px; margin: 8px 0; }
li { margin: 4px 0; }

table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 0.5px solid var(--line); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; background: var(--accent-soft); }
tbody tr:hover { background: var(--accent-soft); }

blockquote {
  margin: 14px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-paper);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--ink-2);
}

/* ─── Header ─── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 8px;
  border-bottom: 0.5px solid var(--line);
  margin-bottom: 24px;
}
.site-header .brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px;
}
.site-header .brand .dot {
  width: 22px; height: 22px; border-radius: var(--r-pill);
  background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  color: #FFF; font-size: 11px; font-weight: 700;
}
.site-header nav {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.site-header nav a {
  padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 500;
  border-bottom: none;
}
.site-header nav a:hover { background: var(--accent-soft); }
.site-header nav a.active { background: var(--ink); color: var(--bg-paper); }

/* ─── Card (generic) ─── */
.card {
  background: var(--bg-paper);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card-grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Hub card */
.hub-card {
  display: block;
  background: var(--bg-paper);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  border-bottom: 0.5px solid var(--line); /* override <a> default */
}
.hub-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
  border-color: var(--accent);
}
.hub-card .h {
  font-size: 18px; font-weight: 700; margin-bottom: 6px;
}
.hub-card .d {
  font-size: 13.5px; color: var(--ink-2); line-height: 1.5;
}
.hub-card .arrow {
  position: absolute; top: 22px; right: 22px;
  color: var(--ink-3);
}

/* ─── Chip / Pill ─── */
.chip, .pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 12.5px; font-weight: 500;
  border: 0.5px solid transparent;
  white-space: nowrap;
}
.chip.outline, .pill.outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.chip.solid, .pill.solid {
  background: var(--ink);
  color: var(--bg-paper);
}
.chip.danger { background: rgba(181, 72, 60, 0.12); color: var(--danger); }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Kanban (features.html) ─── */
.kanban {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 24px;
}
.kanban .col {
  background: var(--bg-paper);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  min-height: 200px;
}
.kanban .col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 0.5px solid var(--line);
}
.kanban .col-head .count {
  font-size: 12px; color: var(--ink-3); font-weight: 600;
  background: var(--accent-soft);
  padding: 2px 8px; border-radius: var(--r-pill);
}

.feature {
  background: var(--bg-elev);
  border: 0.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.feature .id {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.feature .title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  margin: 2px 0 6px;
  line-height: 1.35;
}
.feature .meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-3);
  margin-top: 6px;
}
.feature details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px dashed var(--line-strong);
}
.feature summary {
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; list-style: none;
}
.feature summary::-webkit-details-marker { display: none; }
.feature summary::before {
  content: "▸ ";
  display: inline-block; transition: transform 0.15s ease;
}
.feature details[open] summary::before { content: "▾ "; }

/* col tints */
.col-todo  .col-head { color: var(--ink-2); }
.col-doing .col-head { color: var(--accent); }
.col-done  .col-head { color: #4A6B4F; }
.col-done  .feature  { opacity: 0.72; }

/* ─── Tree (menu navigation) ─── */
.tree {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-paper);
  border: 0.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  margin: 18px 0;
  overflow-x: auto;
}
.tree ul {
  list-style: none;
  padding-left: 18px;
  margin: 0;
  position: relative;
}
.tree > ul { padding-left: 0; }
.tree li {
  position: relative;
  padding: 2px 0 2px 18px;
  margin: 0;
}
.tree ul ul li::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 50%;
  width: 12px;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.tree ul ul li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0; top: 50%; bottom: 0;
  border-left: 1px solid var(--line-strong);
}
.tree a {
  border-bottom: none;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
}
.tree a:hover { background: var(--accent-soft); color: var(--accent); }
.tree .node-target {
  background: var(--accent);
  color: var(--bg-paper);
  transition: background 0.6s ease;
}

/* ─── ToC sticky ─── */
.layout-toc {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
}
.toc {
  position: sticky;
  top: 24px;
  align-self: start;
  font-size: 13px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 2px 0; }
.toc a {
  display: block;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  border-bottom: none;
}
.toc a:hover { background: var(--accent-soft); color: var(--ink); }
.toc a.indent { padding-left: 22px; font-size: 12.5px; }
@media (max-width: 720px) {
  .layout-toc { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
}

/* ─── Screen card (ux.html, screen-catalog.html) ─── */
.screen {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  background: var(--bg-paper);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  margin: 16px 0;
  scroll-margin-top: 80px;
}
.screen .shot {
  background: var(--bg-elev);
  border: 0.5px solid var(--line);
  border-radius: var(--r-md);
  aspect-ratio: 9 / 19.5;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
}
.screen .shot img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.screen .shot.missing {
  color: var(--ink-3);
  font-size: 12px;
  background:
    repeating-linear-gradient(45deg,
      var(--bg-elev) 0 8px,
      var(--accent-soft) 8px 16px);
  text-align: center; padding: 12px;
  cursor: default;
  word-break: break-all;
}

/* Lightbox for screenshot zoom */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  border-radius: 8px;
}
.screen .meta { min-width: 0; }
.screen .meta .id {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.screen .meta .title { font-size: 18px; font-weight: 700; margin: 2px 0 8px; }
.screen .meta .desc { font-size: 13.5px; color: var(--ink-2); margin-bottom: 12px; }
@media (max-width: 640px) {
  .screen { grid-template-columns: 1fr; }
  .screen .shot { max-width: 220px; }
}

/* Tone comparison */
.tone-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.tone-pair > div {
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
}
.tone-pair .bad {
  background: rgba(181, 72, 60, 0.08);
  border: 0.5px solid rgba(181, 72, 60, 0.30);
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: rgba(181, 72, 60, 0.45);
}
.tone-pair .good {
  background: rgba(74, 107, 79, 0.10);
  border: 0.5px solid rgba(74, 107, 79, 0.30);
  color: #4A6B4F;
}
@media (prefers-color-scheme: dark) {
  .tone-pair .good { color: #85A883; }
}

/* Quote-style sample */
.copy-sample {
  padding: 12px 16px;
  background: var(--bg-paper);
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: 14px;
  margin: 8px 0;
}
.copy-sample .ctx { font-size: 11px; color: var(--ink-3); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 4px; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 0.5px solid transparent;
}
.badge.v10 { background: var(--accent-soft); color: var(--accent); }
.badge.v11 { background: rgba(60, 42, 20, 0.08); color: var(--ink-2); }
.badge.todo  { background: rgba(60, 42, 20, 0.08); color: var(--ink-2); }
.badge.doing { background: var(--accent-soft); color: var(--accent); }
.badge.done  { background: rgba(74, 107, 79, 0.16); color: #4A6B4F; }

/* Footer */
.site-footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 0.5px solid var(--line);
  color: var(--ink-3);
  font-size: 12.5px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
