/* suicide by life — style.css
   a typed manuscript on newsprint.
   the red pen is for the parts that argue back. */

:root {
  --paper: #e9e5d9;   /* newsprint */
  --ink: #26241f;     /* typewriter ribbon */
  --faded: #8b8478;   /* the ribbon, running out */
  --pen: #b03024;     /* the red pen */
  --line: #d3cec0;
  --soft: #dfdac9;
  --maxw: 68rem;
}

@media (prefers-color-scheme: dark) {
  :root {              /* the carbon copy */
    --paper: #191815;
    --ink: #ddd8cb;
    --faded: #7e7768;
    --pen: #e0685a;
    --line: #2e2b26;
    --soft: #211f1b;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 1.0625rem;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}

/* paper dust: grain + a faint vignette, laid over everything */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: .6;
  background-image:
    radial-gradient(120% 95% at 50% 0%, transparent 55%, rgba(0,0,0,.055) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.skip {
  position: absolute; left: -100vw; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.4rem 0.9rem; z-index: 10;
}
.skip:focus { left: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--pen);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-style: wavy; }

::selection { background: var(--pen); color: var(--paper); }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; }

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

h1, h2, h3, h4 { font-weight: 700; }
h1, .sec, .hero-title { text-transform: lowercase; letter-spacing: -0.01em; }

/* ---------- header: a letterhead, more or less ---------- */

.head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  padding: 1.5rem 0 1rem;
  border-bottom: 3px double var(--line);
}
.wordmark { font-size: 1rem; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap; }
.wordmark em { font-style: italic; color: var(--pen); padding: 0 0.1em; }
.nav { display: flex; gap: 1.9rem; }
.nav a {
  font-size: 0.78rem; letter-spacing: 0.14em;
  color: var(--faded);
}
.nav a:hover { color: var(--pen); }
.nav a[aria-current] { color: var(--pen); text-decoration-style: solid; }

/* ---------- shared bits ---------- */

.overline {
  font-size: 0.74rem; letter-spacing: 0.16em;
  color: var(--faded); margin-bottom: 1.4rem;
}
.overline a:hover { color: var(--pen); }

@keyframes rise {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* the stamp */
.stamp {
  position: absolute; top: 0.4rem; right: 0;
  border: 2px solid var(--pen);
  color: var(--pen);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  padding: 0.5rem 0.6rem 0.5rem 0.95rem;
  transform: rotate(-6deg);
  opacity: 0.78;
  border-radius: 2px;
}

/* the red pen's handwritten notes */
.footnote {
  font-family: "Caveat", "Comic Sans MS", cursive;
  font-size: 1.25rem;
  color: var(--pen);
  transform: rotate(-1deg);
  margin-top: 1.4rem;
}

/* ---------- home ---------- */

.hero { position: relative; padding: clamp(3rem, 9vh, 6rem) 0 3rem; max-width: 58rem; animation: rise 0.6s ease both; }
.hero-title {
  font-size: clamp(2.4rem, 7.5vw, 4.6rem);
  font-weight: 700; line-height: 1.08;
  margin-bottom: 2rem;
}
.hero-title .ast { color: var(--pen); }
.lede { max-width: 33rem; font-size: 1.05rem; }
.lede p + p { margin-top: 1em; }
.lede em { font-style: italic; }

.toc {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  padding: 2.5rem 0 2.5rem;
}
.sec {
  font-size: 0.82rem; letter-spacing: 0.12em;
  padding-bottom: 0.8rem; margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}
.sec a { text-decoration: none; }
.sec a:hover { color: var(--pen); text-decoration: underline; text-decoration-style: wavy; }

.list { list-style: none; }
.list li { display: flex; align-items: baseline; gap: 0.9rem; padding: 0.42rem 0; }
.list .num {
  font-size: 0.85rem; color: var(--faded);
  min-width: 2.1rem; text-align: right; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.list a { font-size: 1rem; text-decoration-color: var(--line); }
.list a:hover { color: var(--pen); text-decoration-style: wavy; }
.list a.has-tag { display: inline-flex; align-items: baseline; gap: 0.6rem; }
.list .tag {
  color: var(--pen); font-size: 0.82rem;
  letter-spacing: 0.04em;
}
.empty { color: var(--faded); font-style: italic; font-size: 0.95rem; }

/* ---------- section index ---------- */

.section-index { padding-bottom: 4rem; }
.sec-head { padding: clamp(2.5rem, 7vh, 4.5rem) 0 2.2rem; max-width: 40rem; animation: rise 0.6s ease both; }
.sec-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.15; }
.section-index .list { max-width: 40rem; }
.section-index .list li { border-bottom: 1px solid var(--line); padding: 0.72rem 0; }
.section-index .list li:last-child { border-bottom: 0; }

/* ---------- entry: one typed page ---------- */

.entry {
  max-width: 38rem; margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 4.5rem) 0 3.5rem;
  animation: rise 0.6s ease both;
}
.entry-head { margin-bottom: 2.4rem; }
.entry-head h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.2; }

.prose { font-size: 1.02rem; position: relative; }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3, .prose h4 { margin-top: 1.9em; margin-bottom: 0.4em; }
.prose h2 { font-size: 1.3rem; }
.prose h3 { font-size: 1.15rem; }
.prose h4 { font-size: 1.02rem; }
.prose blockquote {
  border-left: 2px solid var(--pen);
  padding-left: 1.2rem;
  font-style: italic;
}
.prose ul, .prose ol { padding-left: 1.6rem; }
.prose li + li { margin-top: 0.35em; }
.prose hr.sep { border: 0; margin: 2.4rem 0; text-align: center; }
.prose hr.sep::after {
  content: "*  *  *";
  letter-spacing: 0.3em;
  color: var(--faded);
  font-size: 0.9rem;
}
.prose code { font-size: 0.9em; background: var(--soft); padding: 0.1em 0.35em; }

/* the legal-pad margin line, where there's room */
@media (min-width: 1000px) {
  .prose::before {
    content: "";
    position: absolute;
    left: -2.8rem; top: 0.3em; bottom: 0;
    width: 1px;
    background: var(--pen);
    opacity: 0.3;
  }
}

/* ---------- entry navigation ---------- */

.xnav {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 1.5rem;
  margin-top: 3.5rem; padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}
.xnav .xprev, .xnav .xnext { color: var(--faded); }
.xnav a:hover { color: var(--pen); }
.xnav .xback {
  font-size: 0.74rem; letter-spacing: 0.14em;
  color: var(--faded); text-align: center;
}
.xnav .xend { font-style: italic; color: var(--faded); font-size: 0.88rem; text-align: right; }
.xnav .xnone { flex: 1; }

/* ---------- 404 ---------- */

.e404 h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }

/* ---------- footer ---------- */

.foot {
  border-top: 3px double var(--line);
  padding: 1.5rem 0 2.2rem;
  margin-top: 3rem;
}
.foot-line { font-size: 0.92rem; font-style: italic; color: var(--faded); }
.fine {
  font-size: 0.72rem; letter-spacing: 0.12em;
  color: var(--faded); opacity: 0.85; margin-top: 0.45rem;
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  body { font-size: 1rem; }
  .toc { grid-template-columns: 1fr; gap: 2.5rem; }
  .list .num { min-width: 1.7rem; }
  .xnav { flex-wrap: wrap; }
  .xnav .xback { order: 3; width: 100%; text-align: left; margin-top: 0.4rem; }
  .stamp { top: -1rem; }
}
