/* Whispers & Wonders — an almanac of small thoughts */

/* ── reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
img, picture, svg { display: block; max-width: 100%; height: auto; }

/* ── tokens ─────────────────────────────────────────────────────── */
:root {
  --paper:          #ede4ca;
  --paper-edge:     #e2d6b2;
  --ink:            #1b1917;
  --ink-soft:       #3a332b;
  --ink-muted:      #6b5d50;
  --cochineal:      #9e2736;
  --cochineal-soft: #c44b59;
  --verdigris:      #446b5f;
  --rule:           #c9bc9a;
  --selection:      #e8c9a5;

  --font-display: "DM Serif Display", "Playfair Display", Georgia, serif;
  --font-serif:   "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --measure:      34rem;
}

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

/* ── paper grain ────────────────────────────────────────────────── */
body {
  background-color: var(--paper);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.10 0 0 0 0 0.09 0 0 0 0 0.06 0 0 0 0.4 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>");
  background-attachment: fixed;
}

/* ── base ───────────────────────────────────────────────────────── */
html { font-size: 18px; text-size-adjust: 100%; }
@media (min-width: 48rem) { html { font-size: 20px; } }

body {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── spine (site title on left edge) ────────────────────────────── */
.spine {
  position: fixed;
  left: 2rem;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  z-index: 5;

  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
  transition: color .25s;
}
.spine:hover { color: var(--cochineal); }

/* ── corner nav (top-right) ─────────────────────────────────────── */
body > header > nav {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 5;
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
}
body > header > nav a {
  color: var(--ink-muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
body > header > nav a:hover {
  color: var(--cochineal);
  border-bottom-color: var(--cochineal-soft);
}

/* ── corner colophon (bottom-right) ─────────────────────────────── */
body > footer {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 5;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--ink-muted);
}
body > footer p { margin: 0; }

/* ── main column (free-floating) ────────────────────────────────── */
body > main {
  width: 100%;
  max-width: var(--measure);
  margin: 6rem auto 6rem;
  padding: 0 2rem;
}

/* ── typography ─────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}
h2 { font-size: 1.5rem; margin: 2.25rem 0 .5rem; }
h3 { font-size: 1.2rem; margin: 1.75rem 0 .35rem; }

p { margin-block: 1em; text-wrap: pretty; hyphens: auto; }

a {
  color: var(--cochineal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: var(--rule);
  transition: text-decoration-color .2s, color .2s;
}
a:hover { text-decoration-color: var(--cochineal-soft); }
a:focus-visible {
  outline: 2px solid var(--cochineal-soft);
  outline-offset: 3px;
  border-radius: 2px;
}

em, i { font-style: italic; }
strong, b { font-weight: 700; color: var(--ink); }
small { font-size: 0.82rem; color: var(--ink-muted); }

time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--verdigris);
}

ul, ol { padding-left: 1.4rem; margin-block: 1em; }
li { margin-block: .2em; }

blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1.4rem;
  border-left: 2px solid var(--cochineal);
  color: var(--ink-soft);
  font-style: italic;
}
blockquote p { margin-block: .4em; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.82em; }
code {
  background: var(--paper-edge);
  padding: .1em .35em;
  border: 1px solid var(--rule);
  border-radius: 2px;
}
pre {
  background: var(--paper-edge);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin-block: 1.5rem;
  line-height: 1.55;
}
pre code { background: transparent; padding: 0; border: 0; border-radius: 0; font-size: inherit; }

hr {
  border: 0;
  text-align: center;
  margin: 3rem 0;
  line-height: 1;
  color: var(--cochineal);
}
hr::before {
  content: "·   ❦   ·";
  font-family: var(--font-serif);
  font-size: 1.2rem;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
}

/* ── home: hero (tagline is the hero, not a repeated site title) ─ */
main > section > header {
  text-align: center;
  margin: 0 0 4rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px double var(--rule);
  position: relative;
}
main > section > header > small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.38em;
  color: var(--ink-muted);
  margin-bottom: 1.75rem;
  padding-left: 0.38em;
}
main > section > header > p {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw + 0.5rem, 2.5rem);
  line-height: 1.3;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
main > section > header::after {
  content: "❦";
  position: absolute;
  bottom: -0.7rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--cochineal);
  background: var(--paper);
  padding: 0 0.8rem;
  font-size: 1rem;
}

/* ── home: post list ────────────────────────────────────────────── */
main > section > ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
main > section > ul > li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
main > section > ul > li:last-child { border-bottom: 0; }
main > section > ul > li a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.15rem;
  line-height: 1.3;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color .2s, border-color .2s;
  align-self: start;
  justify-self: start;
}
main > section > ul > li a:hover {
  color: var(--cochineal);
  border-bottom-color: var(--cochineal-soft);
}

@media (min-width: 36rem) {
  main > section > ul > li {
    grid-template-columns: 8rem 1fr;
    align-items: baseline;
    gap: 1.5rem;
  }
}

/* ── single post ────────────────────────────────────────────────── */
article > header {
  margin-bottom: 2.5rem;
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
article > header > p:first-child { margin: 0 0 1rem; }
article > header > p:first-child time {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
article > header h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.25rem, 4.5vw + 0.5rem, 3.25rem);
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0;
}

article > header + p::first-letter {
  font-family: var(--font-display);
  font-weight: 400;
  float: left;
  font-size: 4em;
  line-height: 0.85;
  padding: 0.08em 0.1em 0.05em 0;
  color: var(--cochineal);
}

main > p:last-child { margin-top: 3.5rem; text-align: center; }
main > p:last-child a {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
main > p:last-child a:hover {
  color: var(--cochineal);
  border-bottom-color: var(--cochineal-soft);
}

/* ── mobile (<48rem): spine & corners collapse to conventional top/bottom ─ */
@media (max-width: 48rem) {
  .spine {
    position: static;
    writing-mode: initial;
    display: block;
    text-align: center;
    padding: 1.75rem 0 0;
    font-size: 1.2rem;
  }
  body > header > nav {
    position: static;
    justify-content: center;
    padding: 1rem 0 0;
  }
  body > main {
    margin: 2.5rem auto 3rem;
    padding: 0 1.25rem;
  }
  body > footer {
    position: static;
    text-align: center;
    padding: 0 0 2rem;
  }
}

/* ── page-load reveal ───────────────────────────────────────────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(0.4rem); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.spine                  { animation: fade .8s ease-out both; animation-delay: .25s; }
body > header > nav     { animation: fade .6s ease-out both; animation-delay: .35s; }
body > main             { animation: rise .6s ease-out both; animation-delay: .1s; }
body > footer           { animation: fade .6s ease-out both; animation-delay: .45s; }

@media (prefers-reduced-motion: reduce) {
  .spine, body > header > nav, body > main, body > footer { animation: none; }
  * { transition: none !important; }
}
