/* SPDX-License-Identifier: Apache-2.0 */
/* RoboSoul Humanoid static site — no build step, no external resources. */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efede6;
  --text: #1b1d21;
  --muted: #545a64;
  --line: #d9d6cc;
  --accent: #0b5cad;
  --accent-ink: #ffffff;
  --accent-soft: #dbe8f6;
  --warn-bg: #fff4d6;
  --warn-line: #b7791f;
  --warn-text: #5c3b00;
  --focus: #c2410c;
  --body-fill: #e3e1d9;
  --body-line: #9a968a;
  --a-rs04: #c2410c;
  --a-rs03: #2b8a3e;
  --a-rs06: #1864ab;
  --a-rs02: #862e9c;
  --a-sts: #0b7285;
  --a-hand: #a61e4d;
  --radius: 14px;
  --maxw: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114;
    --surface: #171a1f;
    --surface-2: #1f232a;
    --text: #eceae4;
    --muted: #a8adb6;
    --line: #2e333b;
    --accent: #7db7f0;
    --accent-ink: #0b1a2a;
    --accent-soft: #1b2b3d;
    --warn-bg: #2b2210;
    --warn-line: #d69e2e;
    --warn-text: #f6deaa;
    --focus: #fb923c;
    --body-fill: #262a31;
    --body-line: #5b616b;
    --a-rs04: #ff8a4c;
    --a-rs03: #69db7c;
    --a-rs06: #74c0fc;
    --a-rs02: #da77f2;
    --a-sts: #3bc9db;
    --a-hand: #f783ac;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1114;
  --surface: #171a1f;
  --surface-2: #1f232a;
  --text: #eceae4;
  --muted: #a8adb6;
  --line: #2e333b;
  --accent: #7db7f0;
  --accent-ink: #0b1a2a;
  --accent-soft: #1b2b3d;
  --warn-bg: #2b2210;
  --warn-line: #d69e2e;
  --warn-text: #f6deaa;
  --focus: #fb923c;
  --body-fill: #262a31;
  --body-line: #5b616b;
  --a-rs04: #ff8a4c;
  --a-rs03: #69db7c;
  --a-rs06: #74c0fc;
  --a-rs02: #da77f2;
  --a-sts: #3bc9db;
  --a-hand: #f783ac;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-text-size-adjust: 100%;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: clamp(16px, 4vw, 32px); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: -0.01em; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 0.25rem 1rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { color: var(--text); text-decoration: none; font-size: 0.95rem; padding: 0.35rem 0.1rem; }
.nav a:hover { color: var(--accent); }
.nav-tools { display: flex; gap: 0.5rem; align-items: center; min-width: 0; }
.btn-ghost {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.8rem; cursor: pointer; text-decoration: none;
}
.btn-ghost:hover { border-color: var(--accent); }

@media (max-width: 760px) {
  .nav { margin-left: 0; width: 100%; order: 3; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.4rem; }
  .nav a { white-space: nowrap; }
  .nav-tools { margin-left: 0; flex-wrap: wrap; max-width: 100%; }
  .site-header .wrap { gap: 0.5rem 1rem; padding-block: 0.5rem; }
}

/* Sections */
section { padding-block: clamp(48px, 8vw, 88px); }
section + section { border-top: 1px solid var(--line); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); margin: 0 0 0.5rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.35rem; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 62ch; margin-top: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; font-weight: 700; color: var(--accent); margin: 0 0 0.4rem; }

/* Hero */
.hero { padding-block: clamp(56px, 10vw, 112px) clamp(40px, 6vw, 64px); }
.hero-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: clamp(24px, 5vw, 56px); align-items: center; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2.3rem, 7vw, 4.2rem); margin: 0 0 0.4rem; font-weight: 800; }
.hero .byline { color: var(--muted); margin: 0 0 1.4rem; }
.hero p.intro { font-size: 1.15rem; max-width: 56ch; }
.cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.4rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  padding: 0.7rem 1.15rem; border-radius: 10px; border: 1px solid var(--accent); min-height: 44px;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }

.status {
  margin-top: 1.8rem; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-text);
  border-radius: var(--radius); padding: 0.9rem 1.1rem; max-width: 70ch;
}
.status strong { display: block; margin-bottom: 0.2rem; }

.hero-figure { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1rem; }
.hero-figure figcaption { color: var(--muted); font-size: 0.85rem; text-align: center; margin-top: 0.4rem; }

/* Quote + principles */
.quote {
  margin: 1.5rem 0 2rem; padding: 1.25rem 1.5rem; border-left: 4px solid var(--accent);
  background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; max-width: 78ch;
}
.quote p { margin: 0 0 0.6rem; font-size: 1.12rem; }
.quote .translation { color: var(--muted); font-size: 1rem; }
.quote footer { color: var(--muted); font-size: 0.9rem; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card p { margin: 0; color: var(--muted); }
.tag { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); font-weight: 700; }

/* Body */
.body-grid { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: clamp(24px, 5vw, 56px); align-items: start; }
@media (max-width: 860px) { .body-grid { grid-template-columns: 1fr; } }
.body-figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1rem; width: 100%; max-width: 440px; justify-self: center; }
.body-figure svg { display: block; width: 100%; max-height: 78vh; margin-inline: auto; }
.legend { list-style: none; padding: 0; margin: 0.8rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.35rem 1rem; font-size: 0.9rem; }
.legend li { display: flex; align-items: center; gap: 0.5rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.d-rs04 { background: var(--a-rs04); } .d-rs03 { background: var(--a-rs03); } .d-rs06 { background: var(--a-rs06); }
.d-rs02 { background: var(--a-rs02); } .d-sts { background: var(--a-sts); } .d-hand { background: var(--a-hand); }

svg .silhouette { fill: var(--body-fill); stroke: var(--body-line); stroke-width: 2; }
svg .detail { fill: none; stroke: var(--body-line); stroke-width: 2; stroke-linecap: round; }
svg .eye { fill: var(--accent); }
svg .floor { stroke: var(--line); stroke-width: 2; }
svg .dim { fill: var(--muted); font: 12px var(--font); }
svg .j { stroke: var(--surface); stroke-width: 2.5; }
svg .j-rs04 { fill: var(--a-rs04); } svg .j-rs03 { fill: var(--a-rs03); } svg .j-rs06 { fill: var(--a-rs06); }
svg .j-rs02 { fill: var(--a-rs02); } svg .j-sts { fill: var(--a-sts); } svg .j-hand { fill: var(--a-hand); }

.specs { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.2rem; margin: 0; }
.specs dt { font-weight: 700; }
.specs dd { margin: 0; color: var(--muted); }
@media (max-width: 480px) { .specs { grid-template-columns: 1fr; } .specs dd { margin-bottom: 0.5rem; } }

/* Timeline */
.timeline { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; counter-reset: none; }
@media (max-width: 960px) { .timeline { grid-template-columns: 1fr; } }
.timeline li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; }
.timeline li[data-status="in_progress"] { border-color: var(--accent); box-shadow: inset 0 4px 0 var(--accent); }
.timeline .phase-id { font-family: var(--mono); font-weight: 800; color: var(--accent); }
.timeline .phase-state { display: inline-block; font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 0.05rem 0.55rem; margin-left: 0.4rem; background: var(--surface-2); color: var(--muted); }
.timeline li[data-status="in_progress"] .phase-state { background: var(--accent); color: var(--accent-ink); }
.timeline p { margin: 0.35rem 0 0; font-size: 0.93rem; color: var(--muted); }

/* Progress */
.progress-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stat .value { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: 0.9rem; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); width: 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; min-width: 620px; }
caption { text-align: left; padding: 0.8rem 1rem; color: var(--muted); font-size: 0.9rem; caption-side: bottom; }
th, td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; }
.small { font-size: 0.88rem; color: var(--muted); }

/* Books */
.books { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 1.5rem; }
.book { display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.book h3 { font-size: 1.02rem; }
.book p { margin: 0; color: var(--muted); font-size: 0.93rem; flex: 1; }
.book .btn { align-self: flex-start; }
.book.featured { border-color: var(--accent); }
.note-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; max-width: 78ch; }
.note-box blockquote { margin: 0.8rem 0; font-size: 1.15rem; font-weight: 650; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem; color: var(--muted); font-size: 0.9rem; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.site-footer h2 { font-size: 1rem; color: var(--text); }
.site-footer ul { padding-left: 1.1rem; margin: 0.4rem 0 0; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
