:root {
  --bg: #f6f2eb;
  --paper: #ffffff;
  --paper-soft: #fcfaf7;
  --surface: #f8f4ee;
  --ink: #2d2a26;
  --ink-strong: #1f1c18;
  --muted: #6c6760;
  --line: #e5ddd2;
  --line-strong: #d5cabd;
  --brand: #2f6b78;
  --brand-strong: #234f5a;
  --accent: #c8843f;
  --shadow: 0 16px 34px rgba(45, 42, 38, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shell: min(1160px, calc(100% - 32px));
  --transition: 220ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: linear-gradient(180deg, #faf7f1 0, #f4eee6 260px, #f6f2eb 260px, #f6f2eb 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0));
}

img {
  display: block;
  width: 100%;
}

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

button,
input {
  font: inherit;
}

.shell {
  width: var(--shell);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 247, 241, 0.94);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand-text {
  display: grid;
  gap: 4px;
}

.brand-text strong {
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.brand-text span {
  color: var(--muted);
  font-size: 0.88rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.site-nav a {
  position: relative;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 500;
  transition: color var(--transition);
}

.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--ink-strong);
}

.site-nav a:hover::after,
.site-nav a.is-active::after {
  transform: scaleX(1);
}

.site-nav a.nav-external {
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--brand-strong);
}

.site-nav a.nav-external::after {
  display: none;
}

.page {
  padding: 28px 0 72px;
}

.panel,
.article-panel,
.module-card,
.chapter-card,
.related-card,
.info-card,
.sticky-card,
.sidebar-card,
.search-panel,
.footer-inner {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel,
.footer-inner {
  border-radius: var(--radius-xl);
}

.article-panel,
.module-card,
.chapter-card,
.related-card,
.info-card,
.sticky-card,
.sidebar-card,
.search-panel {
  border-radius: var(--radius-lg);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.headline {
  color: var(--ink-strong);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink-strong);
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  border-color: transparent;
  background: var(--brand);
  color: white;
  box-shadow: 0 12px 24px rgba(47, 107, 120, 0.2);
}

.button.secondary {
  background: var(--paper-soft);
}

.hero-note {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid #e7ddd2;
  border-radius: var(--radius-md);
  background: var(--paper-soft);
  color: var(--muted);
  line-height: 1.78;
}

.home-layout,
.archive-layout,
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
}

.home-main,
.archive-main,
.article-main {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.sidebar-stack,
.sticky-stack {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 16px;
}

.home-cover,
.page-hero,
.article-hero,
.practice-strip,
.category-strip {
  padding: 30px 32px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(47, 107, 120, 0.08), rgba(200, 132, 63, 0.06) 70%, rgba(255, 255, 255, 0.96)),
    var(--paper);
  box-shadow: var(--shadow);
}

.home-cover h1,
.page-hero h1,
.article-hero h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.08;
}

.home-cover p,
.page-hero p,
.article-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.82;
}

.blog-meta-line,
.article-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.home-section,
.archive-section {
  padding: 26px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.section {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 8px 0 0;
  font-size: clamp(1.42rem, 2.6vw, 2rem);
  line-height: 1.12;
}

.archive-headline {
  margin: 8px 0 0;
  font-size: clamp(1.72rem, 3.3vw, 3rem);
  line-height: 1.08;
}

.section-head p {
  margin: 0;
  max-width: 600px;
  color: var(--muted);
  line-height: 1.72;
}

.module-grid,
.post-list,
.chapter-grid,
.related-grid,
.list-grid,
.media-grid,
.quick-grid,
.key-grid {
  display: grid;
  gap: 16px;
}

.module-grid,
.post-list,
.chapter-grid {
  grid-template-columns: 1fr;
}

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

.module-card {
  padding: 18px 20px;
}

.module-card h3,
.chapter-card h3,
.related-card h3,
.info-card h3 {
  margin: 10px 0 8px;
  font-size: 1.08rem;
  line-height: 1.4;
}

.module-card p,
.chapter-card p,
.related-card p,
.info-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.74;
}

.module-meta,
.chapter-meta,
.card-tags,
.post-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #dbe4e6;
  background: #f4f7f8;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 600;
}

.chapter-card,
.related-card {
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.chapter-card:hover,
.related-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 34px rgba(45, 42, 38, 0.11);
}

.chapter-card a,
.related-card a {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100%;
}

.chapter-card figure,
.related-card figure,
.category-banner figure,
.article-hero figure {
  margin: 0;
}

.chapter-card figure img,
.related-card figure img {
  height: 100%;
  min-height: 168px;
  object-fit: cover;
}

.chapter-card-body,
.related-card-body {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 20px 22px;
}

.chapter-prefix {
  color: var(--brand-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-card,
.sticky-card,
.search-panel {
  padding: 22px;
}

.sidebar-card h3,
.sticky-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.sidebar-card p,
.sidebar-card li,
.sticky-card p,
.sticky-card li,
.sticky-card a {
  color: var(--muted);
  line-height: 1.78;
}

.sidebar-card ul,
.sticky-card ul,
.list-card ul {
  margin: 0;
  padding-left: 18px;
}

.sidebar-card nav,
.sticky-card nav {
  display: grid;
  gap: 8px;
}

.sidebar-card nav a,
.sticky-card nav a {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-strong);
}

.category-link {
  position: relative;
  padding-left: 18px !important;
}

.category-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
  transform: translateY(-50%);
}

.category-strip,
.page-hero-grid,
.article-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: center;
}

.category-banner {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.category-banner figure img,
.article-hero figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumbs span {
  opacity: 0.55;
}

.search-panel {
  display: grid;
  gap: 12px;
}

.search-panel label {
  display: grid;
  gap: 8px;
}

.search-panel strong {
  font-size: 0.93rem;
}

.search-panel input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fcfbf9;
  color: var(--ink);
  outline: none;
}

.search-panel input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(47, 107, 120, 0.08);
}

.search-count {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
}

.article-hero-copy {
  display: grid;
  gap: 10px;
}

.view-shell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.view-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f4f7f8;
  color: var(--brand-strong);
  font-weight: 600;
}

.article-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.reaction-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-strong);
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.reaction-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--brand);
}

.reaction-button.is-liked {
  border-color: rgba(200, 132, 63, 0.32);
  background: #fff5ea;
  color: #9b5b1a;
}

.reaction-button:disabled {
  cursor: default;
  opacity: 1;
}

.reaction-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.reaction-count {
  font-weight: 700;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.toc a {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
}

.article-layout {
  grid-template-columns: minmax(0, 1fr) 290px;
  margin-top: 24px;
}

.article-panel {
  padding: 28px;
}

.article-panel h2 {
  margin: 0 0 14px;
  font-size: 1.38rem;
  line-height: 1.25;
}

.article-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.86;
}

.article-panel p + p {
  margin-top: 14px;
}

.quick-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.quick-item,
.key-card,
.list-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.quick-item strong,
.key-card strong {
  display: block;
  color: var(--ink-strong);
}

.quick-item span,
.key-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.72;
}

.key-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.figure-frame {
  overflow: hidden;
  margin-top: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.media-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.media-card {
  overflow: hidden;
  margin: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.media-card img {
  background: #edf3f5;
}

.media-card figcaption {
  padding: 14px 16px 16px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.94rem;
}

.code-shell {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid #1b2939;
  background: #1a2632;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.code-shell pre {
  margin: 0;
  padding: 22px;
  overflow-x: auto;
  color: #eef6ff;
  font-size: 0.94rem;
  line-height: 1.7;
}

.code-shell code {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
}

.list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.list-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.list-card ul {
  color: var(--muted);
  line-height: 1.78;
}

.practice-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 20px 22px;
  border: 1px solid #e7ddd2;
  border-radius: 16px;
  background: var(--paper-soft);
}

.practice-banner h3 {
  margin: 10px 0 8px;
  font-size: 1.18rem;
}

.practice-banner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.78;
}

.comment-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.comment-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-form-header p {
  margin: 0;
  color: var(--muted);
}

.comment-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field strong {
  font-size: 0.92rem;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fcfbf9;
  color: var(--ink);
  outline: none;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(47, 107, 120, 0.08);
}

.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.comment-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.comment-counter {
  color: var(--muted);
  font-size: 0.9rem;
}

.comment-status {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.92rem;
}

.comment-status[data-kind='error'] {
  background: #fff1f1;
  color: #b42318;
}

.comment-status[data-kind='success'] {
  background: #eefbf3;
  color: #166534;
}

.comment-status[data-kind='muted'] {
  background: var(--surface);
  color: var(--muted);
}

.comment-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.comment-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.comment-item.is-reply {
  background: #fbf8f3;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-meta strong {
  color: var(--ink-strong);
}

.comment-meta span {
  color: var(--muted);
  font-size: 0.9rem;
}

.comment-body {
  margin: 0;
  color: var(--ink);
  line-height: 1.74;
}

.comment-actions {
  margin-top: 12px;
}

.comment-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-strong);
  font-weight: 600;
  cursor: pointer;
}

.comment-replies {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  padding-left: 14px;
  border-top: 1px solid var(--line);
}

.comment-empty {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
}

.footer {
  padding: 10px 0 36px;
}

.footer-inner {
  display: grid;
  gap: 14px;
  padding: 24px 28px;
}

.footer-inner strong {
  font-size: 1.04rem;
}

.footer-inner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.74;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-links a {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .home-layout,
  .archive-layout,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-stack,
  .sticky-stack {
    position: static;
  }

  .category-strip,
  .page-hero-grid,
  .article-hero-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .header-inner {
    min-height: auto;
    padding: 16px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    gap: 16px;
  }

  .page {
    padding: 20px 0 56px;
  }

  .home-cover,
  .page-hero,
  .article-hero,
  .practice-strip,
  .category-strip,
  .home-section,
  .archive-section,
  .sidebar-card,
  .sticky-card,
  .search-panel,
  .article-panel,
  .footer-inner {
    padding: 20px;
  }

  .chapter-card a,
  .related-card a {
    grid-template-columns: 1fr;
  }

  .chapter-card figure img,
  .related-card figure img {
    min-height: 190px;
  }

  .quick-grid,
  .key-grid,
  .list-grid,
  .media-grid,
  .practice-banner,
  .comment-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
