:root {
  --bg: #e4ebe9;
  --ink: #17211f;
  --muted: #4d5c59;
  --line: #c9d5d1;
  --sheet: #f7faf9;
  --teal: #1f6f68;
  --teal-deep: #14302e;
  --mark: #d9782d;
  --danger: #8d2e2e;
  --shadow: 0 18px 40px rgba(20, 48, 46, 0.08);
  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(20, 48, 46, 0.04) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; }
a { color: var(--teal); }
button, input, select { font: inherit; }
:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -40px;
  background: var(--ink);
  color: white;
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.banner {
  background: var(--teal-deep);
  color: #e7f3f1;
  font-size: 14px;
  line-height: 1.55;
}
.banner p { margin: 0; padding: 10px 20px; max-width: 1180px; margin-inline: auto; }
.banner strong { color: #fff; font-weight: 600; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(228, 235, 233, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--teal-deep);
  display: grid;
  place-items: center;
}
.brand-name { display: block; font-weight: 600; letter-spacing: -0.03em; }
.brand-en {
  display: block;
  font-size: 12px;
  letter-spacing: -0.02em;
  color: var(--muted);
}
.text-link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  font-size: 14px;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 64px;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.rail {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
}
.rail a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid transparent;
}
.rail a.is-current {
  color: var(--ink);
  border-left-color: var(--mark);
  font-weight: 500;
}

.sheet {
  background: var(--sheet);
  border: 1px solid #d5e0dc;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 48px);
}
.sheet + .sheet { margin-top: 18px; }

.kicker {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
}
h1, h2, h3 { line-height: 1.35; letter-spacing: -0.03em; font-weight: 600; }
h1 { font-size: clamp(32px, 5vw, 52px); margin: 0 0 16px; }
h2 { font-size: clamp(26px, 3vw, 34px); margin: 0 0 12px; }
h3 { font-size: 20px; margin: 0 0 8px; }
.lede { font-size: 18px; margin: 0; max-width: 40rem; }
.muted { color: var(--muted); }
.meta {
  margin: 28px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 28px;
  border-top: 1px solid var(--line);
}
.meta div {
  padding: 12px 16px 0 0;
}
.meta dt {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.meta dd { margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-top: 22px; }
.btn {
  appearance: none;
  border: 0;
  background: var(--teal-deep);
  color: white;
  text-decoration: none;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.btn:hover { background: #1c4542; }
.btn-line {
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  border-radius: 0;
  padding: 0 0 2px;
  border-bottom: 1px solid var(--ink);
}

.sessions { display: flex; flex-direction: column; }
.session {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.session:first-of-type { border-top: 0; padding-top: 0; }
.code {
  font-family: var(--mono);
  color: var(--mark);
  font-size: 14px;
  padding-top: 4px;
}
.session p { margin: 0; color: var(--muted); }
.practice {
  margin-top: 8px;
  color: var(--ink);
}

.diagram {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
  padding-bottom: 24px;
}
.plate {
  border: 1px solid var(--line);
  background: white;
  min-height: 150px;
  padding: 14px;
  position: relative;
}
.plate span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--teal);
}
.plate strong { display: block; margin: 28px 0 8px; }
.plate p { margin: 0; color: var(--muted); font-size: 14px; }
.plate:nth-child(2) { transform: translateY(12px); }
.plate:nth-child(3) { transform: translateY(24px); }

.table-wrap { overflow-x: auto; margin: 14px 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 500; }
td:nth-child(2) { font-family: var(--mono); white-space: nowrap; }

.drill {
  margin-top: 18px;
  padding: 16px;
  background: white;
  border-left: 4px solid var(--mark);
}
.drill p { margin: 0 0 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button {
  background: white;
  border: 1px solid var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}
.choices button[aria-pressed="true"] {
  background: var(--teal-deep);
  color: white;
  border-color: var(--teal-deep);
}
.drill-result { margin: 12px 0 0; min-height: 1.5em; }

.bounds { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bounds ul, .fit ul, .faq { margin: 0; padding: 0; list-style: none; }
.bounds li, .fit li { padding: 8px 0 8px 18px; position: relative; }
.bounds li::before, .fit li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  position: absolute;
  left: 0;
  top: 16px;
}
.no li::before { background: var(--mark); }

.faq details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 500; }
.faq p { margin: 8px 0 0; color: var(--muted); }

.form-grid { display: grid; gap: 14px; max-width: 460px; }
label span { display: block; font-size: 14px; margin-bottom: 6px; }
input, select {
  width: 100%;
  border: 1px solid #b7c6c2;
  background: white;
  padding: 12px 12px;
  border-radius: 0;
  color: var(--ink);
}
.field-error { min-height: 1.25em; margin: 4px 0 0; color: var(--danger); font-size: 13px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { width: auto; margin-top: 4px; }
.fine { font-size: 13px; color: var(--muted); margin: 0; }

.legal h2 { font-size: 22px; }
.legal h3 { margin-top: 22px; }
.foot {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 40px;
  color: var(--muted);
  font-size: 13px;
}
.foot p { margin: 0; }

.gate[hidden] { display: none; }
.gate {
  position: fixed;
  inset: 0;
  background: rgba(20, 33, 31, 0.56);
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}
.gate-card {
  width: min(440px, 100%);
  background: var(--sheet);
  padding: 28px 24px 22px;
  border-top: 6px solid var(--teal);
  box-shadow: var(--shadow);
}
.gate-card h2 { font-size: 28px; }
.gate-card p { margin: 0 0 18px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; margin-top: 16px; }
  .rail {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 14px;
    padding-bottom: 6px;
  }
  .rail a { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; padding: 6px 0; }
  .rail a.is-current { border-bottom-color: var(--mark); }
  .cover, .bounds, .diagram, .session { grid-template-columns: 1fr; }
  .meta { grid-template-columns: 1fr 1fr; }
  .plate:nth-child(2), .plate:nth-child(3) { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
