/* 1sutta — ink on paper. Palette sampled from data/logo-input.jpg:
   paper #fdf6ec, brush ink ≈ #2e2724. Type: Alegreya (OFL), self-hosted. */

@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/alegreya-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/alegreya-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/alegreya-latin-wght-italic.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alegreya";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url(/assets/fonts/alegreya-latin-ext-wght-italic.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #fdf6ec;
  --ink: #2e2724;
  --ink-soft: #5c514b;
  --muted: #8a7d73;
  --rule: #e6dacb;
  --wash: #f6ecdf;
  --grain-opacity: .05;
  --serif: "Alegreya", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1f1b19;
    --ink: #efe6d8;
    --ink-soft: #cbbfb0;
    --muted: #9c8f83;
    --rule: #3a332e;
    --wash: #27221f;
    --grain-opacity: .07;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;          /* Alegreya sets small; this reads like ~17px Georgia */
  line-height: 1.6;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
}
/* Paper grain, like the logo's stock. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .1 0 0 0 1.4 -.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .site-header, .site-footer { max-width: 38rem; margin: 0 auto; padding: 0 1.25rem; position: relative; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--muted);
  text-underline-offset: .2em;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* Small-caps label voice: nav, eyebrows, section heads, dates. */
.site-header nav, .eyebrow, .links h2, .uid, .archive time, .filter, .lang {
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  font-variant-numeric: lining-nums;
}

/* ---- header ---- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem 1.5rem;
  padding-block: 1.75rem 1.25rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.mark {
  display: inline-block;
  width: 2rem;
  aspect-ratio: 498 / 576;
  background-color: currentColor;
  -webkit-mask: url(/assets/mark.svg) center / contain no-repeat;
  mask: url(/assets/mark.svg) center / contain no-repeat;
}
/* Wordmark lettering traced from the logo (its flagged "1" never reads as "I"). */
.wordmark {
  display: inline-block;
  height: 1.3rem;
  aspect-ratio: 483 / 132;
  background-color: currentColor;
  -webkit-mask: url(/assets/wordmark.svg) center / contain no-repeat;
  mask: url(/assets/wordmark.svg) center / contain no-repeat;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.site-header nav { display: flex; gap: 1.25rem; font-size: 1.15rem; }
.site-header nav a { text-decoration: none; color: var(--ink-soft); }
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink); }
.site-header nav.lang-switch { font-size: 1.05rem; padding-left: 1.25rem; border-left: 1px solid var(--rule); }
.site-header nav.lang-switch a { color: var(--muted); }
.site-header nav.lang-switch a:hover { color: var(--ink); }
.site-header { gap: .75rem 1.25rem; }
.site-header .brand { margin-right: auto; }

/* ---- footer ---- */
.site-footer { margin-top: 4.5rem; padding-block: 2.5rem 3rem; text-align: center; color: var(--muted); font-size: .95rem; }
.site-footer .mark { width: 1.4rem; opacity: .55; margin-bottom: .75rem; }
.site-footer p { margin: 0; }

/* ---- sutta ---- */
.eyebrow { text-align: center; color: var(--muted); font-size: 1.05rem; margin: 2.5rem 0 0; }
.sutta > .sutta-title, .sutta > .sutta-meta { text-align: center; }
.sutta-title { font-size: clamp(2.1rem, 6vw, 2.75rem); font-weight: 500; line-height: 1.15; margin: .4rem 0 .6rem; text-wrap: balance; }
main > h1 { font-size: 2.4rem; font-weight: 500; line-height: 1.15; margin: 2.5rem 0 1.25rem; }
.sutta-meta { color: var(--muted); margin: 0 0 2.25rem; }
.pali { font-style: italic; color: var(--ink-soft); }
/* A repeated sutta lists every day it was featured: "20 November 2026 · 14 March 2027". */
.feature-date + .feature-date::before { content: " · "; }
.uid { font-size: 1.05em; }

.blurb { font-size: 1.25rem; line-height: 1.55; color: var(--ink-soft); }
.excerpt {
  margin: 2.25rem 0;
  padding: 1.5rem 1.5rem;
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.55;
  white-space: pre-line;
  text-align: center;
  border-block: 1px solid var(--rule);
  text-wrap: pretty;
}

/* ---- buttons ---- */
.actions { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin: 2rem 0 2.5rem; }
button {
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.2;
  padding: .5rem 1.1rem;
  border: 1px solid var(--ink-soft);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
button:hover { background: var(--wash); }
button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---- link lists ---- */
.links h2 { font-size: 1.15rem; font-weight: 500; color: var(--muted); margin: 2.5rem 0 .5rem; }
.links ul { list-style: none; padding: 0; margin: 0; }
.links li { padding: .65rem 0; border-bottom: 1px solid var(--rule); }
.links li:first-child { border-top: 1px solid var(--rule); }
.lang { color: var(--muted); margin-left: .4rem; }
.source { color: var(--muted); }

.kind {
  display: inline-block;
  min-width: 3.4rem;
  color: var(--muted);
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  font-size: 1rem;
}
.byline { display: block; color: var(--muted); font-size: 1rem; }
.note { margin: .3rem 0 0; font-size: 1.05rem; color: var(--ink-soft); }
.permalink { text-align: center; color: var(--muted); font-size: 1rem; margin-top: 2.5rem; }

/* ---- archive ---- */
.filter { display: flex; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; color: var(--muted); font-size: 1.1rem; }
.filter input, .filter select {
  font: inherit;
  font-variant-caps: normal;
  letter-spacing: normal;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-soft);
  padding: .2rem .1rem;
  margin-left: .4rem;
  border-radius: 0;
}
.filter input { width: 14rem; max-width: 100%; }
.archive { list-style: none; padding: 0; margin: 0; }
.archive li { display: flex; gap: 1rem; align-items: baseline; padding: .6rem 0; border-bottom: 1px solid var(--rule); }
.archive time { color: var(--muted); flex: none; min-width: 6.5rem; }
.archive li a { flex: 1; text-decoration: none; }
.archive li a:hover { text-decoration: underline; }
.archive .uid { color: var(--muted); }
.archive li.is-read a { color: var(--muted); }
.archive li.is-favorite a::after { content: " ★"; font-size: .8em; color: var(--ink-soft); }

/* ---- about / backup ---- */
main > h2 { font-size: 1.5rem; font-weight: 500; margin: 2.25rem 0 .5rem; }
.backup form { display: grid; gap: 1rem; margin-top: 1.25rem; }
.backup fieldset { border: 1px solid var(--rule); border-radius: 3px; padding: .75rem 1rem; }
.backup legend { color: var(--muted); padding: 0 .3rem; }
.backup label { display: block; }
.backup input[type="file"] { font: inherit; font-size: 1rem; margin-top: .3rem; color: var(--ink-soft); }
.backup button[type="submit"] { justify-self: start; }
#backup-status { color: var(--ink-soft); min-height: 1.6em; }
.empty { color: var(--muted); text-align: center; font-style: italic; margin-top: 3rem; }

/* "/" : hide the build-time fallback while app.js picks today's sutta.
   The delayed reveal keeps it readable if the module never runs. */
.js #today[aria-busy="true"] { visibility: hidden; animation: reveal 0s 2s forwards; }
@keyframes reveal { to { visibility: visible; } }

@media (max-width: 30rem) {
  body { font-size: 1.125rem; }
  .site-header { justify-content: center; }
  .site-header .brand { margin-right: 0; flex-basis: 100%; justify-content: center; }
  .archive li { flex-wrap: wrap; gap: 0 .75rem; }
  .archive time { min-width: 0; }
}
