:root {
  --bg: #1c1612;
  --surface: #261f1a;
  --paper: #f3e8d8;
  --ink: #2a221c;
  --muted: #8a7a6c;
  --accent: #c9a227;
  --accent-dim: rgba(201, 162, 39, 0.25);
  --rail: #120e0b;
  --line: rgba(243, 232, 216, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--paper);
  line-height: 1.75;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 880px) {
  body {
    grid-template-columns: 15.5rem minmax(0, 1fr);
  }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--ink);
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
}

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #e8d4a8);
  z-index: 50;
  pointer-events: none;
}

.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 879px) {
  .rail {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .rail-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
  }

  .rail-nav.is-open {
    display: flex;
  }
}

@media (min-width: 880px) {
  .rail {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
  }

  .rail-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .rail-toggle {
    display: none;
  }
}

.brand {
  font-family: "Noto Serif KR", "Apple SD Gothic Neo", serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--paper);
  text-decoration: none;
  line-height: 1.35;
}

.brand small {
  display: block;
  font-family: "Noto Sans KR", sans-serif;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.rail-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.45rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.65rem;
  margin-left: -0.65rem;
}

.rail-nav a:hover,
.rail-nav a.is-on {
  color: var(--paper);
  border-left-color: var(--accent);
}

.rail-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--paper);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 4px;
}

.rail-tools {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (max-width: 879px) {
  .rail-tools {
    margin-top: 0;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 4px;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.wrap {
  max-width: 46rem;
  padding: 2rem 1.5rem 4rem;
}

@media (min-width: 880px) {
  .wrap {
    padding: 2.5rem 2.5rem 5rem;
  }
}

.hero-img {
  margin: 0 0 1.75rem;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.hero-img img {
  width: 100%;
  height: auto;
  vertical-align: middle;
  display: block;
}

h1,
h2,
h3 {
  font-family: "Noto Serif KR", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.28;
}

h1 {
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  margin: 0 0 1rem;
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 1.5rem;
}

p {
  margin: 0 0 1rem;
  color: rgba(243, 232, 216, 0.88);
}

a {
  color: var(--accent);
}

.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1.25rem 1.35rem;
  margin: 1.5rem 0;
}

.block h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.tagline {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.page-banner {
  margin: 0 0 1.75rem;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.page-banner img {
  width: 100%;
  display: block;
  vertical-align: middle;
}

body.sepia-on .hero-img img,
body.sepia-on .page-banner img {
  filter: sepia(0.35) contrast(1.05);
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--paper);
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 60;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.back-top {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--paper);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 55;
}

.back-top.is-visible {
  opacity: 1;
  visibility: visible;
}

@media (min-width: 880px) {
  .back-top {
    left: calc(15.5rem + 1rem);
  }
}

.faq button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--paper);
  font-size: 1rem;
  padding: 0.85rem 0;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 1px dashed var(--line);
}

.faq-panel {
  display: none;
  color: var(--muted);
  padding: 0 0 0.85rem;
  font-size: 0.95rem;
}

.faq-item.is-open .faq-panel {
  display: block;
}

.site-foot {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.site-foot a {
  color: var(--muted);
}

.site-foot a:hover {
  color: var(--accent);
}
