/* ==========================================================================
   song-circle site — 공통 스타일
   - 모바일 우선, 라이트/다크(prefers-color-scheme) 지원
   - 색상은 :root 토큰으로만 관리
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #16191d;
  --text-muted: #5b636d;
  --text-faint: #8a929b;
  --accent: #1f5fbf;
  --accent-hover: #184c99;
  --accent-soft: #e8f0fb;
  --accent-contrast: #ffffff;
  --ok: #1a7f4b;
  --ok-soft: #e5f4ec;
  --warn: #9a5b00;
  --warn-soft: #fbf1e0;
  --todo: #b42318;
  --todo-soft: #fdecea;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --maxw: 1080px;
  --gutter: 16px;
  --header-h: 60px;
  --font: "Pretendard Variable", Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1215;
    --bg-subtle: #151a1f;
    --surface: #161b20;
    --border: #262d35;
    --border-strong: #353e48;
    --text: #e8ebee;
    --text-muted: #a2abb5;
    --text-faint: #75808b;
    --accent: #6ea4f0;
    --accent-hover: #8db8f5;
    --accent-soft: #17263a;
    --accent-contrast: #0b1320;
    --ok: #5cc98d;
    --ok-soft: #142a1f;
    --warn: #e2a64a;
    --warn-soft: #2b2112;
    --todo: #f48b80;
    --todo-soft: #2e1714;
    --shadow: none;
  }
}

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

html { scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding-left: 1.2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-contrast); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 12px; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.nav-toggle, .lang-toggle {
  font: inherit; font-size: .875rem; color: var(--text); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; min-height: 36px;
}
.nav-toggle:hover, .lang-toggle:hover { border-color: var(--border-strong); }
.site-nav { display: none; }
.site-nav.open {
  display: block; position: absolute; top: var(--header-h); left: 0; right: 0;
  background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px var(--gutter) 16px;
}
.site-nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.site-nav a { display: block; padding: 10px 4px; color: var(--text-muted); font-size: .95rem; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .site-nav, .site-nav.open { display: block; position: static; border: 0; padding: 0; background: none; }
  .site-nav ul { flex-direction: row; gap: 4px; }
  .site-nav a { padding: 6px 10px; }
}

/* ---------- Sections ---------- */
main { display: block; }
.section { padding: 56px 0; border-top: 1px solid var(--border); }
.section:first-child { border-top: 0; }
.section-alt { background: var(--bg-subtle); }
.section-head { margin-bottom: 28px; }
.section-eyebrow { font-family: var(--mono); font-size: .8rem; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.section-title { font-size: 1.6rem; }
.section-desc { color: var(--text-muted); max-width: 640px; margin: 0; }
@media (min-width: 768px) { .section { padding: 80px 0; } .section-title { font-size: 1.9rem; } }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 56px; }
.hero-name { font-size: 2.25rem; font-weight: 800; margin-bottom: 12px; }
.hero-tagline { font-size: 1.125rem; color: var(--text-muted); max-width: 680px; margin-bottom: 8px; }
.hero-sub { color: var(--text-faint); font-size: .95rem; max-width: 680px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 768px) { .hero { padding: 104px 0 88px; } .hero-name { font-size: 3rem; } .hero-tagline { font-size: 1.3rem; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background-color .15s, border-color .15s;
}
.btn:hover { text-decoration: none; border-color: var(--text-faint); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .85rem; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Grid & Cards ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0;
}
.card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: .95rem; }
.card .card-foot { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card-num { font-family: var(--mono); font-size: .8rem; color: var(--text-faint); margin-bottom: 10px; }
.card-tags, .tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; }
.tag { font-family: var(--mono); font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--bg-subtle); border: 1px solid var(--border); color: var(--text-muted); }
.card-media { margin: -20px -20px 16px; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; aspect-ratio: 16 / 9; background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: .85rem; }
.channel .icon { width: 24px; height: 24px; color: var(--text-faint); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-shot { aspect-ratio: 16 / 10; }
.card-media-shot img { object-position: top left; }
.shot-full { margin: 0 0 28px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.shot-full img { width: 100%; }
a.card { color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-dev { color: var(--warn); background: var(--warn-soft); }
.badge-released { color: var(--ok); background: var(--ok-soft); }
.badge-recent { color: var(--accent); background: var(--accent-soft); }
.badges { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.badge-soon { color: var(--text-muted); background: var(--bg-subtle); border: 1px solid var(--border); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.card-top h3 { margin: 0; }

/* 로컬에서만 보이는 TODO 표시 (배포 사이트에서는 숨김) */
.todo { display: none; }
.is-dev .todo { display: inline-block; font-family: var(--mono); font-size: .72rem; color: var(--todo); background: var(--todo-soft); border: 1px dashed var(--todo); border-radius: 4px; padding: 1px 6px; margin: 2px 0; }

/* ---------- Pager ---------- */
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.pager:empty { display: none; }
.pager-btn { font: inherit; font-size: .9rem; min-width: 40px; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.pager-btn:hover:not([disabled]) { border-color: var(--border-strong); color: var(--text); }
.pager-btn[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.pager-btn[disabled] { opacity: .4; cursor: default; }

/* ---------- Process ---------- */
.process { margin-top: 40px; }
.process-title { font-size: 1.15rem; margin-bottom: 14px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.steps li::before { content: "0" counter(step); display: block; font-family: var(--mono); font-size: .8rem; color: var(--accent); margin-bottom: 6px; }
.steps strong { display: block; margin-bottom: 4px; }
.steps p { margin: 0; color: var(--text-muted); font-size: .92rem; }
.process-note { margin: 14px 0 0; color: var(--text-muted); font-size: .92rem; }
.process-note:empty { display: none; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-left: 32px; padding-bottom: 28px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border-strong); }
.tl-item.current::before { border-color: var(--accent); background: var(--accent-soft); }
.tl-meta { font-family: var(--mono); font-size: .8rem; color: var(--text-faint); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tl-title { font-size: 1.1rem; margin: 2px 0 2px; }
.tl-org { color: var(--text-muted); font-size: .95rem; margin-bottom: 10px; }
.tl-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.tl-body ul { color: var(--text-muted); font-size: .95rem; }
.tl-body li + li { margin-top: 4px; }
.tl-body .tags { margin: 12px 0 0; }
.tl-org strong { color: var(--text); font-weight: 600; }
.tl-domain { display: block; font-size: .85rem; color: var(--text-faint); }
.tl-proj + .tl-proj, .tl-body > ul + .tl-proj { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.tl-proj h4 { font-size: .98rem; margin: 0 0 6px; }
.tl-proj-role { font-weight: 400; font-size: .82rem; color: var(--text-faint); margin-left: 4px; }
.education { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.edu-title { font-size: 1.05rem; margin-bottom: 8px; }
.edu-item { color: var(--text-muted); margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.edu-item strong { color: var(--text); }

/* ---------- Skills ---------- */
.skills { display: grid; gap: 0; grid-template-columns: 1fr; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.skill { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 14px 18px; border-top: 1px solid var(--border); }
.skill:first-child { border-top: 0; }
.skill-name { font-weight: 700; font-family: var(--mono); font-size: .95rem; }
.skill-use { color: var(--text-muted); font-size: .95rem; }
@media (min-width: 640px) { .skill { grid-template-columns: 180px 1fr; gap: 16px; align-items: baseline; } }

/* ---------- Contact ---------- */
.contact-wrap { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .contact-wrap { grid-template-columns: 300px 1fr; gap: 40px; } }
.contact-aside p { color: var(--text-muted); }
.contact-email { font-family: var(--mono); font-size: 1rem; word-break: break-all; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { font: inherit; font-weight: 600; font-size: .95rem; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); padding: 10px 14px; cursor: pointer; margin-bottom: -1px; min-height: 44px; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel[hidden] { display: none; }
.form { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form { grid-template-columns: 1fr 1fr; } .form .full { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: .875rem; font-weight: 600; }
.field .opt { font-weight: 400; color: var(--text-faint); }
.field input, .field select, .field textarea {
  font: inherit; font-size: 1rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-height: 44px;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form-note { font-size: .85rem; color: var(--text-faint); margin: 0; }
.form-status { font-size: .9rem; margin: 0; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--todo); }
.hp { position: absolute; left: -9999px; }

.hero-status { margin: 0 0 14px; }
.resume-links { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 20px; }
.form-intro { margin: 0 0 20px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--text); font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 36px 0; color: var(--text-muted); font-size: .9rem; background: var(--bg-subtle); }
.footer-grid { display: flex; flex-direction: column; gap: 16px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 0; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
@media (min-width: 768px) { .footer-grid { flex-direction: row; justify-content: space-between; align-items: center; } }

/* ---------- Sub pages (게임·프로젝트·문서) ---------- */
.page-head { padding: 48px 0 28px; }
.breadcrumb { font-size: .85rem; color: var(--text-faint); margin-bottom: 12px; }
.breadcrumb a { color: var(--text-muted); }
.page-title { font-size: 2rem; margin-bottom: 8px; }
.page-lead { color: var(--text-muted); font-size: 1.08rem; max-width: 720px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.page-body { padding: 8px 0 72px; }
.prose { max-width: 760px; }
.prose h2 { font-size: 1.3rem; margin-top: 2em; padding-top: .5em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text-muted); }
.prose li + li { margin-top: 4px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 0 0 1em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-subtle); color: var(--text); font-weight: 600; }
.shots { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 0 0 24px; }
@media (min-width: 640px) { .shots { grid-template-columns: repeat(2, 1fr); } }
.shot { aspect-ratio: 16 / 9; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: .85rem; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.link-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 32px; }
.empty { color: var(--text-faint); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center; }
.notfound { padding: 96px 0; text-align: center; }
.notfound .code { font-family: var(--mono); color: var(--text-faint); font-size: 1rem; margin-bottom: 8px; }
