:root {
  color-scheme: light;
  --ink: #15223a;
  --ink-soft: #33415c;
  --paper: #f6f3ed;
  --white: #fff;
  --line: #d8ddd9;
  --teal: #176b62;
  --teal-soft: #dcece7;
  --amber: #c98931;
  --shadow: 0 18px 50px rgba(21, 34, 58, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 4%, rgba(23, 107, 98, 0.12), transparent 24rem),
    var(--paper);
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.65;
}

button, input, select { font: inherit; }
a { color: inherit; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font: 700 21px/1 Georgia, serif;
}

.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -0.02em; }
.brand small { color: #687186; font-size: 12px; }

nav { display: flex; gap: 18px; }
nav a {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
nav a:hover { color: var(--teal); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.hero {
  padding: 90px 0 58px;
  max-width: 940px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  max-width: 850px;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.hero-copy {
  max-width: 680px;
  margin: 26px 0 34px;
  color: var(--ink-soft);
  font-size: clamp(16px, 2vw, 19px);
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: min(860px, 100%);
}

.search-field {
  min-width: 0;
  height: 68px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 17px;
  box-shadow: var(--shadow);
}

.search-field:focus-within { border-color: var(--teal); }
.search-icon { color: var(--teal); font-size: 28px; line-height: 1; }
.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
}
.search-field kbd {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #727b8b;
  background: #f7f8f7;
  font-size: 13px;
}

.search-panel > button {
  padding: 0 28px;
  border: 0;
  border-radius: 17px;
  color: white;
  background: var(--teal);
  font-weight: 800;
  cursor: pointer;
}
.search-panel > button:hover { background: #0f594f; }

.suggestions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: #687186;
  font-size: 13px;
}
.suggestions button {
  padding: 6px 11px;
  border: 1px solid #cfd7d2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
  cursor: pointer;
}
.suggestions button:hover { border-color: var(--teal); color: var(--teal); }

.archive-stats {
  min-height: 130px;
  padding: 28px 34px;
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 150px)) 1fr;
  align-items: center;
  gap: 18px;
  border-radius: 24px;
  background: var(--ink);
  color: white;
}
.archive-stats div { border-right: 1px solid rgba(255, 255, 255, 0.17); }
.archive-stats strong { display: block; font: 700 34px/1 Georgia, serif; }
.archive-stats span { color: #bac5d5; font-size: 13px; }
.archive-stats p { justify-self: end; margin: 0; color: #cbd4e0; font-size: 14px; }

.rag-download {
  margin-top: 28px;
  padding: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 34px;
  border: 1px solid #d7dfda;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 38px rgba(21, 34, 58, 0.06);
}
.rag-download h2 { max-width: 670px; }
.rag-download-copy > p:not(.eyebrow) {
  max-width: 690px;
  margin: 18px 0 0;
  color: var(--ink-soft);
}
.rag-download code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #e9efeb;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}
.rag-download-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.rag-download-actions a {
  padding: 11px 16px;
  border: 1px solid var(--teal);
  border-radius: 11px;
  color: var(--teal);
  background: white;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}
.rag-download-actions .download-primary { color: white; background: var(--teal); }
.rag-download-actions a:hover { transform: translateY(-1px); }
.rag-steps {
  padding: 24px;
  border-radius: 18px;
  background: var(--teal-soft);
}
.rag-steps ol { margin: 0; padding: 0; display: grid; gap: 13px; list-style: none; }
.rag-steps li { display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 750; }
.rag-steps strong {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  color: white;
  background: var(--teal);
  font: 700 13px/1 Georgia, serif;
}
.rag-steps p { margin: 18px 0 0; color: #466b65; font-size: 12px; }

.explorer { padding: 84px 0 40px; }
.explorer-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}
h2 { margin: 0; font-size: 38px; letter-spacing: -0.04em; }

.filters { display: flex; gap: 10px; }
.filters label span { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.filters select {
  min-width: 145px;
  padding: 11px 36px 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-soft);
}

.result-summary {
  margin-top: 24px;
  padding: 13px 0;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: #687186;
  font-size: 14px;
}
.result-summary p { margin: 0; }
.result-summary button { border: 0; background: none; color: var(--teal); cursor: pointer; }

.results { display: grid; gap: 14px; padding-top: 20px; }
.result-card {
  min-width: 0;
  padding: 26px;
  border: 1px solid #dde2de;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.result-card h3,
.byline,
.excerpt { overflow-wrap: anywhere; }
.result-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(21, 34, 58, 0.08); }
.result-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.badge {
  padding: 4px 8px;
  border-radius: 7px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 11px;
  font-weight: 750;
}
.page-badge { color: #725018; background: #f5e8cf; }
.result-card h3 { margin: 12px 0 8px; font-size: 21px; letter-spacing: -0.025em; }
.byline { margin: 0 0 12px; color: #687186; font-size: 13px; }
.excerpt { margin: 0; color: #3d4961; font-family: Georgia, "Noto Serif KR", serif; font-size: 15px; }
mark { padding: 0 2px; background: #ffe8a8; color: inherit; }
.result-actions { margin-top: 18px; display: flex; gap: 9px; }
.result-actions a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: white;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.result-actions a:first-child { border-color: var(--teal); color: var(--teal); }
.result-actions a:hover { background: #f4f7f5; }

.empty-state {
  padding: 70px 24px;
  text-align: center;
  color: #687186;
  border: 1px dashed #c9d0cc;
  border-radius: 18px;
}
.empty-state strong { display: block; color: var(--ink); font-size: 20px; }

.notice {
  margin: 20px 0 80px;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  border-left: 4px solid var(--amber);
  background: #fff8ea;
  color: #5f4d30;
}
.notice p { margin: 0; }

footer {
  padding: 34px max(20px, calc((100% - 1180px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: #7c8492;
  background: #e9ece8;
  font-size: 12px;
}
footer p { margin: 0; }

@media (max-width: 760px) {
  .site-header { width: min(100% - 28px, 1180px); padding: 18px 0; }
  .site-header nav { display: none; }
  main { width: min(100% - 28px, 1180px); }
  .hero { padding: 56px 0 42px; }
  h1 { font-size: clamp(40px, 13vw, 58px); }
  .search-panel { grid-template-columns: 1fr; }
  .search-panel > button { height: 54px; }
  .search-field { height: 62px; }
  .search-field kbd { display: none; }
  .archive-stats { grid-template-columns: repeat(3, 1fr); padding: 22px 18px; text-align: center; }
  .archive-stats div:last-of-type { border-right: 0; }
  .archive-stats strong { font-size: 27px; }
  .archive-stats p { grid-column: 1 / -1; justify-self: center; }
  .rag-download { padding: 26px 20px; grid-template-columns: 1fr; gap: 22px; }
  .rag-download h2 { font-size: 32px; }
  .rag-download-actions { display: grid; }
  .rag-download-actions a { text-align: center; }
  .explorer { padding-top: 60px; }
  .explorer-head { align-items: start; flex-direction: column; }
  .filters { width: 100%; }
  .filters label { flex: 1; }
  .filters select { width: 100%; min-width: 0; }
  .result-card { padding: 20px; }
  .notice { grid-template-columns: 1fr; gap: 8px; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
