/* ==========================================
   Blog post — ja.mt-style minimal article
   Self-contained: doesn't depend on the main site's styles.css
   ========================================== */

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

:root {
  --paper: #faf6f2;
  --ink: #1c1815;
  --ink-soft: #73574a;
  --ink-faint: #9a918a;
  --rule: rgba(28, 25, 23, 0.08);
  --rule-strong: rgba(28, 25, 23, 0.18);
  --accent: #e36209;

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --ease-out: cubic-bezier(0, 0, .2, 1);
}

[data-theme="dark"] {
  --paper: #1c1917;
  --ink: #efe9e0;
  --ink-soft: #b8aea3;
  --ink-faint: #877c72;
  --rule: rgba(239, 233, 224, 0.09);
  --rule-strong: rgba(239, 233, 224, 0.18);
  --accent: #e07a5f;
}

html {
  background: var(--paper);
  scroll-padding-top: 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--sans);
  font-size: 16px; font-weight: 400; line-height: 1.55;
  color: var(--ink-soft);
  background: var(--paper);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }

/* ===========================
   View Transition (paired with the index)
   =========================== */
@view-transition { navigation: auto; }
.post__hero { view-transition-name: post-hero; }
::view-transition-group(post-hero) {
  animation-duration: .46s;
  animation-timing-function: cubic-bezier(.22, 1, .36, 1);
}
@keyframes article-content-in { from { opacity: 0; } to { opacity: 1; } }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .32s;
  animation-timing-function: ease-out;
}

/* ===========================
   Back nav (top-left chevron, like ja.mt)
   =========================== */
.post-back {
  position: fixed;
  top: 24px;
  left: max(20px, calc(50% - 400px));
  z-index: 10;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  transition: color .15s var(--ease-out), background .15s var(--ease-out),
              border-color .15s var(--ease-out), transform .2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.post-back:hover {
  color: var(--ink);
  background: rgba(28, 25, 23, 0.04);
  border-color: var(--rule);
  transform: translateX(-2px);
}
[data-theme="dark"] .post-back:hover { background: rgba(239, 233, 224, 0.05); }

/* ===========================
   Article
   =========================== */
.post {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

.post__hero {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--rule-strong);
  margin-bottom: 40px;
  background: var(--rule);
  transform-origin: 0 0;
}

.post__title {
  font-family: var(--display);
  font-variation-settings: "opsz" 60, "wght" 400, "SOFT" 60;
  font-style: normal;
  font-size: clamp(28px, 4.2vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin-bottom: 6px;
  text-wrap: balance;
}
.post__title em {
  font-style: italic;
  font-variation-settings: "opsz" 60, "wght" 400, "SOFT" 100, "WONK" 1;
  color: var(--accent);
}

.post__date {
  font-family: var(--display);
  font-variation-settings: "opsz" 14, "wght" 380, "SOFT" 60;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-faint);
  margin-bottom: 36px;
  letter-spacing: 0.01em;
}

/* ===========================
   Body
   =========================== */
.post__body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-soft);
  font-weight: 400;
}
.post__body > * + * { margin-top: 1.1em; }

.post__body p { text-wrap: pretty; }
.post__body strong { color: var(--ink); font-weight: 600; }
.post__body em { font-style: italic; color: var(--ink); }

/* Headings */
.post__body h2 {
  font-family: var(--display);
  font-variation-settings: "opsz" 60, "wght" 380, "SOFT" 80, "WONK" 1;
  font-style: italic;
  font-size: clamp(22px, 3vw, 26px);
  line-height: 1.2;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-top: 2.2em;
  margin-bottom: 0.4em;
}

/* Pullquote — italic Fraunces, no border, no card */
.post__pull {
  font-family: var(--display);
  font-variation-settings: "opsz" 72, "wght" 360, "SOFT" 80, "WONK" 1;
  font-style: italic;
  font-size: clamp(22px, 3vw, 26px);
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--ink);
  max-width: 28ch;
  margin-top: 1.6em;
  margin-bottom: 1.6em;
  text-wrap: pretty;
}

/* Lists */
.post__body ul {
  list-style: none;
  padding-left: 0;
}
.post__body ul li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 0.4em;
}
.post__body ul li::before {
  content: '·';
  position: absolute;
  left: 6px; top: -0.05em;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.4em;
  line-height: 1;
}

/* Dialogue (the chat-spiral) — italic, narrow, quietly indented */
.post__dialogue {
  font-family: var(--display);
  font-variation-settings: "opsz" 24, "wght" 380, "SOFT" 60;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
  margin: 1.6em auto;
  max-width: 26ch;
  padding-left: 18px;
}
.post__dialogue p { margin-bottom: 4px; line-height: 1.5; }
.post__dialogue p + p { margin-top: 0; }

/* Steps — clean numbered list */
.post__steps {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
  margin-top: 1.4em;
}
.post__steps li {
  counter-increment: step;
  position: relative;
  padding-left: 38px;
  margin-bottom: 1.2em;
  min-height: 28px;
}
.post__steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.post__steps li strong {
  display: block;
  font-family: var(--display);
  font-variation-settings: "opsz" 24, "wght" 400, "SOFT" 80;
  font-style: italic;
  font-size: 18px;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 2px;
  font-weight: 400;
}

/* CTA at the end of the post */
.post__cta-wrap { margin-top: 2.4em !important; }
.post__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  padding: 14px 24px;
  border-radius: 100px;
  transition: background .2s var(--ease-out), transform .2s var(--ease-out);
}
.post__cta span { display: inline-block; transition: transform .2s var(--ease-out); }
.post__cta:hover { background: var(--accent); transform: translateY(-1px); }
.post__cta:hover span { transform: translateX(3px); }

/* Footer at the very bottom — quiet, just a line */
.post__foot {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 600px) {
  .post { padding: 48px 20px 80px; }
  .post__hero { margin-bottom: 28px; border-radius: 8px; }
  .post__date { margin-bottom: 28px; }
  .post-back { top: 16px; left: 14px; }
  .post__body { font-size: 16px; }
}

/* Published essays: images, captions, and linked notes. */
.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 680px;
  padding: 16px 20px 0;
  margin: 0 auto;
}
.post-nav .post-back { position: static; }
.post--essay { max-width: 680px; padding: 24px 20px 100px; }
.post--essay .post__body { font-size: 16.5px; line-height: 1.7; }
.post--essay .post__title {
  font-variation-settings: "opsz" 60, "wght" 420, "SOFT" 70, "WONK" 1;
  font-style: italic;
  font-size: clamp(28px, 4.2vw, 34px);
  line-height: 1.05;
  margin-bottom: 28px;
}
/* Month and year above the title, like a project page's eyebrow. */
.post--essay .post__date {
  font-family: var(--sans);
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
/* Closing button: the same pill that ends a project page. */
.post--essay .post__foot { margin-top: 56px; padding-top: 0; border-top: 0; text-align: left; }
.post__more {
  display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase; color: var(--paper); background: var(--ink);
  padding: 13px 26px; border-radius: 100px;
  transition: background .2s var(--ease-out), transform .2s var(--ease-out);
}
.post__more:hover { background: var(--accent); transform: scale(1.02); }
.post__more-arrow { display: inline-block; transition: transform .2s var(--ease-out); }
.post__more:hover .post__more-arrow { transform: translateX(3px); }

/* Pause at the main turns in the essay without changing the reading size. */
.post--essay .post__body > .post__pause { margin-top: 2.4em; }
.post--essay .post__body strong { font-weight: 600; }
/* Italic is a change of voice, not a shout: a shade between the text and the ink. */
.post--essay .post__body em { color: var(--ink-soft); color: color-mix(in oklab, var(--ink) 45%, var(--ink-soft)); }

/* Highlighted lines: the project pull-quote type, set inline so ordinary
   text can follow in the same paragraph. line-height 1 keeps the line box
   close to the body rhythm. */
.post--essay .post__hl {
  font-family: var(--display); font-variation-settings: "opsz" 36, "wght" 360, "SOFT" 50;
  font-style: italic; font-size: 24px; line-height: 1; color: var(--ink);
  padding-right: .08em; /* room for the italic overhang before upright text */
}

.post__figure { margin-block: 2em; }
.post__figure:first-child { margin-top: 0; }
.post__figure--hero { margin-bottom: 28px; }
.post__figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  margin: 0;
}
.post__figure figcaption {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
}

/* Illustrations mark the essay's turns: a little wider than the reading
   column on desktop, aligned with the fixed nav buttons, and dimmed slightly
   so their cream paper doesn't glare against the dark theme. */
.post__figure--illustration { margin-block: 2.4em; }
.post__figure--illustration img { filter: var(--illustration-tone, none); }
[data-theme="dark"] .post__figure--illustration { --illustration-tone: brightness(.86); }
@media (min-width: 900px) {
  .post--essay .post__figure--illustration { margin-inline: -80px; }
}
/* Each one rises into place as it enters, and its purple ink settles in by
   the time it reaches the middle of the screen. Scroll-linked, so it never
   strands an image half-revealed; unsupported browsers show it as is. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .post__figure--illustration {
      animation: illustration-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 75%;
    }
    .post__figure--illustration img {
      animation: illustration-ink linear both;
      animation-timeline: view();
      animation-range: entry 40% cover 45%;
    }
  }
}
@keyframes illustration-rise {
  from { opacity: 0; transform: translateY(48px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes illustration-ink {
  from { filter: grayscale(1) contrast(1.08) var(--illustration-tone, ); }
  to { filter: grayscale(0) contrast(1) var(--illustration-tone, ); }
}
.post__figure sup, .post__body sup {
  font-size: .75em;
  line-height: 0;
  vertical-align: super;
  margin-left: .2em;
}
.post__figure sup a, .post__body sup a { padding: 4px 2px; }
.post__figure sup a:hover, .post__body sup a:hover { color: var(--accent); }

.post__footnotes {
  border-top: 1px solid var(--rule-strong);
  margin-top: 48px;
  padding-top: 24px;
  font-size: 14px;
  line-height: 1.65;
}
.post__footnotes h2 {
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
}
.post__footnotes ol { padding-left: 1.5em; }
.post__footnotes li { padding-left: .35em; }
.post__footnotes li + li { margin-top: 1em; }
.post__footnote-back { padding: 4px; color: var(--ink); }
.post__footnotes :target, .post__figure sup a:target, .post__body sup a:target {
  outline: 2px solid var(--rule-strong);
  outline-offset: 4px;
}

.post-nav .post-back, .post-theme { background: var(--paper); }
.post-nav .post-back { border-color: var(--rule-strong); }
.post-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  cursor: pointer;
}
.post-theme:hover { color: var(--ink); border-color: var(--rule-strong); }
.post-theme__sun, [data-theme="dark"] .post-theme__moon { display: none; }
[data-theme="dark"] .post-theme__sun { display: block; }
.post-skip {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -200%);
  padding: 8px 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
}
.post-skip:focus { transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .post-nav { padding-inline: 16px; }
  .post--essay { padding: 16px 16px 80px; }
}
@media (min-width: 840px) {
  .post-nav { padding: 0; }
  .post-nav .post-back { position: fixed; top: 24px; left: calc(50% - 400px); }
  .post-theme { position: fixed; top: 24px; right: calc(50% - 400px); }
}
@media (prefers-reduced-motion: no-preference) {
  .article-entrance .post__hero { animation: article-content-in .46s cubic-bezier(.22, 1, .36, 1) both; }
  .article-entrance.article-zoom .post__hero { animation: none; }
  .article-entrance .post__content,
  .article-entrance .post__figure--hero figcaption,
  .article-entrance .post-nav,
  .article-entrance .post__foot { animation: article-content-in .38s cubic-bezier(0, 0, .2, 1) .46s both; }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .post-back { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
}
