@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Noto+Sans+KR:wght@400;500;700;800&display=swap");

:root {
  --bg: #f5efe4;
  --bg-soft: rgba(255, 255, 255, 0.68);
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: #fffaf2;
  --text: #14281f;
  --muted: #5c675d;
  --line: rgba(20, 40, 31, 0.12);
  --accent: #d86f36;
  --accent-strong: #a74c1f;
  --accent-soft: rgba(216, 111, 54, 0.12);
  --ink: #0c5f63;
  --shadow: 0 24px 64px rgba(20, 40, 31, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(216, 111, 54, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(12, 95, 99, 0.16), transparent 28%),
    linear-gradient(180deg, #fff8ef 0%, var(--bg) 48%, #efe4d6 100%);
  font-family: "Noto Sans KR", sans-serif;
  line-height: 1.7;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(20, 40, 31, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 40, 31, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  content: "";
  pointer-events: none;
}

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

code,
pre {
  font-family: "Space Grotesk", monospace;
}

.page-shell {
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header {
  padding: 12px 0 32px;
}

.site-footer {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  flex-wrap: wrap;
}

.brand,
.hero-copy h1,
.hero-panel h2,
.section-heading h2,
.post-header h1,
.page-intro h1,
.error-card h1,
.principle-card h3,
.post-card h3,
.prose h2,
.prose h3 {
  font-family: "Space Grotesk", "Noto Sans KR", sans-serif;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

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

.nav-link {
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
}

.nav-link:hover,
.nav-link.is-active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--text);
}

.hero-grid,
.principle-grid,
.post-grid,
.post-list {
  display: grid;
  gap: 24px;
}

.hero-grid {
  grid-template-columns: 1.45fr 0.95fr;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.content-card,
.post-card,
.post-list-item,
.principle-card,
.toc-card,
.error-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 44px;
}

.home-intro {
  padding: 24px 0 8px;
}

.hero-copy h1,
.post-header h1,
.page-intro h1,
.error-card h1 {
  margin: 12px 0 18px;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
}

.hero-panel,
.content-card,
.principle-card,
.error-card {
  padding: 28px;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(165deg, rgba(255, 250, 242, 0.98), rgba(242, 232, 220, 0.92)),
    var(--surface-strong);
}

.panel-label,
.eyebrow,
.meta-row,
.post-date,
.post-category {
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.05rem;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
}

.button-primary {
  background: var(--text);
  color: #f6f3ec;
}

.button-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.intro-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
}

.text-link {
  color: var(--ink);
  font-weight: 700;
}

.text-link:hover {
  text-decoration: underline;
}

.feature-list,
.prose ol,
.prose ul {
  margin: 0;
  padding-left: 20px;
}

.section-block,
.page-main,
.post-main {
  margin-top: 40px;
}

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

.content-main {
  min-width: 0;
}

.content-sidebar {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 20px;
}

.sidebar-card {
  padding: 22px;
}

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

.search-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
}

.search-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font: inherit;
}

.search-input:focus {
  outline: 2px solid rgba(12, 95, 99, 0.2);
  border-color: rgba(12, 95, 99, 0.35);
}

.search-clear {
  width: fit-content;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.filter-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.pagination-button {
  min-width: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pagination-button.is-active {
  background: var(--text);
  color: #f6f3ec;
}

.pagination-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  color: var(--muted);
  font-weight: 700;
}

.sidebar-list {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6);
  font-weight: 700;
}

.sidebar-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sidebar-count {
  color: var(--muted);
  font-size: 0.92rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tag-filter.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tag-filter-count {
  color: var(--muted);
  font-size: 0.88rem;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2,
.hero-panel h2,
.principle-card h3,
.post-card h3,
.prose h2,
.prose h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.section-heading h2,
.hero-panel h2 {
  font-size: clamp(1.8rem, 2vw, 2.6rem);
}

.post-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
}

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

.post-list-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px;
}

.post-card h3 {
  font-size: 1.6rem;
  line-height: 1.05;
}

.post-list-item h3 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.post-summary {
  color: var(--muted);
  max-width: 64ch;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.principle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page-intro {
  padding: 16px 0 6px;
}

.post-main {
  display: grid;
}

.post-article {
  width: min(100%, 860px);
}

.post-header {
  margin-bottom: 24px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.toc-card {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
  padding: 16px;
}

.toc-card a {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
}

.prose {
  margin-top: 28px;
}

.prose h2 {
  margin-bottom: 14px;
  font-size: 2rem;
}

.prose h3 {
  margin: 24px 0 10px;
  font-size: 1.25rem;
}

.prose p,
.prose li {
  color: #24352c;
}

.prose figure {
  margin: 24px auto;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.figure-stack {
  grid-template-columns: 1fr;
  max-width: 100%;
  margin: 24px auto;
  gap: 28px;
}

.prose figure.figure-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.prose img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.prose figure.figure-compact img {
  width: min(280px, 100%);
}

.prose figure.figure-medium img {
  width: min(420px, 100%);
}

.prose figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.prose figure.figure-compact figcaption {
  max-width: 280px;
}

.prose figure.figure-medium figcaption {
  max-width: 420px;
}

.prose figure.figure-zoom {
  align-items: stretch;
}

.prose .figure-grid figure.figure-compact img,
.prose .figure-grid figure.figure-medium img {
  width: 100%;
}

.prose .figure-grid figure.figure-compact figcaption,
.prose .figure-grid figure.figure-medium figcaption {
  max-width: none;
}

.prose .figure-stack figure.figure-compact img,
.prose .figure-stack figure.figure-medium img {
  width: min(720px, 100%);
}

.prose .figure-stack figure.figure-compact figcaption,
.prose .figure-stack figure.figure-medium figcaption {
  max-width: 720px;
}

.prose .figure-stack figure.figure-compact.figure-zoom img {
  width: min(840px, 100%);
}

.prose .figure-stack figure.figure-compact.figure-zoom figcaption {
  max-width: 840px;
}

.prose .figure-stack {
  justify-items: center;
}

.prose .post-figure {
  --figure-max: 760px;
  margin: 24px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.prose .post-figure img {
  width: min(var(--figure-max), 100%);
  margin-inline: auto;
}

.prose .post-figure figcaption {
  width: min(var(--figure-max), 100%);
  max-width: min(var(--figure-max), 100%);
}

.prose .post-figure--sm {
  --figure-max: 460px;
}

.prose .post-figure--md {
  --figure-max: 560px;
}

.prose .post-figure--lg {
  --figure-max: 720px;
}

.prose .post-figure--xl {
  --figure-max: 860px;
}

.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.prose table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: rgba(216, 111, 54, 0.12);
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 700;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose pre {
  overflow-x: auto;
  margin: 0;
  padding: 18px 20px 20px;
  border: 0;
  border-radius: 0 0 calc(var(--radius-md) - 2px) calc(var(--radius-md) - 2px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%),
    #16211c;
  color: #f5f3ec;
  font-size: 0.96rem;
  line-height: 1.65;
}

.prose code {
  font-size: 0.96em;
}

.prose p code,
.prose li code,
.hero-panel p code {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(12, 95, 99, 0.09);
  color: var(--ink);
}

.callout {
  padding: 18px 20px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(216, 111, 54, 0.08);
}

.code-block {
  margin: 24px 0;
  border: 1px solid rgba(12, 95, 99, 0.18);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at top right, rgba(216, 111, 54, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(11, 19, 24, 0.98), rgba(17, 28, 35, 0.98));
  box-shadow: 0 18px 40px rgba(20, 40, 31, 0.18);
  overflow: hidden;
}

.code-block-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.code-block pre[class*="language-"] {
  background: transparent !important;
  text-shadow: none !important;
}

.code-block code[class*="language-"] {
  color: #f6f3ea;
  text-shadow: none !important;
}

.code-block-chrome {
  display: inline-flex;
  gap: 6px;
}

.code-block-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.code-block-dot:nth-child(1) {
  background: #ff7a59;
}

.code-block-dot:nth-child(2) {
  background: #f4bf4f;
}

.code-block-dot:nth-child(3) {
  background: #56c271;
}

.code-block-label {
  color: rgba(245, 243, 236, 0.74);
  font-family: "Space Grotesk", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.code-copy-button {
  margin-left: auto;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f3ec;
  font-family: "Space Grotesk", "Noto Sans KR", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.code-copy-button:hover {
  background: rgba(216, 111, 54, 0.18);
  border-color: rgba(216, 111, 54, 0.42);
  transform: translateY(-1px);
}

.code-copy-button:active {
  transform: translateY(0);
}

.code-block[data-copy-state="success"] .code-copy-button {
  background: rgba(86, 194, 113, 0.18);
  border-color: rgba(86, 194, 113, 0.4);
}

.code-block[data-copy-state="error"] .code-copy-button {
  background: rgba(255, 122, 89, 0.18);
  border-color: rgba(255, 122, 89, 0.4);
}

.code-block .line-numbers-rows {
  left: -4.4em !important;
  width: 3.4em !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.02);
}

.code-block .line-numbers-rows > span::before {
  color: rgba(245, 243, 236, 0.34) !important;
}

.code-block pre.line-numbers {
  padding-left: 4.4em !important;
}

.code-block .token.comment,
.code-block .token.prolog,
.code-block .token.doctype,
.code-block .token.cdata {
  color: #7f95a8;
}

.code-block .token.punctuation {
  color: #d8dee9;
}

.code-block .token.property,
.code-block .token.tag,
.code-block .token.constant,
.code-block .token.symbol,
.code-block .token.deleted,
.code-block .token.number {
  color: #f7b267;
}

.code-block .token.boolean,
.code-block .token.selector,
.code-block .token.attr-name,
.code-block .token.string,
.code-block .token.char,
.code-block .token.builtin,
.code-block .token.inserted {
  color: #8bd3dd;
}

.code-block .token.operator,
.code-block .token.entity,
.code-block .token.url,
.code-block .token.variable {
  color: #f6f3ea;
}

.code-block .token.atrule,
.code-block .token.attr-value,
.code-block .token.function,
.code-block .token.class-name {
  color: #ffd166;
}

.code-block .token.keyword {
  color: #ff8fa3;
}

.code-block .token.regex,
.code-block .token.important {
  color: #95d5b2;
}

.error-shell {
  display: grid;
  min-height: calc(100vh - 48px);
  place-items: center;
}

.error-card {
  width: min(100%, 560px);
  text-align: center;
}

@media (max-width: 980px) {
  .content-layout,
  .hero-grid,
  .post-grid,
  .principle-grid {
    grid-template-columns: 1fr;
  }

  .content-sidebar {
    position: static;
  }

  .hero-copy {
    padding: 32px;
  }

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

@media (max-width: 640px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--max-width));
    padding-top: 16px;
  }

  .site-header,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .code-block-toolbar {
    flex-wrap: wrap;
  }

  .code-copy-button {
    width: 100%;
    justify-content: center;
  }

  .site-nav {
    width: 100%;
  }

  .nav-link {
    flex: 1 1 auto;
    text-align: center;
  }

  .hero-copy h1,
  .post-header h1,
  .page-intro h1,
  .error-card h1 {
    font-size: clamp(2.2rem, 11vw, 3.5rem);
  }

  .hero-copy,
  .hero-panel,
  .content-card,
  .principle-card,
  .post-card,
  .post-list-item,
  .error-card {
    padding: 22px;
  }
}
