/* ============================================
   Eliot Newsletter — Design System
   Aesthetic: Editorial Camp Newsletter
   ============================================ */

/* --- Google Fonts --- */
@import url("https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&display=swap");

/* --- CSS Variables --- */
:root {
  /* Typography */
  --font-display: "UnifrakturMaguntia", "Old English Text MT", "Blackletter",
    serif;
  --font-body: Georgia, "Times New Roman", serif;

  /* Colors */
  --color-bg: #fdf8f0;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-accent: #2d5016;
  --color-accent-light: #8b9a6b;
  --color-border: #d4cfc4;
  --color-schedule-bg: #fffdf7;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--color-text);
  background-color: var(--color-bg);
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

/* --- Paper texture (screen only) --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
}

/* --- Typography --- */
.page-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--color-border);
}

.nameplate {
  display: block;
  width: 33%;
  min-width: 8rem;
  height: auto;
  flex-shrink: 0;
}

.page-subtitle {
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--color-muted);
  padding-bottom: 0;
}

h2 {
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: bold;
  line-height: 1.2;
  margin-top: 1.25rem;
  margin-bottom: 0.3rem;
  color: var(--color-accent);
}

/* --- Links --- */
a {
  text-decoration: none;
  color: var(--color-text);
}

@media screen {
  a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
  }
  a:hover {
    color: var(--color-accent-light);
  }
}

/* ============================================
   PAGE LAYOUT (Screen)
   ============================================ */

.page-layout h2 {
  break-after: avoid;
}

/* --- Two-column rows --- */
.column-row {
  column-count: 2;
  column-gap: 2rem;
  margin-bottom: 1.5rem;
}

/* Prevent articles from splitting across columns */
.article {
  break-inside: avoid-column;
  margin-bottom: 0.8em;
}

/* --- Schedule: base visual styles --- */
.schedule {
  background: var(--color-schedule-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1rem 1.125rem;
  margin: 0 0 1rem 0;
}

/* --- Schedule inside column-row: push to column 2 --- */
.column-row .schedule {
  break-before: column;
  break-inside: avoid;
}

/* --- Mobile: collapse to single column --- */
@media screen and (max-width: 48rem) {
  .column-row {
    column-count: 1;
  }
  .column-row .schedule {
    break-before: auto;
  }
}

/* --- Schedule Component Internals --- */
.schedule h2 {
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 1.0625rem;
}
.schedule h2:first-child {
  margin-top: 0;
}

.timeslot {
  display: grid;
  grid-template-columns: 2.4em 1fr;
  gap: 0.35rem;
  padding: 0.1rem 0;
  font-size: 0.85rem;
  align-items: baseline;
}
.time {
  text-align: left;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timeslot.bold .time {
  font-weight: bold;
  color: var(--color-text);
}
.timeslot.bold .events > :first-child {
  font-weight: bold;
}

.events {
  list-style: none;
  padding: 0;
}
.events li {
  margin-bottom: 0.05rem;
  clear: both;
}
.events li:last-child {
  margin-bottom: 0;
}
.events p {
  display: inline;
}
.events .loc {
  float: right;
  text-align: right;
  color: var(--color-muted);
  margin-left: 0.75rem;
}

/* Past events: subtly greyed out (screen only) */
.timeslot.past {
  opacity: 0.45;
}

/* --- Article Body --- */
main p {
  margin-bottom: 0.55em;
}
.article ul {
  margin-left: 1.5em;
}
em {
  font-style: italic;
}
strong {
  font-weight: bold;
}

/* Author credits: em-dash + italic name */
main > p > em {
  font-style: italic;
}

/* Standalone credit: paragraph that is just em-dash + em */
main > p.credit {
  margin-top: 0.1em;
  color: var(--color-muted);
  font-size: 0.9em;
  font-style: italic;
}

/* --- Page Footer --- */
.page-footer {
  margin-top: 2em;
  padding: 1em 0;
  border-top: 1pt solid #ccc;
  font-size: 0.85em;
  color: #555;
}

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

.important-numbers li {
  margin-bottom: 0.35em;
}

.important-numbers li strong {
  color: #333;
}

.web-edition {
  display: none;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  @page {
    size: 8.5in 14in;
    margin: 0.55in;
  }

  html {
    font-size: 100%;
  }
  body {
    max-width: none;
    padding: 0;
    background: white;
    color: black;
  }
  body::before {
    display: none;
  }

  /* Page header: nameplate centered, date pinned right */
  .page-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: 14pt;
    padding-bottom: 6pt;
    border-bottom: 1.5pt solid black;
  }

  .nameplate {
    display: block;
    width: 33%;
    min-width: 8rem;
    height: auto;
    flex-shrink: 0;
  }

  /* Date line */
  .page-subtitle {
    position: absolute;
    right: 0;
    bottom: 0;
    font-size: 11pt;
    font-style: normal;
    color: black;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  /* Hide web-only navigation */
  .prior-issues,
  .back-link {
    display: none;
  }

  /* Column-rows: persistent two-column flow; second row starts new page */
  .column-row {
    margin-bottom: 0;
  }
  .column-row + .column-row {
    break-before: page;
  }

  /* Schedule: strip visual chrome but keep in column flow */
  .schedule {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0 0 10pt 0;
  }

  .schedule h2 {
    font-size: var(--print-heading-size, 16pt);
    font-weight: bold;
    color: black;
    margin-top: 7pt;
    margin-bottom: 2pt;
    border-bottom: 0.75pt solid black;
    padding-bottom: 2pt;
    break-after: avoid;
  }
  .schedule h2:first-child {
    margin-top: 0;
  }

  .timeslot {
    display: grid;
    grid-template-columns: 2.4em 1fr;
    gap: 3pt;
    padding: 0;
    font-size: var(--print-schedule-size, 10pt);
    orphans: 2;
    widows: 2;
  }

  .time {
    text-align: left;
    color: black;
  }
  .timeslot.bold .time {
    font-weight: bold;
    color: black;
  }
  .timeslot.bold .events > :first-child {
    font-weight: bold;
  }
  .events .loc {
    color: black;
  }

  /* Don't grey out events in print */
  .timeslot.past {
    opacity: 1;
  }

  /* Article headings */
  main h2 {
    font-size: var(--print-heading-size, 16pt);
    font-weight: bold;
    color: black;
    margin-top: 10pt;
    margin-bottom: 3pt;
    break-after: avoid;
  }
  main h2:first-of-type {
    margin-top: 0;
  }

  .article {
    break-inside: avoid-column;
  }

  /* Body text */
  main p {
    font-size: var(--print-body-size, 11pt);
    margin-bottom: 0;
    orphans: 3;
    widows: 3;
  }
  .article ul {
    margin-left: 2em;
  }

  /* Author credits */
  main p.credit {
    color: black;
    font-size: 10pt;
    font-style: italic;
    margin-top: 0;
    margin-bottom: 6pt;
  }

  /* Hide URL printing */
  a[href]::after {
    content: none !important;
  }

  /* Page footer */
  .page-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 7pt;
    text-align: center;
    padding: 3pt 0 0 0;
    color: #333;
    border-top: 0.5pt solid #ccc;
  }

  .important-numbers {
    margin: 0;
    padding: 0;
  }

  .important-numbers li {
    display: inline;
    margin: 0 0.5em;
  }

  .important-numbers br {
    display: none;
  }

  .important-numbers li.chaplain {
    display: block;
  }

  .important-numbers li::after {
    content: " · ";
    color: #999;
  }

  .important-numbers li:last-child::after,
  .important-numbers li:nth-last-child(2)::after {
    content: none;
  }

  .web-edition {
    display: block;
    margin-top: 2pt;
    font-style: italic;
  }

  .web-edition a {
    color: #333;
    text-decoration: none;
  }

  /* Draft watermark — appears on every page in dev or when draft:true */
  body[data-dev="true"]::after,
  body[data-draft="true"]::after {
    content: "DRAFT";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-family: var(--font-body);
    font-size: 84pt;
    color: rgba(0, 0, 0, 0.06);
    pointer-events: none;
    z-index: 1000;
  }
}

/* --- Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
