/* Palette taken from the profile picture: violet night, neon purple,
   heart pink, crown yellow, and the checkered sleeve.
   Spacing follows a 4px scale (Primer); every pair of text/background
   colors below meets WCAG 2.2 AA contrast. See REFERENCES.md. */

:root {
  --bg: #0f0a1a;
  --bg-dots: #2a1f40;
  --surface: #181026;
  --surface-2: #211736;
  --border: #33264d;
  --text: #ede7f8;
  --muted: #b0a3cb;
  --accent: #c08cff;
  --accent-ink: #1a0f2e;
  --pink: #ff6fae;
  --yellow: #ffd166;
  --shadow: #7c3aed;
  --focus: #ffd166;

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --pixel: Galmuri11, "Pretendard Variable", monospace;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 40px; --s8: 48px; --s9: 64px;
  --radius: 10px;
  --wrap: 1040px;
  color-scheme: dark;
}

/* Light theme: chosen explicitly, or by the system when on "auto". */
:root[data-theme="light"] {
  --bg: #faf7ff;
  --bg-dots: #e6dcf7;
  --surface: #ffffff;
  --surface-2: #f3edfd;
  --border: #ddd1f2;
  --text: #1b1530;
  --muted: #574b72;
  --accent: #6d28d9;
  --accent-ink: #ffffff;
  --pink: #c2185b;
  --yellow: #8a5a00;
  --shadow: #1b1530;
  --focus: #6d28d9;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #faf7ff;
    --bg-dots: #e6dcf7;
    --surface: #ffffff;
    --surface-2: #f3edfd;
    --border: #ddd1f2;
    --text: #1b1530;
    --muted: #574b72;
    --accent: #6d28d9;
    --accent-ink: #ffffff;
    --pink: #c2185b;
    --yellow: #8a5a00;
    --shadow: #1b1530;
    --focus: #6d28d9;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 16px 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 640px) { .wrap { padding: 0 var(--s5); } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }
.ic-lg { width: 28px; height: 28px; }

.skip {
  position: absolute; left: var(--s4); top: -100px; z-index: 20;
  background: var(--accent); color: var(--accent-ink); padding: var(--s2) var(--s3); border-radius: 6px;
}
.skip:focus { top: var(--s2); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: var(--s4); min-height: 60px; }
.mark { font-family: var(--pixel); font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: .5px; }
.mark span { color: var(--accent); }
.nav { display: none; gap: var(--s1); margin-left: var(--s3); }
.nav a { color: var(--muted); text-decoration: none; padding: var(--s2) var(--s3); border-radius: 8px; font-size: 15px; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
@media (min-width: 720px) { .nav { display: flex; } }
.controls { display: flex; gap: var(--s2); margin-left: auto; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 var(--s3);
  font: 600 13px/1 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
#tldr { font-family: var(--pixel); font-weight: 400; font-size: 12px; }

/* ---------- Hero ---------- */
.hero {
  display: grid; gap: var(--s6); align-items: center;
  padding-top: var(--s8); padding-bottom: var(--s8);
}
@media (min-width: 720px) {
  .hero { grid-template-columns: auto 1fr; gap: var(--s7); padding-top: var(--s9); padding-bottom: var(--s9); }
}
.avatar-wrap { position: relative; width: 160px; justify-self: start; }
.avatar {
  display: block; width: 160px; height: 160px; border-radius: 22px;
  border: 3px solid var(--text);
  box-shadow: 6px 6px 0 var(--shadow);
  transform: rotate(-2deg);
  background: var(--surface-2);
}
.sticker {
  position: absolute; right: -28px; bottom: -14px;
  font-family: var(--pixel); font-size: 11px; line-height: 1.2;
  background: var(--yellow); color: #1a0f2e;
  padding: 6px 8px; border: 2px solid #1a0f2e; border-radius: 6px;
  transform: rotate(4deg);
  white-space: nowrap;
}
:root[data-theme="light"] .sticker { background: #ffd166; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .sticker { background: #ffd166; } }

.kicker { font-family: var(--pixel); font-size: 13px; color: var(--pink); margin: 0 0 var(--s2); }
h1 {
  margin: 0; font-size: clamp(30px, 6vw, 48px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 800;
  overflow-wrap: anywhere;
}
.aka { margin: var(--s2) 0 0; color: var(--muted); }
.aka strong { color: var(--text); font-weight: 650; }
.tagline { margin: var(--s4) 0 0; font-size: 18px; max-width: 46ch; }

.chips { list-style: none; padding: 0; margin: var(--s4) 0 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.chips .ic { width: 14px; height: 14px; color: var(--pink); }

.links { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  font-weight: 650; text-decoration: none; color: var(--text);
  background: var(--surface); border: 2px solid var(--text); border-radius: 10px;
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow); text-decoration: none; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }

/* The checkered sleeve, as a divider. */
.checker {
  height: 16px;
  background: repeating-conic-gradient(var(--text) 0 25%, transparent 0 50%) 0 0 / 16px 16px;
  opacity: .9;
}

/* ---------- Sections ---------- */
.section { padding-top: var(--s8); padding-bottom: var(--s4); }
.section-head { margin-bottom: var(--s4); }
h2 { margin: 0; font-size: 26px; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: var(--s3); }
.pixel { font-family: var(--pixel); font-size: 14px; color: var(--accent); font-weight: 400; }
.section-head p { margin: var(--s1) 0 0; }

.filter {
  display: flex; align-items: center; gap: var(--s2);
  max-width: 420px; margin-bottom: var(--s5);
  padding: 0 var(--s3); min-height: 44px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  color: var(--muted);
}
.filter:focus-within { border-color: var(--accent); }
.filter input {
  flex: 1; min-width: 0; height: 42px; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 15px;
}

.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s4) var(--s4) var(--s3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: var(--accent); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--shadow); }
.card:focus-within { border-color: var(--accent); }
.card h3 { margin: 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible { outline: none; }
.card:has(h3 a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.card p.desc {
  margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .desc.empty { font-style: italic; opacity: .8; }
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s4);
  margin-top: auto; padding-top: var(--s2); font-size: 13px; color: var(--muted);
}
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta .ic { width: 14px; height: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgb(127 127 127 / .35); }
.home-link {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px; font-size: 13px;
}
.home-link .ic { width: 14px; height: 14px; }

.soon {
  display: flex; gap: var(--s4); align-items: flex-start;
  padding: var(--s5); border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.soon .ic { color: var(--yellow); }
.soon p { margin: 0; }
.soon-title { font-weight: 650; }

.empty-state { color: var(--muted); }
.meta .tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.all-link { margin: var(--s4) 0 0; font-weight: 650; }
[hidden] { display: none !important; }

/* ---------- Footer ---------- */
.footer { margin-top: var(--s9); border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { padding-top: var(--s5); padding-bottom: var(--s6); }
.footer p { margin: 0 0 var(--s2); }
.footer p:first-child { font-family: var(--pixel); font-size: 13px; color: var(--pink); }

/* ---------- Toast (the TL;DR joke) ---------- */
.toast {
  position: fixed; left: 50%; bottom: var(--s5); z-index: 30;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: var(--s3) var(--s4);
  font-family: var(--pixel); font-size: 13px;
  background: var(--yellow); color: #1a0f2e;
  border: 2px solid #1a0f2e; border-radius: 8px;
  box-shadow: 4px 4px 0 #1a0f2e;
}
:root[data-theme="light"] .toast { background: #ffd166; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .toast { background: #ffd166; } }
