/* ─────────────────────────────────────────────────────────────
   nandal.in — Paper & Seagreen
   Palette and rules: nandal/.claude/commands/designer.md
   ───────────────────────────────────────────────────────────── */

:root {
  /* Paper — the ground */
  --paper:        #fbf9f4;
  --paper-raised: #fffdf8;
  --paper-sunk:   #f4f1e9;
  --rule:         #e4dfd3;

  /* Ink — the text */
  --ink:          #1e2422;
  --ink-muted:    #6b7168;
  --ink-faint:    #97998f;

  /* Seagreen — the accent */
  --sea:          #216b5e;
  --sea-strong:   #17514a;
  --sea-soft:     #e3ede8;
  --sea-line:     #9cbfb4;

  --grain-opacity: .04;

  --serif: "Newsreader", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --measure: 34rem;
  --page: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #131816;
    --paper-raised: #1a211e;
    --paper-sunk:   #0f1412;
    --rule:         #2c3531;
    --ink:          #e8e4da;
    --ink-muted:    #9aa39c;
    --ink-faint:    #6f7873;
    --sea:          #6fbfa9;
    --sea-strong:   #8fd4c0;
    --sea-soft:     #1c2b27;
    --sea-line:     #35564e;
    --grain-opacity: .028;
  }
}

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

html {
  background-color: var(--paper);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.75;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (min-width: 40rem) { body { font-size: 1.1875rem; } }

/* paper grain — fractal noise, fixed underlay, barely there */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

/* ── Shell ─────────────────────────────────────────────────── */

.shell {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.5rem;
}
@media (min-width: 40rem) { .shell { padding: 0 2rem; } }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem; top: 1rem;
  z-index: 10;
  background: var(--paper-raised);
  border: 1px solid var(--sea);
  padding: .5rem .75rem;
  border-radius: 3px;
}

/* ── Masthead ──────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2.5rem 0 0;
}
@media (min-width: 40rem) { .masthead { padding-top: 4rem; } }

.wordmark {
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: .005em;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  white-space: nowrap;
}
.wordmark:hover { color: var(--sea); }

.masthead nav {
  display: flex;
  gap: 1.375rem;
}
.masthead nav a {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-muted);
  text-decoration: none;
  border: 0;
  padding-bottom: .15rem;
}
.masthead nav a:hover { color: var(--sea); }
.masthead nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 1px solid var(--sea-line);
}

/* ── Links ─────────────────────────────────────────────────── */

a {
  color: var(--sea);
  text-decoration: none;
  border-bottom: 1px solid var(--sea-line);
  transition: color .12s ease, border-color .12s ease;
}
a:hover { color: var(--sea-strong); border-bottom-color: var(--sea); }

:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Meta type ─────────────────────────────────────────────── */

.meta {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}

/* ── Home ──────────────────────────────────────────────────── */

.premise {
  margin: 4.5rem 0 0;
  font-size: clamp(1.4rem, 4.4vw, 1.85rem);
  line-height: 1.42;
  letter-spacing: -.012em;
  max-width: 28ch;
  color: var(--ink);
  text-wrap: balance;
}
.premise em {
  font-style: italic;
  color: var(--sea);
}

.premise-note {
  margin: 1.25rem 0 0;
  max-width: 46ch;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-muted);
}

.divider {
  margin: 4rem 0 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

/* ── Index of essays ───────────────────────────────────────── */

.year {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3.5rem 0 1.75rem;
}
.year::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule);
}

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

.index li + li { margin-top: 2.25rem; }

.entry {
  display: block;
  border: 0;
  color: inherit;
}
.entry:hover .entry-title { color: var(--sea); }
.entry:hover .entry-title::after { opacity: 1; transform: translateX(0); }

.entry-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: var(--ink);
  transition: color .12s ease;
  text-wrap: pretty;
}
.entry-title::after {
  content: "→";
  display: inline-block;
  margin-left: .45em;
  font-size: .8em;
  color: var(--sea);
  opacity: 0;
  transform: translateX(-.25em);
  transition: opacity .14s ease, transform .14s ease;
}
@media (prefers-reduced-motion: reduce) {
  .entry-title::after { transition: none; }
}

.entry-dek {
  margin: .4rem 0 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 46ch;
  text-wrap: pretty;
}

.entry-meta { margin: 0 0 .35rem; }

.empty {
  margin: 3rem 0;
  padding: 2rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-raised);
  color: var(--ink-muted);
  font-size: 1rem;
}

/* ── Article ───────────────────────────────────────────────── */

.article-head {
  margin: 4rem 0 0;
  max-width: var(--measure);
}

.article-head h1 {
  margin: .65rem 0 0;
  font-size: clamp(1.9rem, 5.6vw, 2.6rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.article-dek {
  margin: 1rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink-muted);
  font-style: italic;
  max-width: 42ch;
}

.prose {
  max-width: var(--measure);
  margin: 2.75rem 0 0;
}

.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.5rem; }
.prose p { text-wrap: pretty; }

.prose h2 {
  margin-top: 3.25rem;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.008em;
}
.prose h3 {
  margin-top: 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.prose blockquote {
  margin: 2.25rem 0;
  padding: 0 0 0 1.375rem;
  border-left: 2px solid var(--sea-line);
  color: var(--ink-muted);
  font-style: italic;
}
.prose blockquote p { margin: 0; }
.prose blockquote p + p { margin-top: 1rem; }

.prose ul, .prose ol { margin: 1.5rem 0; padding-left: 1.35rem; }
.prose li + li { margin-top: .6rem; }
.prose li::marker { color: var(--sea-line); }

.prose hr {
  margin: 3rem auto;
  border: 0;
  width: 4rem;
  border-top: 1px solid var(--sea-line);
}

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .85em;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .1em .35em;
}
.prose pre {
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  font-size: .9rem;
  line-height: 1.6;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.prose img { max-width: 100%; height: auto; border-radius: 3px; }

.prose a { border-bottom-color: var(--sea-line); }

/* first paragraph gets a touch more presence */
.prose > p:first-child { font-size: 1.06em; }

/* ── Verse ─────────────────────────────────────────────────── */

/* Stanzas are paragraphs; `breaks: true` turns each newline into a line.
   Turnovers (a verse line too long for the column) hang, so a wrapped line
   never reads as a new line of the poem. */
.poem {
  max-width: var(--measure);
  margin: 3rem 0 0;
  font-size: 1.15rem;
  line-height: 1.85;
}
.poem > * { margin: 0; }
.poem > * + * { margin-top: 1.9rem; }
.poem p { text-wrap: initial; }
.poem .v {
  display: block;
  padding-left: 1.5rem;
  text-indent: -1.5rem;
}
.poem em { color: var(--sea); }

.poem + .article-foot { margin-top: 4.5rem; }

.article-foot {
  max-width: var(--measure);
  margin: 4rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.article-foot a { border: 0; }
.article-foot a:hover { border-bottom: 1px solid var(--sea-line); }

/* ── About ─────────────────────────────────────────────────── */

.about-quote {
  margin: 4.5rem 0 0;
  padding: 0;
  border: 0;
  max-width: 26ch;
}
.about-quote p {
  margin: 0;
  font-size: clamp(1.4rem, 4.4vw, 1.85rem);
  font-style: italic;
  line-height: 1.42;
  letter-spacing: -.012em;
  color: var(--ink);
  text-wrap: balance;
}
.about-quote p::before { content: "\201c"; color: var(--sea); }
.about-quote p::after  { content: "\201d"; color: var(--sea); }

.about-prose {
  max-width: var(--measure);
  margin: 2.5rem 0 0;
}
.about-prose > * { margin: 0; }
.about-prose > * + * { margin-top: 1.5rem; }
.about-prose p { text-wrap: pretty; }

.works {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  max-width: var(--measure);
}
.works li {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}
.works li:last-child { border-bottom: 1px solid var(--rule); }

.work-name {
  font-size: 1.0625rem;
  font-weight: 500;
}
.work-note {
  margin: .2rem 0 0;
  font-size: .96rem;
  line-height: 1.55;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.section-label { margin: 3.5rem 0 0; }

/* ── Colophon ──────────────────────────────────────────────── */

.colophon {
  margin-top: 6rem;
  padding: 2rem 0 3.5rem;
  border-top: 1px solid var(--rule);
}
.colophon a { border: 0; color: var(--ink-muted); }
.colophon a:hover { color: var(--sea); }

.epigraph {
  margin: 0 0 2rem;
  padding: 0 0 0 1.125rem;
  border-left: 2px solid var(--sea-line);
  max-width: var(--measure);
}
.epigraph p {
  margin: 0;
  font-size: 1.0625rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink);
  text-wrap: balance;
}
.epigraph p::before { content: "\201c"; }
.epigraph p::after { content: "\201d"; }

.colophon-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
}
.colophon-row nav { display: flex; gap: 1.25rem; }

/* ── 404 ───────────────────────────────────────────────────── */

.lost { margin: 6rem 0; max-width: var(--measure); }
.lost h1 {
  font-size: clamp(1.7rem, 5vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -.018em;
  margin: .5rem 0 1rem;
}
.lost p { margin: 0 0 1.5rem; color: var(--ink-muted); }
