/* After the Prompt — Cream & clay */

:root {
  --col: 40rem;
  --paper: #f4efe6;
  --ink: #3a322c;
  --accent: #a36b4f;
  --muted: #8a6f5e;
  --olive: #6b7f5a;
}

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

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

body {
  margin: 0;
  padding: 0;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 1.18rem;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(163, 107, 79, 0.07), transparent 50%),
    radial-gradient(ellipse at 100% 80%, rgba(163, 107, 79, 0.05), transparent 45%);
  min-height: 100vh;
}

.site-header {
  max-width: var(--col);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

.site-nav {
  display: flex;
  /* Centred, not baseline-aligned: the title is now a lockup whose first flex
     item is the mark, and an image's baseline is its bottom edge, which drops
     the nav links below the wordmark. */
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.site-mark {
  width: 1.15em;
  height: 1.15em;
  display: block;
  flex: none;
}

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

.nav-link {
  font-size: 1rem;
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  border-bottom-color: var(--accent);
}

.site-main {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0.5rem 1.5rem 4rem;
}

.rule {
  border: none;
  border-top: 1px solid var(--accent);
  opacity: 0.35;
  margin: 2.25rem 0;
}

.hello {
  margin: 0 0 2.75rem;
  line-height: 1.75;
  color: var(--ink);
}

.featured {
  margin-bottom: 0.5rem;
}

.featured-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem;
}

.featured h2 {
  font-size: 2.05rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.55rem;
}

.featured h2 a {
  color: var(--ink);
  text-decoration: none;
}

.featured h2 a:hover {
  color: var(--accent);
}

.post-date {
  display: block;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--accent);
  margin-bottom: 1rem;
}

.featured .tease {
  margin: 0 0 1.35rem;
  color: var(--ink);
  line-height: 1.75;
}

.read-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}

.read-link:hover {
  border-bottom-width: 2px;
}

.posts-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.posts-list > li {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(163, 107, 79, 0.25);
}

.posts-list > li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.posts-list h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.35rem;
}

.posts-list h3 a {
  color: var(--ink);
  text-decoration: none;
}

.posts-list h3 a:hover {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

.posts-list .one-line {
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
  color: var(--ink);
  opacity: 0.85;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.5rem;
}

.page-title {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
  color: var(--ink);
}

.prose p {
  margin: 0 0 1.35rem;
}

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

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

.post-header h1 {
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.65rem;
  color: var(--ink);
}

.post-subtitle {
  margin: 0 0 0.85rem;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
  opacity: 0.88;
}

.post-header .post-date {
  margin-bottom: 0;
}

.post-body p {
  margin: 0 0 1.35rem;
}

.post-body p:last-child {
  margin-bottom: 0;
}

.post-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 2.25rem 0 1rem;
  color: var(--ink);
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.35rem;
  padding-left: 1.35rem;
}

.post-body li {
  margin-bottom: 0.65rem;
}

.post-body li:last-child {
  margin-bottom: 0;
}

.closer {
  margin-top: 1.75rem;
}

.cta {
  margin-top: 1.75rem;
  padding: 1rem 0 0;
  font-size: 1.05rem;
}

.sources {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.sources li {
  margin-bottom: 0.55rem;
  padding-left: 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.5rem;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
  line-height: 1.45;
}

.post-body th,
.post-body td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid rgba(163, 107, 79, 0.3);
}

.post-body th {
  font-weight: 600;
  color: var(--accent);
  border-bottom-color: rgba(163, 107, 79, 0.5);
}

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

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(163, 107, 79, 0.35);
}

.post-footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.post-footer a:hover {
  border-bottom-color: var(--accent);
}

.site-footer {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  font-size: 0.9rem;
  color: var(--accent);
}

.prose a,
.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(163, 107, 79, 0.5);
}

.prose a:hover,
.post-body a:hover {
  border-bottom-color: var(--accent);
}

.post-figure {
  margin: 0 0 2rem;
}

.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  background: #e8e0d4;
  box-shadow:
    0 1px 2px rgba(58, 50, 44, 0.06),
    0 8px 20px rgba(58, 50, 44, 0.08),
    0 18px 40px rgba(58, 50, 44, 0.06);
}

.post-figure figcaption {
  margin-top: 0.7rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--accent);
}

@media (max-width: 480px) {
  body {
    font-size: 1.1rem;
  }

  .site-header {
    padding: 1.75rem 1.15rem 1.25rem;
  }

  .site-main {
    padding: 0.25rem 1.15rem 3rem;
  }

  .featured h2,
  .page-title,
  .post-header h1 {
    font-size: 1.55rem;
  }

  .site-footer {
    padding: 0 1.15rem 2.5rem;
  }
}


blockquote {
  margin: 0 0 1.35rem;
  padding: 0.25rem 0 0.25rem 1.15rem;
  border-left: 2px solid var(--accent);
  color: var(--ink);
  opacity: 0.92;
}

blockquote p {
  margin: 0;
  font-style: italic;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}


/* ==========================================================================
   MOTION LAYER + RHYTHM (v1)
   Added on top of the tokens above — nothing in the original sheet is
   rewritten. Colours and typeface are unchanged; this section only adjusts
   scale, spacing, hover states, and adds the reveal/parallax machinery.

   Reveal contract:
     - assets/motion.js adds `html.motion-ready`, and only then does the
       pre-reveal (hidden) state below apply. The page ships visible; hiding
       is something the motion layer opts into once it can undo it.
     - That script then adds `.is-in` per element, in the same task, so no
       frame is ever painted with content hidden and unresolved.
     - A reader without JS, a browser that drops `:is()`, reduced motion, or a
       script error all land in the same place: the page as served.
   ========================================================================== */

:root {
  /* Modular scale, 1.25 ratio off the 1.18rem body size. Fluid so the
     narrow-screen block earlier in this sheet no longer has to fight it. */
  --step-1: clamp(1.28rem, 1.14rem + 0.7vw, 1.48rem);
  --step-2: clamp(1.55rem, 1.24rem + 1.6vw, 1.85rem);
  --step-3: clamp(1.68rem, 1.26rem + 2.1vw, 2.3rem);

  /* Vertical rhythm */
  --gap-s: 1.15rem;
  --gap-m: 1.75rem;
  --gap-l: 2.75rem;
  --gap-xl: 4rem;

  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---- Type scale ---------------------------------------------------------- */

.featured h2,
.post-header h1 {
  font-size: var(--step-3);
  line-height: 1.16;
}

.page-title {
  font-size: var(--step-2);
}

.post-body h2 {
  font-size: var(--step-1);
  line-height: 1.28;
}

.posts-list h3 {
  font-size: clamp(1.22rem, 1.14rem + 0.4vw, 1.32rem);
}

.post-subtitle {
  font-size: clamp(1.14rem, 1.08rem + 0.3vw, 1.24rem);
}

/* ---- Vertical rhythm ----------------------------------------------------- */

.site-header {
  padding-bottom: var(--gap-m);
}

.site-main {
  padding-bottom: var(--gap-xl);
}

/* These longhands come after the narrow-screen block earlier in this sheet and
   would otherwise override its shorthand at equal specificity. Restate the
   narrow-screen values so the extra room is a desktop change, not a silent
   mobile one. */
@media (max-width: 480px) {
  .site-header {
    padding-bottom: 1.5rem;
  }

  .site-main {
    padding-bottom: 3.25rem;
  }
}

.hello {
  margin-bottom: var(--gap-l);
}

.rule {
  margin: var(--gap-l) 0;
}

.post-header {
  margin-bottom: var(--gap-l);
}

.post-figure {
  margin-bottom: var(--gap-l);
}

.post-body h2 {
  margin-top: var(--gap-l);
  margin-bottom: var(--gap-s);
}

.posts-list > li {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
}

.post-footer {
  margin-top: var(--gap-xl);
}

/* ---- Link underlines ----------------------------------------------------- */
/* Background-image underlines animate their size instead of a border width,
   so nothing in the text flow moves on hover. */

.nav-link,
.site-title-text {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  border-bottom-color: transparent;
  transition: background-size 0.28s var(--ease-out), color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link[aria-current="page"],
.site-title:hover .site-title-text,
.site-title:focus-visible .site-title-text {
  background-size: 100% 1px;
  border-bottom-color: transparent;
}

.prose a,
.post-body a,
.post-footer a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  border-bottom-color: transparent;
  transition: background-size 0.2s ease, color 0.2s ease;
}

.prose a:hover,
.prose a:focus-visible,
.post-body a:hover,
.post-body a:focus-visible,
.post-footer a:hover,
.post-footer a:focus-visible {
  background-size: 100% 2px;
  border-bottom-color: transparent;
}

.post-footer a {
  background-size: 0 1px;
  transition: background-size 0.28s var(--ease-out);
}

.read-link {
  transition: color 0.2s ease;
}

/* ---- Post card hover ----------------------------------------------------- */
/* The plate is a pseudo-element so the lift costs no layout — the list item
   keeps its box and only transform/opacity change. */

.posts-list > li,
.featured {
  position: relative;
  z-index: 0;
  transition: transform 0.25s var(--ease-out), border-color 0.25s ease;
}

.posts-list > li::before,
.featured::before {
  content: "";
  position: absolute;
  inset: -0.9rem -1.15rem;
  z-index: -1;
  border-radius: 6px;
  background: rgba(163, 107, 79, 0.05);
  box-shadow: 0 6px 20px rgba(58, 50, 44, 0.07);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.posts-list > li:hover,
.posts-list > li:focus-within,
.featured:hover,
.featured:focus-within {
  transform: translateY(-2px);
  /* The divider would otherwise run through the bottom of the lifted plate.
     Fading the colour keeps the box the same size — no reflow. */
  border-bottom-color: transparent;
}

.posts-list > li:hover::before,
.posts-list > li:focus-within::before,
.featured:hover::before,
.featured:focus-within::before {
  opacity: 1;
}

/* ---- The asterisk moment ------------------------------------------------- */
/* `.closer` is the one beat per post that should read differently — the
   "if you only remember one line" note. Same mechanism on every post so it
   works as a signature rather than a per-post flourish. */

.closer {
  position: relative;
  margin-top: var(--gap-l);
  padding: 0.15rem 0 0.15rem 1.5rem;
  font-size: clamp(1.18rem, 1.06rem + 0.5vw, 1.32rem);
  line-height: 1.6;
}

.closer::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: top center;
}

/* ---- Parallax frame ------------------------------------------------------ */
/* Created by motion.js at runtime; the shadow moves off the image so the
   cropped drift stays inside a single rounded box. */

.parallax-frame {
  overflow: hidden;
  border-radius: 3px;
  background: #e8e0d4;
  box-shadow:
    0 1px 2px rgba(58, 50, 44, 0.06),
    0 8px 20px rgba(58, 50, 44, 0.08),
    0 18px 40px rgba(58, 50, 44, 0.06);
}

.parallax-frame img {
  border-radius: 0;
  box-shadow: none;
  transform-origin: center center;
  will-change: transform;
}

/* ---- Reveals ------------------------------------------------------------- */
/* Everything below is opacity/transform only, and the whole block is gated on
   `prefers-reduced-motion: no-preference`. Under `reduce` none of it applies:
   no hidden state, no transitions, nothing to undo. */

/* `screen` matters as much as the motion query: paper has no viewport to
   scroll, so on print none of this applies and the page renders as served. */
@media screen and (prefers-reduced-motion: no-preference) {
  /* Reveals are animations, not transitions, and deliberately do not use
     `forwards`. A filling animation — or a transition that has to pin
     `transform: none` on the revealed state — outranks the hover lift below
     and would leave the cards dead on hover. This way the reveal plays once
     and then lets go of `transform` entirely. */

  @keyframes atp-reveal {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }



  @keyframes atp-header-in {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  .motion-ready :is(
    .hello,
    .featured,
    .posts-list > li,
    .section-label,
    .page-title,
    .prose p,
    .post-header,
    .post-figure,
    .post-body > p:not(.closer),
    .post-body > h2,
    .post-body > ul,
    .post-body > ol,
    .post-body > .table-wrap,
    .post-footer
  ) {
    opacity: 0;
  }

  .motion-ready :is(
    .hello,
    .featured,
    .posts-list > li,
    .section-label,
    .page-title,
    .prose p,
    .post-header,
    .post-figure,
    .post-body > p:not(.closer),
    .post-body > h2,
    .post-body > ul,
    .post-body > ol,
    .post-body > .table-wrap,
    .post-footer
  ).is-in {
    opacity: 1;
    /* `backwards` matters: the stagger rules below add a delay, and without
       it a delayed card would paint visible and then snap back to hidden. */
    animation: atp-reveal 0.6s var(--ease-out) backwards;
  }

  /* Card list cascades rather than arriving as one block. */
  .motion-ready .posts-list > li:nth-child(2).is-in { animation-delay: 0.05s; }
  .motion-ready .posts-list > li:nth-child(3).is-in { animation-delay: 0.1s; }
  .motion-ready .posts-list > li:nth-child(4).is-in { animation-delay: 0.15s; }
  .motion-ready .posts-list > li:nth-child(n+5).is-in { animation-delay: 0.2s; }

  /* Anything already on screen when motion.js boots is shown without any
     animation — see observeOrShow() in assets/motion.js. Only the reveal
     animation is suppressed; the hover transition is a separate property and
     is left alone, so these cards still lift like any other. */
  .motion-ready .is-instant,
  .motion-ready .is-instant::before {
    animation: none !important;
  }

  /* Load polish: the chrome settles in rather than snapping on. */
  .motion-ready .site-header {
    animation: atp-header-in 0.5s var(--ease-out) both;
  }

  /* The asterisk moment: the rule draws itself, then the line arrives. */
  .motion-ready .post-body .closer {
    opacity: 0;
  }

  .motion-ready .post-body .closer.is-in {
    opacity: 1;
    animation: atp-reveal 0.55s var(--ease-out) 0.12s backwards;
  }

  .motion-ready .post-body .closer::before {
    transform: scaleY(0);
    transition: transform 0.55s var(--ease-out);
  }

  .motion-ready .post-body .closer.is-in::before {
    transform: scaleY(1);
  }
}
