/* Apython Blog — editorial design system */

:root {
  --paper: #faf7f2;
  --paper-deep: #f2ede4;
  --paper-card: #fffdf9;
  --ink: #1b1a17;
  --ink-soft: #4a463f;
  --ink-faint: #837d72;
  --rule: #ddd5c8;
  --rule-soft: #eae4d9;
  --accent: #b4553a;
  --accent-soft: #e9cfc4;
  --sage: #6f7f63;
  --sage-soft: #dfe5d7;
  --shadow-sm: 0 1px 2px rgba(27, 26, 23, .05), 0 8px 24px -12px rgba(27, 26, 23, .18);
  --shadow-md: 0 2px 4px rgba(27, 26, 23, .05), 0 18px 48px -20px rgba(27, 26, 23, .28);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, "Times New Roman", serif;
  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --measure: 42rem;
  --radius: 6px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

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

::selection { background: var(--accent-soft); color: var(--ink); }

.wrap {
  width: 100%;
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

.wrap--narrow { max-width: 56rem; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: rgba(250, 247, 242, .86);
  backdrop-filter: saturate(160%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  height: 68px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  font-family: var(--serif);
  font-size: 1.32rem;
  letter-spacing: .01em;
  font-weight: 600;
}

.brand__mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-2px);
}

.brand__sub {
  font-family: var(--sans);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: .9rem;
}

.nav__link {
  color: var(--ink-soft);
  position: relative;
  padding: .25rem 0;
  transition: color .2s var(--ease);
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 1px;
  background: var(--accent);
  transition: right .3s var(--ease);
}

.nav__link:hover::after,
.nav__link[aria-current="page"]::after { right: 0; }
.nav__link[aria-current="page"] { color: var(--ink); }

.nav__search {
  border: 1px solid var(--rule);
  background: var(--paper-card);
  border-radius: 999px;
  padding: .4rem .9rem;
  font-size: .85rem;
  width: 11rem;
  transition: border-color .2s, width .3s var(--ease);
}

.nav__search:focus {
  outline: none;
  border-color: var(--accent);
  width: 14rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .4rem .8rem;
  cursor: pointer;
}

/* ---------- Masthead ---------- */

.masthead {
  padding: 5.5rem 0 3.5rem;
  border-bottom: 1px solid var(--rule-soft);
  position: relative;
}

.masthead__eyebrow {
  font-size: .72rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.6rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.masthead__eyebrow::after {
  content: "";
  height: 1px;
  width: 4rem;
  background: var(--accent-soft);
}

.masthead__title {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.12;
  letter-spacing: -.015em;
  font-weight: 600;
  margin: 0 0 1.6rem;
  max-width: 20ch;
}

.masthead__title em {
  font-style: normal;
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}

.masthead__lede {
  font-family: var(--serif);
  font-size: 1.16rem;
  line-height: 1.9;
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0;
}

.masthead__meta {
  margin-top: 2.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  font-size: .82rem;
  color: var(--ink-faint);
  letter-spacing: .04em;
}

.masthead__meta strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  margin-right: .35rem;
}

/* ---------- Section headings ---------- */

.section {
  padding: 4rem 0 0;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: .9rem;
}

.section__title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: .01em;
}

.section__more {
  font-size: .82rem;
  color: var(--ink-faint);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.section__more:hover { color: var(--accent); }

/* ---------- Featured card ---------- */

.feature {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 0;
  border: 1px solid var(--rule);
  background: var(--paper-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .35s var(--ease), transform .35s var(--ease);
}

.feature:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature__body {
  padding: 2.6rem 2.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.feature__kicker {
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.feature__title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 1rem;
  letter-spacing: -.01em;
}

.feature__excerpt {
  color: var(--ink-soft);
  font-size: .98rem;
  line-height: 1.85;
  margin: 0 0 1.6rem;
}

.feature__media {
  position: relative;
  min-height: 300px;
  background: var(--paper-deep);
  overflow: hidden;
}

.feature__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s var(--ease);
}

.feature:hover .feature__media img { transform: scale(1.04); }

/* ---------- Meta line ---------- */

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .85rem;
  font-size: .78rem;
  color: var(--ink-faint);
  letter-spacing: .03em;
}

.meta-line__dot { width: 3px; height: 3px; border-radius: 50%; background: var(--rule); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .18rem .7rem;
  font-size: .74rem;
  color: var(--ink-soft);
  background: var(--paper);
  letter-spacing: .02em;
  transition: border-color .2s, color .2s, background .2s;
}

.pill:hover { border-color: var(--accent); color: var(--accent); background: var(--paper-card); }

.pill--active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pill--active:hover { color: var(--paper); }

.pill-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Post grid ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: .5rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-card);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
  border-color: var(--rule);
}

.post-card__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--paper-deep);
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s var(--ease);
}

.post-card:hover .post-card__media img { transform: scale(1.05); }

.post-card__body {
  padding: 1.4rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-card__cat {
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .65rem;
}

.post-card__title {
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 .7rem;
  letter-spacing: -.005em;
}

.post-card__excerpt {
  font-size: .88rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 1.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__foot {
  margin-top: auto;
  padding-top: .9rem;
  border-top: 1px solid var(--rule-soft);
}

/* ---------- List rows ---------- */

.post-list { display: flex; flex-direction: column; }

.post-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 1.6rem;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule-soft);
  transition: padding-left .3s var(--ease);
}

.post-row:hover { padding-left: .5rem; }

.post-row__thumb {
  width: 130px;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-deep);
}

.post-row__thumb img { width: 100%; height: 100%; object-fit: cover; }

.post-row__title {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 600;
  margin: 0 0 .45rem;
  line-height: 1.45;
}

.post-row__excerpt {
  font-size: .86rem;
  color: var(--ink-soft);
  margin: 0 0 .55rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-row__date {
  font-size: .78rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Article ---------- */

.article-header {
  padding: 4.5rem 0 2.5rem;
  text-align: center;
  position: relative;
}

.article-header__kicker {
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.4rem;
}

.article-header__title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.015em;
  margin: 0 auto 1.4rem;
  max-width: 24ch;
}

.article-header__meta {
  justify-content: center;
  margin-top: .5rem;
}

.article-hero {
  max-width: 62rem;
  margin: 1rem auto 3.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.article-hero img {
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr minmax(0, var(--measure)) 1fr;
  gap: 2.5rem;
  align-items: start;
  padding-bottom: 4rem;
}

.article-layout > .article-body { grid-column: 2; }

.toc {
  position: sticky;
  top: 96px;
  grid-column: 3;
  font-size: .82rem;
  line-height: 1.6;
  border-left: 1px solid var(--rule);
  padding-left: 1.2rem;
  max-width: 15rem;
}

.toc__label {
  font-size: .66rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .8rem;
}

.toc a {
  display: block;
  color: var(--ink-faint);
  padding: .18rem 0;
  transition: color .2s;
}

.toc a:hover, .toc a.is-active { color: var(--accent); }
.toc a[data-level="3"] { padding-left: .9rem; font-size: .78rem; }

.prose {
  font-family: var(--serif);
  font-size: 1.07rem;
  line-height: 2.0;
  color: var(--ink);
  overflow-wrap: break-word;
}

.prose > *:first-child { margin-top: 0; }

.prose p { margin: 0 0 1.5em; }

.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  line-height: 1.4;
  letter-spacing: -.005em;
  margin: 2.4em 0 .7em;
  scroll-margin-top: 96px;
}

.prose h2 {
  font-size: 1.5rem;
  padding-bottom: .4em;
  border-bottom: 1px solid var(--rule-soft);
}

.prose h3 { font-size: 1.22rem; }
.prose h4 { font-size: 1.06rem; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-soft);
  transition: text-decoration-color .2s;
}

.prose a:hover { text-decoration-color: var(--accent); }

.prose strong { font-weight: 700; color: var(--ink); }

.prose blockquote {
  margin: 2em 0;
  padding: .2em 0 .2em 1.6em;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}

.prose blockquote p { margin: 0 0 .6em; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose ul, .prose ol {
  margin: 0 0 1.5em;
  padding-left: 1.4em;
}

.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); }

.prose hr {
  border: none;
  text-align: center;
  margin: 2.6em 0;
  color: var(--ink-faint);
}

.prose hr::after { content: "· · ·"; letter-spacing: .6em; font-size: 1.1rem; }

.prose img {
  border-radius: 4px;
  margin: 1.8em auto;
}

.prose figure { margin: 2em 0; }

.prose figcaption {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink-faint);
  text-align: center;
  margin-top: .7em;
}

.prose code.inline-code {
  font-family: var(--mono);
  font-size: .87em;
  background: var(--paper-deep);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: .1em .38em;
  color: #8a3b28;
}

.prose pre.code-block {
  position: relative;
  margin: 1.8em 0;
  padding: 1.3rem 1.5rem;
  background: #211f1c;
  color: #e6e1d8;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
}

.prose pre.code-block[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: .55rem;
  right: .9rem;
  font-family: var(--sans);
  font-size: .64rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #7d766a;
}

.prose pre.code-block code {
  font-family: inherit;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.prose .table-wrap {
  margin: 1.8em 0;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: .88rem;
  line-height: 1.6;
}

.prose th, .prose td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--rule-soft);
  text-align: left;
}

.prose th {
  background: var(--paper-deep);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .03em;
}

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

.prose del { color: var(--ink-faint); }

/* ---------- Tags / footer of article ---------- */

.article-foot {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.article-foot__label {
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .8rem;
}

.author-card {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--paper-deep);
  border-radius: var(--radius);
}

.author-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--paper-card);
}

.author-card__name { font-family: var(--serif); font-weight: 600; margin: 0 0 .2rem; }
.author-card__bio { font-size: .85rem; color: var(--ink-soft); margin: 0; line-height: 1.6; }

/* ---------- Comments ---------- */

.comments {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule);
}

.comments__title {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 .4rem;
}

.comments__hint { font-size: .82rem; color: var(--ink-faint); margin: 0 0 1.8rem; }

.comment {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.comment:last-child { border-bottom: none; }

.comment__head {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  margin-bottom: .4rem;
}

.comment__author { font-weight: 600; font-size: .92rem; }
.comment__time { font-size: .74rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.comment__body { font-size: .95rem; line-height: 1.8; color: var(--ink-soft); white-space: pre-wrap; }
.comment__replies { margin-left: 1.5rem; padding-left: 1rem; border-left: 1px solid var(--rule-soft); margin-top: .8rem; }

.comment-form { margin-top: 2rem; display: grid; gap: .8rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.field__label { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }

.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--paper-card);
  border-radius: 4px;
  padding: .65rem .8rem;
  font-size: .92rem;
  transition: border-color .2s, box-shadow .2s;
}

.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(180, 85, 58, .1);
}

.field textarea { resize: vertical; min-height: 6rem; line-height: 1.7; }

.hidden-field { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: .62rem 1.4rem;
  font-size: .88rem;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s, opacity .2s;
  align-self: flex-start;
}

.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: var(--paper-deep); color: var(--ink); border-color: var(--rule); }
.btn--small { padding: .34rem .85rem; font-size: .78rem; }
.btn--danger { background: transparent; color: var(--accent); border-color: var(--accent-soft); }
.btn--danger:hover { background: var(--accent); color: #fff; }

.notice {
  padding: .8rem 1rem;
  border-radius: 4px;
  font-size: .86rem;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.notice--ok { border-color: var(--sage-soft); background: #eef2e8; color: #4b5a3f; }
.notice--err { border-color: var(--accent-soft); background: #f7e8e2; color: #8a3b28; }

/* ---------- Pagination ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: 3rem 0 1rem;
}

.pager__btn {
  min-width: 2.3rem;
  height: 2.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper-card);
  font-size: .84rem;
  padding: 0 .7rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.pager__btn:hover { border-color: var(--accent); }
.pager__btn[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager__btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Empty state ---------- */

.empty {
  padding: 4rem 1rem;
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--serif);
  font-style: italic;
}

.skeleton {
  background: linear-gradient(90deg, var(--paper-deep) 25%, #f8f4ec 50%, var(--paper-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  color: transparent !important;
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 3rem 0 2.2rem;
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.site-footer__brand {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 .4rem;
}

.site-footer__note { font-size: .82rem; color: var(--ink-faint); margin: 0; max-width: 28rem; line-height: 1.7; }
.site-footer__links { display: flex; gap: 1.4rem; font-size: .82rem; color: var(--ink-soft); }

.site-footer__bottom {
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .74rem;
  color: var(--ink-faint);
  letter-spacing: .04em;
}

/* ---------- Admin ---------- */

.admin-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
  background: var(--paper);
}

.admin-side {
  border-right: 1px solid var(--rule);
  padding: 1.8rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  background: var(--paper-deep);
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-side__brand { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.admin-side__tag { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); margin-top: .2rem; }

.admin-nav { display: flex; flex-direction: column; gap: .2rem; }

.admin-nav__link {
  padding: .55rem .8rem;
  border-radius: 4px;
  font-size: .9rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  transition: background .2s, color .2s;
}

.admin-nav__link:hover { background: rgba(27, 26, 23, .05); color: var(--ink); }
.admin-nav__link.is-active { background: var(--paper-card); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.admin-nav__badge {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: .68rem;
  padding: 0 .42rem;
  min-width: 1.2rem;
  text-align: center;
}

.admin-side__foot { margin-top: auto; display: grid; gap: .5rem; font-size: .8rem; }

.admin-main { padding: 2.2rem 2.6rem 4rem; max-width: 78rem; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.admin-head h1 { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; margin: 0; }
.admin-head p { margin: .3rem 0 0; font-size: .86rem; color: var(--ink-faint); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat {
  background: var(--paper-card);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
}

.stat__label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.stat__value { font-family: var(--serif); font-size: 2rem; font-weight: 600; margin-top: .3rem; line-height: 1.1; }
.stat__unit { font-size: .8rem; color: var(--ink-faint); font-family: var(--sans); margin-left: .25rem; }

.panel {
  background: var(--paper-card);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 1.6rem;
  margin-bottom: 1.5rem;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.panel__title { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; margin: 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: .87rem; }

.data-table th {
  text-align: left;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  padding: .6rem .7rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.data-table td { padding: .8rem .7rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(242, 237, 228, .5); }
.data-table__title { font-weight: 500; max-width: 26rem; }
.data-table__actions { display: flex; gap: .4rem; justify-content: flex-end; }

.badge {
  display: inline-block;
  font-size: .7rem;
  padding: .12rem .55rem;
  border-radius: 999px;
  letter-spacing: .04em;
  border: 1px solid transparent;
}

.badge--published { background: #eef2e8; color: #4b5a3f; border-color: var(--sage-soft); }
.badge--draft { background: var(--paper-deep); color: var(--ink-faint); border-color: var(--rule); }
.badge--pending { background: #fdf1e3; color: #9a5f1d; border-color: #f0dcc3; }
.badge--approved { background: #eef2e8; color: #4b5a3f; border-color: var(--sage-soft); }
.badge--spam { background: #f7e8e2; color: #8a3b28; border-color: var(--accent-soft); }

.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }

.editor-main textarea {
  width: 100%;
  min-height: 26rem;
  font-family: var(--mono);
  font-size: .86rem;
  line-height: 1.75;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper-card);
  resize: vertical;
}

.editor-main textarea:focus { outline: none; border-color: var(--accent); }

.editor-title {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  padding: .6rem .2rem;
  border: none;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  margin-bottom: 1rem;
}

.editor-title:focus { outline: none; border-color: var(--accent); }

.editor-side { display: grid; gap: 1rem; position: sticky; top: 1.5rem; }

.editor-side .field input, .editor-side .field select, .editor-side .field textarea { font-size: .86rem; }

.editor-foot {
  display: flex;
  gap: .6rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.editor-foot .spacer { flex: 1; }

.preview-link { font-size: .8rem; color: var(--ink-faint); }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 23rem;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 2.4rem 2rem;
  box-shadow: var(--shadow-md);
}

.login-card h1 { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 .3rem; }
.login-card p { font-size: .84rem; color: var(--ink-faint); margin: 0 0 1.8rem; }

/* ---------- Utilities ---------- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.kbd {
  font-family: var(--mono);
  font-size: .74rem;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 .3rem;
  background: var(--paper-card);
}

.spinner {
  width: 1rem; height: 1rem;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.fade-up { animation: fadeUp .7s var(--ease) both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1060px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout { grid-template-columns: minmax(0, var(--measure)); justify-content: center; }
  .toc { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}

@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; }
  .feature__media { min-height: 220px; order: -1; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 1rem; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side__foot { margin: 0; display: flex; gap: .6rem; align-items: center; }
  .admin-main { padding: 1.5rem; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  .wrap { padding: 0 1.2rem; }
  .nav { gap: 1rem; }
  .nav__search { display: none; }
  .nav-toggle { display: inline-flex; }
  .site-header__inner { height: 60px; }
  .masthead { padding: 3.4rem 0 2.4rem; }
  .masthead__title { font-size: 2.3rem; }
  .post-grid { grid-template-columns: 1fr; }
  .post-row { grid-template-columns: 88px 1fr; gap: 1rem; }
  .post-row__thumb { width: 88px; }
  .post-row__date { display: none; }
  .article-header { padding: 3rem 0 1.6rem; }
  .article-hero { margin-bottom: 2rem; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .prose { font-size: 1.02rem; line-height: 1.9; }
  .data-table { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
