:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-strong: #eef1f5;
  --text: #111827;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .12);
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, .12);
  --warm: #b45309;
  --code-bg: #2f3742;
  --code-text: #f8fafc;
  --shadow: 0 14px 34px rgba(15, 23, 42, .07);
  --radius: 8px;
  --max: 1040px;
  --page-max: 1500px;
  --right-rail: 300px;
  --layout-gap: 30px;
  --bookmark-size: 12px;
}

:root[data-theme="dark-gray"] {
  --bg: #202124;
  --surface: #2a2c30;
  --surface-strong: #34373d;
  --text: #f3f4f6;
  --muted: #c4cad4;
  --line: rgba(255, 255, 255, .14);
  --accent: #d1d5db;
  --accent-soft: rgba(209, 213, 219, .12);
  --warm: #fbbf24;
  --code-bg: #f3f4f6;
  --code-text: #111827;
  --shadow: 0 16px 38px rgba(0, 0, 0, .28);
}

:root[data-theme="dark"] {
  --bg: #0b0c0f;
  --surface: #12141a;
  --surface-strong: #1b2029;
  --text: #e8eaf0;
  --muted: #a8afc0;
  --line: rgba(255, 255, 255, .12);
  --accent: #d1d5db;
  --accent-soft: rgba(209, 213, 219, .12);
  --warm: #fbbf24;
  --code-bg: #f8fafc;
  --code-text: #111827;
  --shadow: 0 16px 42px rgba(0, 0, 0, .34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Segoe UI", Arial, sans-serif;
  line-height: 1.78;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  opacity: .88;
}

code {
  padding: .12em .34em;
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  color: var(--text);
  font-size: .92em;
}

pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.container {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto;
}

.skip {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 999;
  background: var(--surface);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--right-rail);
  column-gap: var(--layout-gap);
  width: min(var(--page-max), 100%);
  margin: 0 auto;
  min-height: 100vh;
}

.layout > * {
  min-width: 0;
}

.sidebar {
  grid-column: 2;
  grid-row: 1;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 74%, var(--bg));
  padding: 18px 18px 18px 22px;
}

.sidebar-card {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  min-height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  padding: 16px;
}

.section-bookmark {
  display: grid;
  gap: 12px;
}

.bookmark-status {
  display: grid;
  gap: 4px;
}

.bookmark-eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.bookmark-status strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.bookmark-list {
  display: grid;
  gap: 5px;
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-right: 5px;
}

.bookmark-link {
  display: block;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--bookmark-size);
  font-weight: 670;
  line-height: 1.3;
}

.bookmark-link:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.bookmark-link.active {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--surface-strong) 74%, var(--bg));
  color: var(--text);
}

.avatar-wrap {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface);
}

.who {
  margin-bottom: 12px;
}

.name {
  font-weight: 800;
}

.tagline {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.info {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin: 12px 0;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
}

.label,
.muted {
  color: var(--muted);
}

.value {
  text-align: right;
}

.value a,
.text-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.tiny {
  font-size: 12px;
}

.content {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brandline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-profile {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}

.home-profile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brandtext {
  font-weight: 750;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

#themeIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 18px;
  line-height: 1;
}

.article {
  padding-bottom: 54px;
}

.hero {
  padding: 54px 0 22px;
}

.hero h1 {
  margin: 0;
  max-width: 860px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.18;
  letter-spacing: 0;
}

.sub {
  max-width: 860px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-tags {
  margin: 0 0 8px;
  color: color-mix(in srgb, var(--muted) 86%, var(--bg));
  font-size: 13px;
  font-weight: 560;
  line-height: 1.6;
}

.media-section {
  width: min(840px, 100%);
  margin: 14px auto 34px;
}

.hero-video {
  display: block;
  width: 100%;
  aspect-ratio: 1080 / 701;
  object-fit: contain;
  background: #0b0c0f;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.caption,
figcaption {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.section {
  padding: 34px 0;
  border-top: 1px solid var(--line);
}

.section h2 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

.section p {
  margin: 0 0 16px;
}

.section p:last-child {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 0;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.goal-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px;
}

.goal-item strong {
  display: block;
  margin-bottom: 8px;
}

.goal-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.spec-table,
.metric-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.metric-table {
  table-layout: fixed;
}

.spec-table th,
.spec-table td,
.metric-table th,
.metric-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.spec-table tr:last-child th,
.spec-table tr:last-child td,
.metric-table tr:last-child td {
  border-bottom: 0;
}

.spec-table th {
  width: 190px;
  color: var(--muted);
  font-weight: 700;
}

.metric-table thead th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
}

.metric-table th,
.metric-table td {
  text-align: center;
  vertical-align: middle;
}

.metric-table th:first-child,
.metric-table td:first-child {
  width: 28%;
  text-align: left;
}

.metric-table th:not(:first-child),
.metric-table td:not(:first-child) {
  width: 18%;
}

.metric-table tbody td {
  font-variant-numeric: tabular-nums;
}

.secondary-metric {
  margin-top: 12px;
}

.note {
  border-left: 4px solid var(--warm);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 20px 0;
}

.note strong {
  display: block;
  margin-bottom: 10px;
}

.code,
.note pre {
  margin: 16px 0;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  padding: 16px;
  line-height: 1.55;
  font-size: 14px;
}

.note pre {
  margin: 0;
}

.flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.flow > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}

.flow-label {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 780;
}

.flow p {
  margin: 0;
  color: var(--muted);
}

.plot-grid {
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 20px auto 0;
}

.plot-grid figure {
  margin: 0;
  width: min(380px, 100%);
  justify-self: center;
}

.plot-grid .wide-plot {
  grid-column: 1 / -1;
  width: min(760px, 100%);
}

.plot-grid img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: zoom-in;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

.btn.small {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
}

.repo-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.repo-card:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.repo-card img {
  width: 100%;
  height: 100%;
  min-height: 132px;
  object-fit: cover;
  border-right: 1px solid var(--line);
  background: #0b0c0f;
}

.repo-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 16px 16px 16px 0;
}

.repo-body strong {
  font-size: 18px;
  line-height: 1.3;
}

.repo-body span {
  color: var(--muted);
  line-height: 1.55;
}

.repo-body small {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.footer .container {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 24px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, .86);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: min(94vw, 1280px);
  max-height: 90vh;
  border-radius: var(--radius);
  background: #fff;
}

.lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(0, 0, 0, .46);
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 1120px) {
  .goal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .layout {
    display: block;
    width: 100%;
  }

  .sidebar {
    display: none;
  }
}

@media (max-width: 720px) {
  .container,
  .topbar-inner {
    width: min(100% - 28px, var(--max));
  }

  .hero {
    padding-top: 38px;
  }

  .sub {
    font-size: 16px;
  }

  .goal-grid,
  .flow,
  .plot-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .spec-table,
  .metric-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .spec-table th,
  .spec-table td,
  .metric-table th,
  .metric-table td {
    padding: 11px 12px;
  }

  .repo-card {
    grid-template-columns: 1fr;
  }

  .repo-card img {
    height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .repo-body {
    padding: 0 16px 16px;
  }
}
