:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-strong: #eef7fb;
  --ink: #142033;
  --muted: #5e6b7d;
  --line: #dce6ef;
  --blue: #0b72c9;
  --cyan: #00a7d8;
  --green: #19a974;
  --code-bg: #101824;
  --shadow: 0 18px 42px rgba(20, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans KR", "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 6px 18px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: white;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.search-shell {
  position: relative;
  margin: 8px 6px 18px;
}

.search-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  font: inherit;
}

.search-results {
  position: absolute;
  z-index: 4;
  top: 66px;
  left: 0;
  right: 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.search-results a,
.search-results p {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.search-results a:hover {
  background: var(--surface-strong);
}

.search-results span {
  color: var(--muted);
  font-size: 12px;
}

.toc {
  display: grid;
  gap: 10px;
}

.toc-group {
  border: 1px solid transparent;
  border-radius: 8px;
}

.toc-group[open] {
  border-color: var(--line);
  background: #fbfdff;
}

.toc-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  color: #26364a;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  list-style: none;
}

.toc-group summary::-webkit-details-marker {
  display: none;
}

.toc-group summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--blue);
  font-weight: 900;
}

.toc-group[open] summary::before {
  content: "-";
}

.toc-group summary span {
  flex: 1;
}

.toc-group summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.toc-links {
  display: grid;
  gap: 2px;
  padding: 0 6px 8px 30px;
}

.toc-links a {
  display: grid;
  gap: 1px;
  padding: 7px 9px;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  text-decoration: none;
  color: #33445a;
  font-size: 13px;
}

.toc-links a span {
  font-weight: 700;
}

.toc-links a small {
  color: var(--muted);
  font-size: 11px;
}

.toc-links a:hover,
.toc-links a.active {
  border-left-color: var(--cyan);
  background: var(--surface-strong);
  color: #075caa;
}

.toc-links a.active small {
  color: #276893;
}

.mobile-toc .doc-card-grid {
  margin-top: 12px;
}

.mobile-toc h2 {
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
  color: #21344b;
}

.content {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.8fr);
  gap: 34px;
  align-items: center;
  min-height: 64vh;
  padding: 58px clamp(22px, 5vw, 74px) 36px;
  background: linear-gradient(135deg, #ffffff 0%, #e9f9fd 55%, #eaf4ff 100%);
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  margin: 22px 0 0;
  max-width: 680px;
  color: #33445a;
  font-size: clamp(17px, 2vw, 21px);
}

.hero img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
}

.primary-action {
  background: var(--blue);
  color: white;
}

.secondary-action {
  border: 1px solid #a8c1d8;
  background: rgba(255, 255, 255, 0.7);
  color: #164268;
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 22px clamp(22px, 5vw, 74px);
  background: #142033;
  color: white;
}

.overview article {
  min-height: 112px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.overview strong,
.overview span {
  display: block;
}

.overview span {
  margin-top: 8px;
  color: #d7e6f2;
  font-size: 14px;
}

.docs-index,
.mobile-toc {
  padding: 34px clamp(22px, 5vw, 74px) 70px;
}

.docs-index header h2,
.mobile-toc h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: 0;
}

.mobile-toc {
  padding-top: 0;
}

.mobile-toc section + section {
  margin-top: 34px;
}

.doc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.doc-card {
  display: grid;
  align-content: start;
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(20, 32, 51, 0.05);
}

.doc-card:hover {
  border-color: #9ccbe5;
  transform: translateY(-1px);
}

.doc-card span {
  width: fit-content;
  border-radius: 8px;
  background: #e8f7ed;
  color: #116747;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.doc-card strong {
  margin-top: 14px;
  font-size: 18px;
}

.doc-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.doc-page {
  max-width: 1180px;
  padding: 42px clamp(22px, 5vw, 74px) 70px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
}

.doc-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
}

.doc-header h1 {
  margin-top: 12px;
  max-width: 900px;
}

.doc-level {
  display: inline-flex;
  width: fit-content;
  border-radius: 8px;
  background: #e8f7ed;
  color: #116747;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.doc-summary {
  margin: 16px 0 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 18px;
}

.doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.52fr);
  gap: 28px;
  margin-top: 26px;
}

.doc-body {
  min-width: 0;
}

.doc-body section {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.doc-body h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: #10243c;
  font-size: 24px;
  letter-spacing: 0;
}

.doc-body h2::before {
  content: "";
  width: 7px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--cyan), var(--green));
}

.doc-body p {
  margin: 0;
  color: #35465c;
}

.doc-body p + p {
  margin-top: 12px;
}

.doc-body ul {
  margin: 0;
  padding-left: 21px;
}

.doc-body li + li {
  margin-top: 7px;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.primer-section {
  border-bottom: 0;
  padding: 26px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(20, 32, 51, 0.05);
}

.concept-section {
  border-bottom: 0;
}

.concept-list {
  display: grid;
  gap: 14px;
}

.concept-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.concept-item h3 {
  margin: 0 0 8px;
  color: #142033;
  font-size: 19px;
}

.concept-item p + p {
  margin-top: 10px;
}

.concept-item strong {
  color: #123c63;
}

.depth-section,
.example-section,
.note-section {
  background: linear-gradient(180deg, #ffffff, #f8fbfe);
}

.code-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  overflow: hidden;
  border-radius: 8px;
  background: var(--code-bg);
  color: #eef7ff;
}

.code-panel strong {
  display: block;
  padding: 12px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #9bdfff;
  font-size: 13px;
}

pre {
  margin: 0;
  overflow: auto;
  padding: 16px;
}

.wide-code {
  margin-top: 14px;
  border-radius: 8px;
  background: var(--code-bg);
  color: #eef7ff;
}

code {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}

.checklist {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.checklist span {
  display: block;
  padding: 12px 14px;
  border-left: 4px solid var(--cyan);
  background: #f2fbfe;
  border-radius: 0 8px 8px 0;
}

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 32px;
}

.pager a {
  display: grid;
  gap: 3px;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-decoration: none;
}

.pager a:last-child {
  text-align: right;
}

.pager span {
  color: var(--muted);
  font-size: 12px;
}

.fallback-home {
  padding: 40px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero img {
    max-height: 420px;
  }

  .overview {
    grid-template-columns: 1fr;
  }

  .code-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding: 18px 14px;
  }

  .toc {
    grid-template-columns: 1fr;
  }

  .hero,
  .doc-page,
  .docs-index,
  .mobile-toc {
    padding-left: 18px;
    padding-right: 18px;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager a:last-child {
    text-align: left;
  }
}
