:root {
  --bg: #f7f4ee;
  --bg-elevated: rgba(255, 255, 255, 0.58);
  --bg-solid: #fbf9f4;
  --text: #171717;
  --muted: #645f58;
  --soft: #8b847a;
  --line: rgba(23, 23, 23, 0.11);
  --line-strong: rgba(23, 23, 23, 0.2);
  --accent: #5f7288;
  --accent-soft: rgba(95, 114, 136, 0.1);
  --quote: #534f49;
  --code-bg: #f1ede5;
  --code-inline-bg: rgba(95, 114, 136, 0.1);
  --selection: rgba(95, 114, 136, 0.18);
  --max: 1180px;
  --narrow: 780px;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.045);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--selection);
}

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

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

p,
ul,
ol,
blockquote,
pre,
table,
figure {
  margin: 0 0 1.35rem;
}

ul,
ol {
  padding-left: 1.3rem;
}

li + li {
  margin-top: 0.45rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  line-height: 1.08;
  font-weight: 600;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4rem 0;
}

.container {
  width: min(calc(100% - 3rem), var(--max));
  margin: 0 auto;
}

.container-narrow {
  width: min(calc(100% - 3rem), var(--narrow));
  margin: 0 auto;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(247, 244, 238, 0.78);
  border-bottom: 1px solid var(--line);
}

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

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.75rem;
}

.brand-mark {
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-text {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-nav a,
.footer-links a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 160ms ease;
}

.site-nav a:hover,
.footer-links a:hover,
.post-item-title a:hover,
.featured-title a:hover,
.archive-item h2 a:hover {
  color: var(--accent);
}

/* ---------- Hero / homepage ---------- */

.hero {
  padding: 7rem 0 3rem;
}

.hero-inner {
  max-width: 860px;
}

.eyebrow,
.section-label {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-title,
.article-title,
.page-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

i.hero-title {
  max-width: 11ch;
  font-size: clamp(2.8rem, 5.4vw, 4.6rem);
  line-height: 0.97;
  margin-bottom: 0.75rem;
}

.hero-summary {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.78;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 4rem;
  padding-bottom: 6rem;
}

.featured-post {
  padding: 2rem 2rem 2.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.featured-title {
  margin-bottom: 1.25rem;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.1rem, 4vw, 3.4rem);
}

.featured-summary {
  max-width: 52ch;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 1.04rem;
}

.recent-posts {
  padding-top: 0.25rem;
}

.section-head {
  margin-bottom: 1rem;
}

.post-item,
.archive-item {
  display: grid;
  gap: 1rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
}

.post-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.post-item:first-of-type {
  border-top: 1px solid var(--line-strong);
}

.post-item-title {
  margin-bottom: 0.45rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.post-item-summary,
.archive-main p,
.footer-note,
.meta-row,
.article-meta {
  color: var(--muted);
}

.post-item-summary {
  max-width: 54ch;
}

.post-item-meta,
.meta-row {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.meta-row span:not(:last-child)::after {
  content: "·";
  margin-left: 0.9rem;
  color: var(--soft);
}

/* ---------- Page / archive ---------- */

.archive-page {
  padding: 5rem 0 6rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
  margin-bottom: 0.5rem;
}

.archive-list {
  margin-top: 1rem;
}

.archive-item {
  grid-template-columns: 180px minmax(0, 1fr);
}

.archive-date {
  color: var(--muted);
  font-size: 0.95rem;
}

.archive-main h2 {
  margin-bottom: 0.4rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

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

.article-page {
  padding: 5rem 0 6rem;
}

.article-header {
  margin-bottom: 2.75rem;
  padding-bottom: 2.1rem;
  border-bottom: 1px solid var(--line);
}

.article-title {
  font-size: clamp(3rem, 6vw, 5rem);
  margin-bottom: 1rem;
}

.article-dek {
  max-width: 42rem;
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.75;
}

.article-meta {
  align-items: center;
}

.article-toc {
  margin: 0 0 2.4rem;
}

.article-toc-inner {
  padding: 1rem 1.15rem 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.34);
}

.article-toc-title {
  margin-bottom: 0.7rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.article-toc .toc,
.article-toc ul {
  margin: 0;
  padding-left: 1rem;
}

.article-toc li {
  margin-top: 0.3rem;
}

.article-toc a {
  color: var(--muted);
}

.article-toc a:hover {
  color: var(--accent);
}

.article-content {
  font-size: 1.08rem;
  color: var(--text);
}

.article-content > *:last-child {
  margin-bottom: 0;
}

.article-content p,
.article-content ul,
.article-content ol {
  max-width: 68ch;
}

.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5 {
  max-width: 24ch;
  margin-top: 2.8rem;
  margin-bottom: 0.95rem;
  letter-spacing: -0.025em;
}

.article-content h2 {
  font-size: 2.05rem;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}

.article-content h3 {
  font-size: 1.5rem;
  font-weight: 650;
}

.article-content h4 {
  font-size: 1.18rem;
  font-weight: 650;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(95, 114, 136, 0.35);
  text-underline-offset: 0.13em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.article-content a:hover {
  text-decoration-color: rgba(95, 114, 136, 0.75);
}

.article-content strong {
  font-weight: 700;
}

.article-content em {
  font-style: italic;
}

.article-content blockquote {
  max-width: 62ch;
  margin: 2rem 0;
  padding: 0.1rem 0 0.1rem 1.2rem;
  border-left: 2px solid var(--line-strong);
  color: var(--quote);
  font-style: italic;
}

.article-content blockquote p:last-child {
  margin-bottom: 0;
}

.article-content code,
.article-content pre code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
}

.article-content :not(pre) > code {
  padding: 0.16rem 0.42rem;
  border-radius: 0.45rem;
  background: var(--code-inline-bg);
  color: #394b60;
  white-space: nowrap;
}

.article-content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.article-content pre code {
  display: block;
  background: transparent;
  padding: 0;
  white-space: pre;
  color: var(--text);
}

.article-content .highlight,
.article-content .codehilite {
  max-width: 100%;
  margin: 1.5rem 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
  overflow: hidden;
}

.article-content .highlight pre,
.article-content .codehilite pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.article-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.article-content th,
.article-content td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.article-content th {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.32);
}

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

.article-content figure {
  margin: 2rem 0;
}

.article-content figure img {
  border-radius: 12px;
}

.article-content figcaption {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.article-content .footnote,
.article-content .footnotes {
  margin-top: 2.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.96rem;
}

.article-content .footnotes ol {
  padding-left: 1.15rem;
}

.article-content .footnotes li {
  margin-bottom: 0.7rem;
}

.article-content .footnote-ref,
.article-content .footnote-backref {
  text-decoration: none;
}

.article-content .toc {
  margin: 1.6rem 0 2rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.3);
}

.article-content .toc ul {
  margin: 0;
}

.article-content .toc > ul > li:first-child {
  margin-top: 0;
}

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

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem 0 2.5rem;
}

.footer-links {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

/* ---------- Utility polish ---------- */

.page-header .eyebrow,
.article-header .eyebrow {
  margin-bottom: 0.8rem;
}

.featured-post,
.article-toc-inner,
.article-content table,
.article-content .toc {
  backdrop-filter: blur(4px);
}

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

@media (max-width: 980px) {
  .home-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .post-item,
  .archive-item {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
  }

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

  .article-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }

  .hero-title {
    font-size: clamp(3rem, 12vw, 5rem);
  }
}

@media (max-width: 640px) {
  .container,
  .container-narrow {
    width: min(calc(100% - 1.5rem), var(--max));
  }

  .site-header {
    position: relative;
    backdrop-filter: none;
    background: rgba(247, 244, 238, 0.96);
    border-bottom: 1px solid var(--line);
  }

  .header-inner {
    padding: 0.5rem 0 0.45rem;
    gap: 0.35rem;
    align-items: flex-start;
  }

  .brand {
    gap: 0.45rem;
  }

  .brand-mark {
    font-size: 1.45rem;
  }

  .brand-text {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
  }

  .site-nav {
    width: 100%;
    gap: 0.85rem;
    row-gap: 0.25rem;
    margin-top: 0.05rem;
  }

  .site-nav a {
    font-size: 0.86rem;
  }

  .hero {
    padding: 1.15rem 0 0.8rem;
  }

  .hero-inner {
    max-width: 100%;
  }

  .eyebrow,
  .section-label {
    margin-bottom: 0.45rem;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
  }

  .hero-title {
    max-width: 9ch;
    font-size: 3.1rem;
    line-height: 0.94;
    margin-bottom: 0.6rem;
  }

  .hero-summary {
    font-size: 0.94rem;
    line-height: 1.55;
    max-width: 18rem;
  }

  .home-grid {
    gap: 1.2rem;
    padding-bottom: 2.5rem;
  }

  .featured-post {
    padding: 1rem;
    margin-top: 0;
    border-radius: 16px;
  }

  .featured-title {
    font-size: 1.85rem;
    line-height: 1.01;
    margin-bottom: 0.7rem;
  }

  .featured-summary {
    font-size: 0.94rem;
    line-height: 1.55;
    margin-bottom: 0.75rem;
  }

  .post-item {
    padding: 0.8rem 0;
    gap: 0.4rem;
  }

  .post-item-title {
    font-size: 1.02rem;
    line-height: 1.08;
  }

  .post-item-summary {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .post-item-meta,
  .meta-row {
    font-size: 0.8rem;
    gap: 0.45rem;
  }

  .meta-row span:not(:last-child)::after {
    margin-left: 0.45rem;
  }

  .article-page {
    padding: 2.75rem 0 4rem;
  }

  .article-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }

  .article-title {
    font-size: 2.5rem;
    line-height: 0.98;
  }

  .article-dek {
    font-size: 1rem;
    line-height: 1.65;
  }

  .article-content {
    font-size: 1rem;
  }

  .article-content h2 {
    font-size: 1.7rem;
  }

  .article-content h3 {
    font-size: 1.28rem;
  }

  .article-content pre,
  .article-content .highlight,
  .article-content .codehilite,
  .article-content table {
    font-size: 0.9rem;
  }

  .article-content :not(pre) > code {
    white-space: normal;
  }

  .archive-page {
    padding: 3rem 0 4rem;
  }

  .page-title {
    font-size: 2.4rem;
  }
}
