:root {
  color-scheme: light;
  --page: #fbfbf8;
  --surface: #ffffff;
  --surface-muted: #f4f5f1;
  --ink: #1d211f;
  --muted: #68716d;
  --quiet: #8a928e;
  --line: #dfe4df;
  --line-strong: #c8d0ca;
  --excel: #217846;
  --excel-dark: #185c37;
  --excel-soft: #e7f3eb;
  --blue: #376a8f;
  --amber: #9a6b1f;
  --red: #b54e4e;
  --code: #0f1713;
  --shadow: 0 18px 55px rgba(31, 42, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans KR",
    sans-serif;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 248, 0.88);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  color: var(--excel-dark);
  font-size: 21px;
  font-weight: 780;
}

.brand-text {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #3d4641;
  font-size: 14px;
}

.site-nav a:hover {
  color: var(--excel-dark);
}

.hero {
  width: min(1160px, calc(100% - 56px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 72px;
  align-items: end;
  min-height: 620px;
  padding: 92px 0 72px;
}

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

.kicker {
  margin: 0 0 16px;
  color: var(--excel-dark);
  font-size: 13px;
  font-weight: 720;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 24px;
  font-size: clamp(52px, 8vw, 112px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(34px, 4.4vw, 64px);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.3;
}

.lead {
  max-width: 690px;
  color: #4a534e;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.62;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: #26302a;
  font-weight: 680;
}

.button.primary {
  border-color: var(--excel);
  background: var(--excel);
  color: #ffffff;
}

.principle-list {
  border-top: 1px solid var(--line);
}

.principle-list div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.principle-list strong {
  color: var(--ink);
  font-size: 13px;
}

.principle-list span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.section-intro,
.text-grid,
.walkthrough-layout,
.stage-grid,
.code-pair {
  width: min(1160px, calc(100% - 56px));
  margin-left: auto;
  margin-right: auto;
}

.section-intro {
  margin-bottom: 36px;
}

.section-intro p:not(.kicker) {
  max-width: 760px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.walkthrough-section,
.text-section,
.conformance-section,
.use-section {
  padding: 88px 0;
  border-top: 1px solid var(--line);
}

.walkthrough-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.74fr) minmax(520px, 1.26fr);
  gap: 48px;
  align-items: start;
}

.steps {
  display: grid;
  gap: 12px;
}

.step {
  min-height: 150px;
  padding: 20px;
  border-left: 3px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.step:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.step.is-active {
  border-color: var(--excel);
  background: var(--excel-soft);
}

.step-index {
  display: block;
  margin-bottom: 14px;
  color: var(--quiet);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.step p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.preview-column {
  position: sticky;
  top: 88px;
  min-width: 0;
}

.preview-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.preview-caption span {
  color: var(--excel-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
}

.preview-caption strong {
  color: #2f3833;
  font-size: 14px;
  text-align: right;
}

.preview-notes {
  margin-top: 12px;
  min-height: 48px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.excel-window {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.excel-titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #e9f4ed, #fbfbf8);
}

.excel-titlebar strong {
  display: block;
  color: #1e2822;
  font-size: 14px;
}

.excel-titlebar small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.window-dots span:nth-child(1) {
  background: var(--red);
}

.window-dots span:nth-child(2) {
  background: var(--amber);
}

.window-dots span:nth-child(3) {
  background: var(--excel);
}

.excel-ribbon {
  display: flex;
  gap: 18px;
  min-height: 38px;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  color: #59635e;
  font-size: 12px;
  font-weight: 680;
}

.formula-bar {
  display: grid;
  grid-template-columns: 70px 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.name-box,
.fx,
.formula-text {
  min-height: 28px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #ffffff;
  font-size: 12px;
}

.name-box,
.fx {
  justify-content: center;
  color: #4f5a54;
  font-weight: 700;
}

.formula-text {
  padding: 0 9px;
  color: #26302a;
  overflow: hidden;
  white-space: nowrap;
}

.sheet-wrap {
  overflow-x: auto;
  background: #ffffff;
}

.sheet-grid {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
}

.sheet-grid th,
.sheet-grid td {
  height: 48px;
  padding: 7px 9px;
  border-right: 1px solid #dfe5e0;
  border-bottom: 1px solid #dfe5e0;
  vertical-align: middle;
  overflow: hidden;
}

.sheet-grid thead th,
.sheet-grid tbody th {
  width: 42px;
  background: #eef2ef;
  color: #68716d;
  text-align: center;
  font-weight: 680;
}

.sheet-grid thead th:not(:first-child) {
  width: 210px;
}

.sheet-grid td {
  background: #ffffff;
}

.header-cell {
  background: var(--excel-soft) !important;
  color: #123c2a;
  font-weight: 760;
}

.template-cell {
  color: var(--excel-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.selected {
  outline: 2px solid var(--excel);
  outline-offset: -2px;
}

.muted-cell {
  color: var(--quiet);
}

.merged-note {
  background: #fff8e7 !important;
  color: #6b4c17;
  font-style: italic;
}

.currency-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.status-cell {
  color: var(--excel-dark);
  font-weight: 760;
}

.sheet-tabs {
  display: flex;
  align-items: end;
  min-height: 42px;
  padding: 7px 10px 0;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.sheet-tab {
  min-width: 110px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b9d5c4;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #ffffff;
  color: var(--excel-dark);
  font-size: 12px;
  font-weight: 760;
}

.text-section {
  background: #ffffff;
}

.text-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 56px;
}

.prose {
  color: #3f4944;
  font-size: 17px;
  line-height: 1.78;
}

.prose p {
  margin-bottom: 18px;
}

.conformance-section {
  background: var(--page);
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stage-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stage-grid p {
  min-height: 80px;
  color: var(--muted);
  line-height: 1.6;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.stage-grid code {
  display: block;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f5;
  color: var(--excel-dark);
  font-size: 12px;
  overflow-x: auto;
}

.use-section {
  background: #ffffff;
}

.code-pair {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 18px;
  align-items: start;
}

.code-card {
  margin: 0;
  border-radius: 14px;
  background: #0d1117;
  border: 1px solid #1f2630;
  box-shadow: 0 18px 50px rgba(13, 17, 23, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid #1f2630;
}

.code-card .window-dots {
  display: inline-flex;
  gap: 6px;
}

.code-card .window-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2a313a;
}

.code-card .window-dots span:nth-child(1) { background: #ff5f57; }
.code-card .window-dots span:nth-child(2) { background: #febc2e; }
.code-card .window-dots span:nth-child(3) { background: #28c840; }

.code-card-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #8b949e;
}

.code-block {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  background: transparent;
  color: #c9d1d9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.75;
  flex: 1;
}

.code-block code {
  font-family: inherit;
  color: inherit;
  font-size: inherit;
}

.code-block .tok-kw      { color: #ff7b72; }
.code-block .tok-string  { color: #a5d6ff; }
.code-block .tok-fn      { color: #d2a8ff; }
.code-block .tok-type    { color: #79c0ff; }
.code-block .tok-const   { color: #79c0ff; }
.code-block .tok-var     { color: #ffa657; }
.code-block .tok-comment { color: #8b949e; font-style: italic; }
.code-block .tok-prompt  { color: #58a6ff; user-select: none; margin-right: 6px; }

.site-footer {
  width: min(1160px, calc(100% - 56px));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: #2d3832;
}

@media (max-width: 980px) {
  .site-nav {
    display: none;
  }

  .hero,
  .walkthrough-layout,
  .text-grid,
  .stage-grid,
  .code-pair {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    gap: 42px;
  }

  .preview-column {
    position: static;
  }

  .stage-grid p {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 0 18px;
  }

  .brand-text {
    display: none;
  }

  .hero,
  .section-intro,
  .text-grid,
  .walkthrough-layout,
  .stage-grid,
  .code-pair,
  .site-footer {
    width: min(100% - 36px, 1160px);
  }

  .hero {
    padding: 64px 0 48px;
  }

  .walkthrough-section,
  .text-section,
  .conformance-section,
  .use-section {
    padding: 64px 0;
  }

  .step {
    min-height: auto;
  }

  .preview-caption {
    display: block;
  }

  .preview-caption strong {
    display: block;
    margin-top: 4px;
    text-align: left;
  }

  .formula-bar {
    grid-template-columns: 54px 30px minmax(0, 1fr);
  }
}
