/* Lumen Verba: styles (from the approved design kit) */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic-variable.woff2") format("woff2-variations"),
       url("/fonts/newsreader-italic-variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  --bg: #121125;
  --text: #F4F3F8;
  --wordmark: #C9C8D2;
  --author: #A1A1A9;
  --muted: #8D8D95;
  --rule: rgba(255, 255, 255, 0.08);
  --ember: 233, 185, 122;
  --glow: 255, 184, 107;
  --glow-strength: 0.05;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
/* The light behind the quote may extend past the screen edge: never scroll sideways */
body { overflow-x: hidden; overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 40px clamp(24px, 6vw, 88px) 36px;
  padding-bottom: max(36px, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* While the day's quote loads, keep the changing parts invisible (no flash).
   A timer in index.html reveals the page anyway if anything goes wrong. */
.js:not(.ready) .quote,
.js:not(.ready) .date,
.js:not(.ready) .day-number { visibility: hidden; }
/* Without JavaScript: fixed fallback quote, no date or number */
.no-js .date,
.no-js .day-number { display: none; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.01em;
  color: var(--wordmark);
  text-decoration: none;
}
.date {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.date-short { display: none; }

/* ---------- Quote ---------- */
main {
  flex-grow: 1;
  display: grid;
  place-items: center;
  padding: 48px 0;
}
.quote {
  position: relative;
  isolation: isolate;
  margin: 0;
  width: min(100%, 835px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
/* The faint warm light behind the quote */
.quote::before {
  content: "";
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 50%;
  width: min(144%, 100vw);      /* 22% beyond the quote on each side, never wider than the screen */
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse closest-side,
    rgba(var(--glow), var(--glow-strength)) 0%,
    rgba(var(--glow), calc(var(--glow-strength) * 0.4)) 50%,
    rgba(var(--glow), 0) 100%);
}
/* The thin warm line above the quote */
.ember {
  display: block;
  width: 1px;
  height: 56px;
  margin-bottom: 40px;
  background: linear-gradient(to bottom, rgba(var(--ember), 0), rgba(var(--ember), 0.8));
}
.quote blockquote { margin: 0; }
.quote-text {
  margin: 0 auto;
  max-width: 20em;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--text);
  text-wrap: balance;
  white-space: pre-line;
  overflow-wrap: break-word;
}
/* Size tiers by length (set by lumen-verba.js) */
.quote[data-length="short"] .quote-text { font-size: clamp(34px, 4.2vw, 60px); }
.quote[data-length="long"]  .quote-text { font-size: clamp(25px, 2.8vw, 40px); line-height: 1.36; }
.quote[data-length="xlong"] .quote-text { font-size: clamp(21px, 2.1vw, 29px); line-height: 1.4; text-wrap: pretty; }
/* Poems keep their own line breaks */
.quote.is-verse .quote-text { text-wrap: wrap; max-width: none; }

.quote figcaption { margin-top: 40px; }
.quote cite {
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--author);
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted);
}
.site-footer a,
.text-link {
  color: var(--author);
  text-decoration: none;
  border-bottom: 1px solid rgba(161, 161, 169, 0.35);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.site-footer a:hover,
.text-link:hover { color: #FFFFFF; border-bottom-color: rgba(255, 255, 255, 0.6); }
a:focus-visible { outline: 1px solid rgba(var(--ember), 0.9); outline-offset: 3px; border-radius: 2px; }

/* ---------- Phones ---------- */
@media (max-width: 600px) {
  body { padding: 28px 28px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .site-header { gap: 16px; padding-bottom: 16px; }
  .wordmark { font-size: 19px; }
  .date { font-size: 11px; letter-spacing: 0.16em; }
  .date-long { display: none; }
  .date-short { display: inline; }
  main { padding: 36px 0; }
  .ember { height: 44px; margin-bottom: 30px; }
  .quote-text { line-height: 1.34; letter-spacing: -0.01em; }
  .quote figcaption { margin-top: 32px; }
  .quote cite { font-size: 11px; }
  .site-footer { flex-direction: column; gap: 6px; padding-top: 16px; font-size: 11px; line-height: 1.5; }
}
@media (max-width: 360px) {
  body { padding-left: 20px; padding-right: 20px; }
}
