/* =============================================================================
   blog.css — public-facing minimalist stylesheet
   Mobile-first. No framework, no JavaScript. Served as one shared file at
   /styles/blog.css. Athelas serif headlines + Sweet Sans Pro UI + warm palette.
   Tokens are inlined here (no @import) so a single GET delivers the whole
   stylesheet, and the published pages stay self-contained.
   ============================================================================= */

/* ---------- Athelas (serif, headlines/editorial) ---------- */
@font-face {
  font-family: "Athelas";
  src: url("/fonts/Athelas-Regular-Pro.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Athelas";
  src: url("/fonts/Athelas-Pro-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Athelas";
  src: url("/fonts/Athelas-Pro-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Sweet Sans Pro (sans, UI/eyebrows/wordmark) ---------- */
@font-face {
  font-family: "Sweet Sans Pro";
  src: url("/fonts/SweetSansPro-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sweet Sans Pro";
  src: url("/fonts/SweetSansPro-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sweet Sans Pro";
  src: url("/fonts/SweetSansPro-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* =============================================================================
   Brand tokens
   ============================================================================= */
:root {
  --c-obsidian: #111416;
  --c-ivory: #f7f6f0;
  --c-ivory-warm: #fbfaf4;
  --c-ivory-cool: #efeee7;
  --c-sand: #e2d1bc;
  --c-sand-soft: #eee3d3;
  --c-forest: #38492d;
  --c-forest-deep: #2a3722;

  --bg: var(--c-ivory);
  --fg: var(--c-obsidian);
  --fg-2: rgba(17, 20, 22, 0.78);
  --fg-3: rgba(17, 20, 22, 0.58);
  --border: rgba(17, 20, 22, 0.12);
  --accent: var(--c-forest);
  --code-bg: var(--c-ivory-cool);

  --serif: "Athelas", "Cormorant Garamond", Georgia, serif;
  --sans: "Sweet Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
}

/* No dark-mode override — the brand is light by design (Pearl Ivory). */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg-2);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--c-sand);
  color: var(--c-obsidian);
}

/* =============================================================================
   Layout — generous whitespace, narrow editorial column
   ============================================================================= */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 600px) {
  .container {
    max-width: 680px;
    padding: 0 1.5rem;
  }
}
@media (min-width: 1024px) {
  .container {
    max-width: 760px;
    padding: 0 2rem;
  }
}

/* =============================================================================
   Header / nav — sticky at scroll, ivory at 88% with backdrop blur
   ============================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247, 246, 240, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
}

.site-title {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
}

.site-nav a {
  margin-left: 1.75rem;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-decoration: none;
  transition: color 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.site-nav a:hover {
  color: var(--accent);
}

main {
  padding: 4rem 0 2rem;
}

/* =============================================================================
   Editorial typography — Athelas serif scales fluidly
   ============================================================================= */
h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.18;
  color: var(--fg);
  margin-top: 2.4em;
  margin-bottom: 0.5em;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.012em;
  margin-top: 0.2em;
}
h2 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
}
/* h3 is sans wide-tracked uppercase per the brand — used as section labels in long-form posts */
h3 {
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}
h4 {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
}

p,
ul,
ol,
blockquote {
  margin: 1em 0;
}

article {
  max-width: 65ch;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-thickness 140ms;
}
a:hover {
  text-decoration-thickness: 2px;
}

blockquote {
  border-left: 2px solid var(--c-forest);
  padding-left: 1.25rem;
  color: var(--fg-2);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.5;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1.1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.92em;
  line-height: 1.55;
}
pre code {
  background: transparent;
  padding: 0;
  border: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem auto;
  width: 100%;
}

/* =============================================================================
   Article header — eyebrow + meta line
   ============================================================================= */
.post-meta {
  font-family: var(--sans);
  color: var(--fg-3);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0.75rem 0 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
}
.post-meta time {
  letter-spacing: 0.18em;
}
.post-meta > * + *::before {
  content: "·";
  margin-right: 1rem;
  color: var(--fg-3);
}

/* =============================================================================
   Tags — pill chips with hairline border
   ============================================================================= */
.post-tags {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
}
.post-tags a {
  display: inline-block;
  margin: 0 0.5rem 0.5rem 0;
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  background: var(--c-ivory-warm);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  transition: all 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.post-tags a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--c-ivory);
}

/* =============================================================================
   Cover image
   ============================================================================= */
.post-cover {
  margin: 0 0 2.5rem;
  border-radius: 0;
  overflow: hidden;
}
.post-cover img,
.post-cover picture {
  display: block;
  width: 100%;
  height: auto;
}

article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: 2px;
}

/* =============================================================================
   Index / list pages
   ============================================================================= */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-list li {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list li:last-child {
  border-bottom: none;
}
.post-list h2 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 1.1rem + 0.6vw, 1.6rem);
  letter-spacing: -0.01em;
  line-height: 1.18;
}
.post-list h2 a {
  color: inherit;
  text-decoration: none;
  transition: color 220ms;
}
.post-list h2 a:hover {
  color: var(--accent);
}
.post-list p {
  margin: 0;
  color: var(--fg-2);
  font-size: 0.98rem;
}

/* The eyebrow line above each post in the list */
.post-list time,
.post-list .meta {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* =============================================================================
   Tap targets — 44px on small screens
   ============================================================================= */
@media (max-width: 599px) {
  .site-nav a,
  .post-list h2 a,
  .post-tags a {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
}

/* =============================================================================
   Heading anchors from rehype-autolink-headings
   ============================================================================= */
.heading-anchor {
  color: inherit;
  text-decoration: none;
}
.heading-anchor:hover {
  color: var(--accent);
}

/* =============================================================================
   Template 2 — MAGAZINE
   Full-bleed cover image with the title overlaid bottom-left over a soft
   gradient. Body falls back to the standard reading column. Use for posts with
   a strong, story-leading photograph.
   ============================================================================= */
.tpl-magazine .magazine-hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  height: clamp(380px, 60vh, 720px);
  overflow: hidden;
  background: var(--c-obsidian);
}
.tpl-magazine .magazine-hero picture,
.tpl-magazine .magazine-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tpl-magazine .magazine-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(17, 20, 22, 0) 30%,
    rgba(17, 20, 22, 0.78) 100%
  );
  pointer-events: none;
}
.tpl-magazine .magazine-hero__copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(2rem, 5vw, 4rem);
  padding-left: clamp(1rem, 5vw, 4rem);
  padding-right: clamp(1rem, 5vw, 4rem);
  color: var(--c-ivory);
  z-index: 1;
}
.tpl-magazine .magazine-hero__eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 0 0 1rem;
}
.tpl-magazine .magazine-hero__title {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.05;
  font-size: clamp(2.2rem, 5.4vw, 4.5rem);
  max-width: 18ch;
  margin: 0;
  color: var(--c-ivory);
}
.tpl-magazine .magazine-hero__meta {
  margin-top: 1.25rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
}
.tpl-magazine main {
  padding-top: 3rem;
}
.tpl-magazine article {
  margin: 0 auto;
}

/* =============================================================================
   Template 3 — CENTERED (letterpress / journal)
   Sand-tinted page, centered eyebrow + serif H1 + meta, drop-cap on the first
   paragraph. Cover image is shown as a small framed inline figure if present.
   Use for thoughtful long-form prose.
   ============================================================================= */
.tpl-centered {
  background: var(--c-sand-soft);
}
.tpl-centered .site-header {
  background: rgba(238, 227, 211, 0.88);
  border-bottom-color: rgba(17, 20, 22, 0.08);
}
.tpl-centered main {
  padding: clamp(3rem, 8vw, 6rem) 0 2rem;
}
.tpl-centered .container {
  max-width: 720px;
}
.tpl-centered article {
  max-width: 60ch;
  margin: 0 auto;
}
.tpl-centered .centered-header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.tpl-centered .centered-eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 1.5rem;
}
.tpl-centered .centered-header h1 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.05;
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  margin: 0;
  color: var(--c-obsidian);
}
.tpl-centered .centered-header .lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--fg-2);
  max-width: 36ch;
  margin: 1.5rem auto 0;
  line-height: 1.5;
}
.tpl-centered .centered-meta {
  margin-top: 2rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.tpl-centered .centered-meta > * + *::before {
  content: "·";
  margin: 0 0.7em;
  color: var(--fg-4);
}
.tpl-centered .centered-divider {
  display: block;
  width: 64px;
  height: 1px;
  background: var(--c-forest);
  margin: 2.25rem auto 0;
  opacity: 0.55;
}
.tpl-centered .centered-cover {
  margin: 0 0 2.5rem;
}
.tpl-centered .centered-cover img,
.tpl-centered .centered-cover picture {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}
/* Drop-cap on the first paragraph of the body */
.tpl-centered article > div > p:first-of-type::first-letter {
  font-family: var(--serif);
  float: left;
  font-size: 4.6em;
  line-height: 0.85;
  margin: 0.05em 0.08em 0 -0.05em;
  color: var(--c-forest);
  font-style: italic;
}

/* =============================================================================
   Site footer
   ============================================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 5rem;
  padding: 2.5rem 0;
  color: var(--fg-3);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.site-footer a {
  color: inherit;
}
