@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=SN+Pro:ital,wght@0,300..700;1,300..700&display=swap');

/* ---------- design tokens ---------- */
:root, .journal {
  --content: 1140px;         /* default width: list, post header, footer, chrome */
  --measure: 840px;          /* narrower reading column for the post body */
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'SN Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bg: #ffffff;
  --bg-alt: #faf9f7;
  --bg-sunk: #f3f1ec;
  --text: #1b1b1b;
  --text-soft: #54514c;
  --muted: #8d8a84;
  --border: #ece8e1;
  --border-strong: #ddd8cf;
  --accent: #2f7d6e;
  --accent-soft: rgba(47, 125, 110, 0.10);
  --shadow: 0 1px 2px rgba(20, 18, 14, 0.04), 0 8px 28px rgba(20, 18, 14, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
}

:root[data-theme="dark"], :root[data-theme="dark"] .journal {
  --bg: #0e0f12;
  --bg-alt: #14161b;
  --bg-sunk: #1a1d23;
  --text: #ece9e4;
  --text-soft: #b3afa8;
  --muted: #7f7c76;
  --border: #23262d;
  --border-strong: #2f333b;
  --accent: #5cc0aa;
  --accent-soft: rgba(92, 192, 170, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 34px rgba(0, 0, 0, 0.45);
}

.journal { background: var(--bg); color: var(--text); font: 17px/1.65 var(--font-sans); letter-spacing: normal; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.journal *, .journal *::before, .journal *::after { box-sizing: border-box; }
.journal img { max-width: 100%; height: auto; display: block; }
.journal a { color: inherit; text-decoration: none; }
.journal ::selection { background: rgba(116, 201, 198, .45); color: inherit; }
.theme-toggle {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #0e0f12;
  color: #ffffff;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.theme-toggle:hover { border-color: var(--accent); }
:root[data-theme="dark"] .theme-toggle { background: #ffffff; color: #0e0f12; }
.theme-toggle svg { width: 26px; height: 26px; fill: currentColor; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: inline; }
.page-head {
  padding: var(--gutter) var(--gutter) 0;
  max-width: var(--content);
  margin: 0 auto;
  width: 100%;
}
.page-head :is(h1, h2) {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 4.6vw, 3.4rem);
  letter-spacing: -.02em;
  margin: .2rem 0 .4rem;
}
.page-head p { color: var(--text-soft); font-size: 1.22rem; margin: 0; max-width: 60ch; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: .86rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.post-list {
  max-width: var(--content);
  width: 100%;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.75rem) var(--gutter) var(--gutter);
  display: flex;
  flex-direction: column;
}
.blog-card {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}
.blog-card:first-child { border-top: 0; }
.card-media {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.blog-card:hover .card-media img { transform: scale(1.03); }
.card-meta { font-size: .94rem; color: var(--muted); display: flex; gap: .6rem; align-items: center; }
.card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.blog-card :is(h2, h3) {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -.015em;
  margin: .6rem 0 .5rem;
}
.blog-card:hover :is(h2, h3) { color: var(--accent); }
.blog-card p { color: var(--text-soft); margin: 0 0 .9rem; font-size: 1.18rem; }
.read-more {
  font-size: .96rem; font-weight: 600; color: var(--accent);
  display: inline-flex; align-items: center; gap: .35rem;
}
.read-more svg { width: 16px; height: 16px; transition: transform .2s; }
.blog-card:hover .read-more svg { transform: translateX(3px); }
.tag-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.tag {
  font-size: .84rem; font-weight: 500; color: var(--text-soft);
  background: var(--bg-sunk); border: 1px solid var(--border);
  padding: .18rem .6rem; border-radius: 999px;
}

.post { width: 100%; }
.post-header {
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) clamp(1.5rem, 3vw, 2.25rem);
}
.post-header-inner { max-width: var(--measure); margin: 0 auto; }
.post-header .eyebrow { margin-bottom: 1rem; }
.post-header h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -.025em;
  margin: 0 0 .9rem;
}
.post-sub {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  line-height: 1.4;
  color: var(--text-soft);
  margin: 0 0 1.6rem;
  font-weight: 400;
}
.byline {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--font-sans);
  font-size: 1rem; color: var(--muted);
  margin: 0;
}
.byline .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.byline strong { color: var(--text); font-weight: 600; }

/* ---------- hero sits BEHIND the header (image + scrim, text on top) ---------- */
.post-header.has-hero {
  position: relative;
  background-size: cover;
  background-position: center;
  color: #fff;
  padding-top: clamp(4rem, 12vw, 8rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}
.post-header.has-hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(10, 12, 16, .45), rgba(10, 12, 16, .8));
}
.post-header.has-hero .post-header-inner { position: relative; }
.post-header.has-hero .eyebrow { color: #fff; opacity: .9; }
.post-header.has-hero h1 { color: #fff; }
.post-header.has-hero .post-sub { color: rgba(255, 255, 255, .9); }
.post-header.has-hero .byline { color: rgba(255, 255, 255, .82); }
.post-header.has-hero .byline strong { color: #fff; }
.post-header.has-hero .byline .dot { background: rgba(255, 255, 255, .5); }
.post-header.has-hero .tag {
  color: #fff;
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .3);
}

/* full-bleed hero — spans the whole main column, deliberately */
.blog-hero {
  margin: 0 0 clamp(2rem, 5vw, 3.5rem);
  width: 100%;
}
.blog-hero img {
  width: 100%;
  max-height: 62vh;
  object-fit: cover;
}
.blog-hero figcaption { text-align: center; }

/* ---------- prose: centered reading column with break-out grid ---------- */
.prose {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [content-start] min(var(--measure), 100% - (var(--gutter) * 2)) [content-end]
    minmax(var(--gutter), 1fr) [full-end];
  padding-bottom: clamp(3rem, 8vw, 6rem);
}
.prose > * { grid-column: content; }
.prose > .full-bleed { grid-column: full; }

.prose > p,
.prose > ul,
.prose > ol,
.prose > h2,
.prose > h3,
.prose > h4,
.prose > hr,
.prose > pre,
.prose > table,
.prose > figure,
.prose > blockquote { margin-top: 0; }

.prose > * + * { margin-top: 1.35rem; }
/* posts that open with body text (no leading header) get a full header's worth of breathing room under the hero */
.prose > p:first-child { margin-top: clamp(5rem, 12vw, 8rem); }
.prose > h2 { margin-top: 2.8rem; }
.prose > h3 { margin-top: 2rem; }
.prose > figure + *,
.prose > pre + *,
.prose > .full-bleed + * { margin-top: 2rem; }

.prose p, .prose li {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);   /* matches the post subhead */
  line-height: 1.72;
}
.prose h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.95rem, 3.4vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -.02em;
}
.prose h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.6vw, 1.72rem);
  line-height: 1.25;
}
.prose h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-soft);
}
.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: color .15s, text-decoration-color .15s;
}
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.prose strong { font-weight: 600; color: var(--text); }
.prose em { font-style: italic; }

.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-top: .45rem; }
.prose li::marker { color: var(--accent); }

/* opt-out list with a bold red ✕ marker (reliable color, no emoji-font dependency) */
.prose ul.no-list { list-style: none; padding-left: 0; }
.prose ul.no-list li { position: relative; padding-left: 2rem; }
.prose ul.no-list li::before {
  content: "\2715";              /* ✕ multiplication x */
  position: absolute;
  left: 0;
  top: 0;
  color: #e5484d;
  font-weight: 700;
  font-size: 1.05em;
}

/* blockquote — body-size, italic, lightly indented */
.prose blockquote {
  grid-column: content;
  margin-inline: 0;
  padding: .15rem 0 .15rem clamp(1rem, 2.5vw, 1.5rem);
  border-left: 3px solid var(--accent);
}
.prose blockquote p {
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  line-height: 1.55;
  color: var(--text);
  font-weight: 400;
  font-style: italic;
}
.prose blockquote p:first-child { margin-top: 0; }

/* soft-quote — the secondary, card-style pull-quote (shared with .role-quote) */
.prose blockquote.soft-quote {
  border-left: 0;
  padding: 1.4rem 1.6rem 1.3rem 2.6rem;
  margin: 1.8rem 0;
  font-size: clamp(1.3rem, 2.7vw, 1.62rem);   /* a touch larger than body text */
  line-height: 1.5;
}

/* inline figures / images inside prose stay within the column, centered */
.prose figure { margin-left: 0; margin-right: 0; }
.prose img { border-radius: var(--radius-sm); margin-inline: auto; }
.prose figure img { width: 100%; }
figcaption {
  font-family: var(--font-sans);
  font-size: .95rem;
  color: var(--muted);
  margin-top: .7rem;
  line-height: 1.5;
}

/* inline raw <img> from authored markdown — keep tidy & centered */
.prose > p > img,
.prose > img {
  margin: .4rem auto;
  border: 1px solid var(--border);
  background: var(--bg-sunk);
}

/* code */
.prose code {
  font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  font-size: .88em;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .1em .4em;
}
.prose pre {
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.3rem;
  overflow-x: auto;
  font-size: .92rem;
  line-height: 1.6;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

/* tables */
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 1.1rem;
}
.prose th, .prose td { padding: .65rem .8rem; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { font-weight: 600; color: var(--text); border-bottom-color: var(--border-strong); }

.prose hr { border: 0; height: 1px; background: var(--border); margin: 2.75rem 0; }

/* ---------- bento / gallery — deliberate full-bleed grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: clamp(.6rem, 1.5vw, 1rem);
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.bento img, .bento figure {
  margin: 0;
  width: 100%;
  height: 100%;
}
.bento img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.bento .span-2 { grid-column: span 2; }
.bento .span-2 img { aspect-ratio: 2 / 1; }
.bento .tall img { aspect-ratio: 1 / 1.4; }

/* placeholder callout for [PLACEHOLDER: ...] author notes */
.placeholder {
  font-family: var(--font-sans) !important;
  font-size: .9rem !important;
  color: var(--muted);
  background: var(--bg-sunk);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .85rem 1.1rem;
}

/* two images side by side */
.img-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(.75rem, 2vw, 1.25rem);
  align-items: start;
}
.img-row img {
  width: 100%;
  margin: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-sunk);
}

/* compact, side-by-side tool lists — framed band keeps the section short + intentional */
.tool-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin: 2.25rem 0;
  padding: 1.7rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tool-cols .tool-head {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .85rem;
}
.tool-cols ul { margin: 0; padding: 0; list-style: none; }
.tool-cols li {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  line-height: 1.4;
  margin-top: .5rem;
  padding-left: 1rem;
  position: relative;
  color: var(--text-soft);
}
.tool-cols li::before {
  content: "";
  position: absolute;
  left: 0; top: .6em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .55;
}

/* content images are clickable to zoom */
.prose img, .img-row img, .bento img { cursor: zoom-in; }

/* ---------- lightbox: zoom an image into a spotlight ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: clamp(1rem, 5vmin, 4rem);
  background: rgba(8, 9, 12, .82);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  cursor: zoom-out;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: 92vw; max-height: 92vh;   /* always fit within the viewport, both axes */
  width: auto; height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  transform: scale(.92);
  transition: transform .32s cubic-bezier(.2, .8, .25, 1);
  cursor: default;
}
.lightbox.open img { transform: scale(1); }

/* ============================================================
   Footer
   ============================================================ */
.site-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 2rem var(--gutter);
}
.site-foot-inner {
  max-width: var(--content); margin: 0 auto; width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  font-size: .95rem; color: var(--muted);
}
.site-foot a { color: var(--text-soft); text-decoration: underline; text-underline-offset: 3px; }
.site-foot a:hover { color: var(--accent); }

@media (max-width: 620px) {
  .blog-card { grid-template-columns: 1fr; gap: 1rem; }
  .card-media { aspect-ratio: 16 / 9; }
  .prose blockquote { margin-inline: 0; }
  .img-row { grid-template-columns: 1fr; }
  .tool-cols { grid-template-columns: 1fr; gap: 1.25rem; }
}

.soft-quote {
  position: relative;
  margin: 1.6rem 0 0;
  padding: 1.5rem 1.6rem 1.4rem 2.6rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  line-height: 1.45;
  color: var(--text);
}
.soft-quote::before {
  content: "\201C";
  position: absolute;
  left: .55rem; top: .35rem;
  font-family: var(--font-serif);
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
  opacity: .35;
}

.blog-page { margin: 0; }
.blog-nav { max-width: var(--content); margin: 0 auto; padding: 1rem var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.blog-nav a { text-decoration: underline; text-underline-offset: 4px; }
.blog-section { position: relative; z-index: 30; min-height: 100vh; padding: 3rem 0 5rem; }
.blog-section .page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.blog-section .page-head h2 { margin: 0; }
.blog-section .theme-toggle { flex-shrink: 0; }
.blog-section .post-list { padding-top: 1rem; }
.blog-section .blog-card:first-child { padding-top: 1rem; }
.journal :focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
@media (min-width: 861px) { .blog-section { padding-left: 200px; } }
@media (max-width: 860px) { .blog-section { padding-bottom: 9rem; } }
@media (prefers-reduced-motion: reduce) { .journal *, .journal *::before, .journal *::after { transition: none !important; animation: none !important; } }
