/* folio. A prose product, so the typography is the design.
   No webfonts: they cost a round trip and the system serifs are good. */

:root {
  --measure: 34rem;
  --paper: #fbf9f5;
  --ink: #23201c;
  --ink-soft: #5c564e;
  --ink-faint: #8a8279;
  --rule: #e3ddd2;
  --accent: #7a5c3e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16151a;
    --ink: #e6e1d9;
    --ink-soft: #a9a299;
    --ink-faint: #7d766d;
    --rule: #2e2c33;
    --accent: #c9a373;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

/* Masthead ---------------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}

.masthead a { text-decoration: none; }

.wordmark {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}

.masthead nav {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

.masthead nav a { color: var(--ink-soft); }
.masthead nav a:hover { color: var(--accent); }

/* Edition switcher --------------------------------------------------------- */

.editions {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.editions button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.5rem 0.85rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  cursor: pointer;
}

.editions button:hover { color: var(--ink); }

.editions button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.editions button[disabled] {
  opacity: 0.35;
  cursor: default;
}

/* Story ------------------------------------------------------------------- */

.dateline .sep { margin: 0 0.5rem; opacity: 0.5; }

.dateline {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 2.5rem;
  text-wrap: balance;
}

.story p {
  margin: 0 0 1.4em;
  hanging-punctuation: first last;
}

/* A drop-cap-ish opening, without the fragile float. */
.story p:first-of-type::first-line {
  font-variant-caps: small-caps;
  letter-spacing: 0.02em;
}

.themes {
  margin: 3rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.themes li {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

/* Likes and attribution ---------------------------------------------------- */

.reactions { margin-top: 2.5rem; }

.like {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.like:hover { border-color: var(--accent); color: var(--ink); }

.like .heart { font-size: 0.9rem; line-height: 1; opacity: 0.55; }

.like[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--ink);
}

.like[aria-pressed="true"] .heart { color: var(--accent); opacity: 1; }

.like[disabled] { cursor: default; }

.sources {
  margin: 2rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.sources-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}

.sources-list { display: block; color: var(--ink-soft); }

.sources-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The fiction notice. Required by PRD §10 and load-bearing: without it a
   reader could take an invented scene for reportage. */
.notice {
  margin-top: 1.5rem;
  padding-top: 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink-faint);
}

/* Archive ----------------------------------------------------------------- */
/*
 * One block per day, three editions inside it. The previous version repeated
 * the date on every entry and gave no indication which edition was which, so
 * three stories read as one undifferentiated list.
 */

.archive-day { margin-bottom: 3.5rem; }

.day-heading {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

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

.archive li + li { border-top: 1px solid var(--rule); }

.archive a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1.4rem 0;
  text-decoration: none;
  color: inherit;
}

.archive a:hover .entry-title { color: var(--accent); }

.entry-body { flex: 1; min-width: 0; }

.entry-title {
  display: block;
  font-size: 1.3rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
  text-wrap: balance;
}

.entry-sub {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* Which reader each edition is for, said plainly and consistently coloured. */
.badge {
  flex: 0 0 auto;
  min-width: 5.5rem;
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  text-align: center;
  opacity: 0.85;
}

.badge-kids   { color: #4a7c59; }
.badge-teens  { color: #8a6d3b; }
.badge-adults { color: #5a5470; }

@media (prefers-color-scheme: dark) {
  .badge-kids   { color: #8fc9a2; }
  .badge-teens  { color: #d0aa6a; }
  .badge-adults { color: #a99fd0; }
}

@media (max-width: 30rem) {
  .archive a { flex-direction: column; gap: 0.6rem; }
  .badge { min-width: 0; align-self: flex-start; }
}

/* States ------------------------------------------------------------------ */

.state {
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  padding: 2rem 0;
}

.state a { color: var(--accent); }

[hidden] { display: none !important; }

@media (max-width: 30rem) {
  .wrap { padding: 2rem 1.25rem 4rem; }
  body { font-size: 1.125rem; }
}

@media print {
  body { background: #fff; color: #000; }
  .masthead nav, .themes { display: none; }
}
