/* ==========================================================================
   The Striped Sofa
   Colors live here. The stripe colors (--s-*) come from 1970s upholstery;
   match them to the real sofa when you have the photo.

   Light ("paper") contrast on --bg #F5EDE0:
     --text 13.3:1, --muted 5.7:1, --accent 5.3:1  (WCAG AA)
   Dark ("den") contrast on --bg #2A1D15:
     --text 12.0:1, --muted 6.8:1, --accent 7.8:1
   ========================================================================== */
:root {
  /* Stripe colors (same in light and dark) */
  --s-brown: #5A3A22;
  --s-gold: #D49B2C;
  --s-cream: #F1E4CC;
  --s-rust: #B4532A;
  --s-olive: #6E6B2C;
  --s-orange: #C9742C;

  /* Light: cream paper */
  --bg: #F5EDE0;
  --text: #2E2219;
  --heading: #2E2219;
  --muted: #6B5A4B;
  --accent: #A2461E;     /* rust: links, drop caps, dates */
  --rule: #E2D4BF;
  --plate: #F8F1E3;      /* labels sitting on the striped header */
  --plate-text: #2E2219;
  --grain-opacity: 0.07;
  color-scheme: light;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Literata", Georgia, "Times New Roman", serif;
  --measure: 38rem;
  --gutter: 1.5rem;

  /* Fine paper/fabric grain, used on the page and the stripes */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Dark: the den. Follows the system setting unless the visitor picks one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2A1D15;
    --text: #EADBC4;
    --heading: #F3E6CF;
    --muted: #B8A58C;
    --accent: #E2A93B;   /* lamp gold */
    --rule: #46342A;
    --plate: #2A1D15;
    --plate-text: #F3E6CF;
    --grain-opacity: 0.05;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #2A1D15;
  --text: #EADBC4;
  --heading: #F3E6CF;
  --muted: #B8A58C;
  --accent: #E2A93B;
  --rule: #46342A;
  --plate: #2A1D15;
  --plate-text: #F3E6CF;
  --grain-opacity: 0.05;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.1875rem;   /* 19px: comfortable for long reading */
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}
body::before {            /* paper grain */
  content: "";
  position: absolute;
  inset: 0;
  background: var(--noise);
  opacity: var(--grain-opacity);
  pointer-events: none;
  z-index: 0;
}
body > *:not(.skip-link) { position: relative; z-index: 1; }
main { flex: 1; }

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* --- Type --------------------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--heading);
  line-height: 1.12;
  letter-spacing: -0.015em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  margin: 2.25rem 0 0.75rem;
}
h1 { font-size: clamp(2.25rem, 6vw, 3.1rem); margin-top: 0; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1.2em; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

img { max-width: 100%; height: auto; }
hr { border: 0; text-align: center; margin: 2.5rem 0; }
hr::after { content: "✦"; color: var(--accent); }

.skip-link {
  position: absolute; left: 1rem; top: -10rem; z-index: 10;
  background: var(--accent); color: var(--bg); padding: 0.5rem 1rem;
}
.skip-link:focus { top: 1rem; }

.meta {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

/* --- Striped sofa header ------------------------------------------------ */
.weave {
  position: relative;
  min-height: 8.5rem;
  display: flex;
  align-items: center;
  background: linear-gradient(180deg,
    var(--s-brown) 0 16%, var(--s-gold) 16% 30%, var(--s-cream) 30% 36%,
    var(--s-rust) 36% 58%, var(--s-cream) 58% 64%, var(--s-olive) 64% 80%,
    var(--s-orange) 80% 88%, var(--s-brown) 88% 100%);
}
.weave::after {           /* woven threads + grain */
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.13) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(180deg, rgba(255,255,255,.07) 0 1px, transparent 1px 2px),
    var(--noise);
  mix-blend-mode: multiply;
  opacity: 0.9;
  pointer-events: none;
}
.header-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.plate {
  background: var(--plate);
  color: var(--plate-text);
  border-radius: 3px;
  box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.site-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  text-decoration: none;
  padding: 0.35rem 0.9rem;
  white-space: nowrap;
}
.header-right { display: flex; align-items: center; padding: 0.2rem 0.3rem 0.2rem 0.6rem; }
.header-right nav { display: flex; gap: 0.15rem; }
.header-right nav a {
  font-size: 0.95rem;
  color: var(--plate-text);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
}
.header-right nav a:hover,
.header-right nav a[aria-current="page"] { color: var(--accent); }
.header-right nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; margin-left: 0.2rem;
  background: none; border: 0; border-radius: 3px;
  color: var(--plate-text); cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
html:not(.js) .theme-toggle { display: none; }

@media (max-width: 30rem) {
  .weave { min-height: 6.5rem; }
  .site-title { font-size: 1rem; padding: 0.3rem 0.65rem; }
  .header-right nav a { font-size: 0.875rem; padding: 0.2rem 0.35rem; }
}

/* --- Home & lists ------------------------------------------------------- */
.intro { padding: 4rem 0 1.5rem; }
.intro h1 { font-size: clamp(2.6rem, 8vw, 3.9rem); margin-bottom: 0.75rem; }
.tagline { font-size: 1.3rem; font-style: italic; color: var(--muted); margin: 0; }

.page-header { padding-top: 3.5rem; margin-bottom: 2rem; }
.dek { font-size: 1.3rem; font-style: italic; color: var(--muted); line-height: 1.5; }
.dek p { margin: 0; }
.page-header .dek { margin: 0.75rem 0 0; }

.essay-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.essay-list li { padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.essay-list li:last-child { border-bottom: 1px solid var(--rule); }
.essay-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--heading);
  text-decoration: none;
  font-variation-settings: "SOFT" 100;
}
.essay-title:hover { color: var(--accent); }
.teaser { margin: 0.4rem 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.empty { font-style: italic; color: var(--muted); padding: 1.5rem 0; border-top: 1px solid var(--rule); }

/* --- Essay -------------------------------------------------------------- */
.essay .page-header { margin-bottom: 2.25rem; }
.essay-body > p:first-child::first-letter {   /* drop cap */
  font-family: var(--font-display);
  float: left;
  font-size: 4.1em;
  line-height: 0.85;
  padding: 0.08em 0.1em 0 0;
  font-weight: 600;
  color: var(--accent);
}
.prose blockquote {       /* pull quote with a striped swatch */
  margin: 2rem 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.35;
  color: var(--heading);
}
.prose blockquote::before {
  content: "";
  display: block;
  width: 3.75rem;
  height: 0.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(180deg, var(--s-rust) 0 40%, var(--s-gold) 40% 70%, var(--s-olive) 70%);
}
.prose blockquote p { margin: 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose code { font-size: 0.85em; background: var(--rule); padding: 0.1em 0.35em; border-radius: 3px; }

.end-mark { text-align: center; color: var(--accent); letter-spacing: 0.6em; margin: 2.5rem 0; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0;
  font-size: 1rem;
  line-height: 1.4;
}
.pager a { text-decoration: none; max-width: 48%; }
.pager a:hover { text-decoration: underline; }
.pager .newer { text-align: right; margin-left: auto; }
.pager span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  margin-top: 5rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
