/*
 * Daily Verso / Pensamientos Célebres — design system.
 *
 * Tokens are lifted directly from the approved brand guidelines. The two brands
 * SHARE this file: they are the same product, and the designs are byte-identical
 * apart from the name and the canonical URL. Only the wordmark differs.
 *
 * No bundler, no npm, no Vite. Hand-written CSS + native ES modules, matching the
 * expense-tracker-php house style. Custom properties do the work a preprocessor
 * would otherwise do.
 */

:root {
  /* ── Core ─────────────────────────────────────────────────────────────── */
  --terracotta: #C25B39;  /* primary — buttons, links, the mark */
  --ink:        #211D19;  /* dark surfaces, footer */
  --paper:      #FAF5EC;  /* app background */
  --gold:       #DDA24A;  /* accent — "the daily spark" */

  --clay:       #A84A2C;  /* terracotta, pressed */
  --espresso:   #2A2520;  /* body text */
  --cream:      #F4ECDD;
  --sand:       #F3E7CE;

  /* ── Extended — author & topic theming ────────────────────────────────── */
  --olive: #3F4A3B;
  --rose:  #B24A6B;
  --slate: #4A6670;
  --amber: #B8863B;

  /* ── Text ─────────────────────────────────────────────────────────────── */
  --text:        #2A2520;
  --text-muted:  #5A5148;
  --text-subtle: #8A7F74;
  --text-faint:  #A89C8E;

  --line: rgba(42, 37, 32, 0.1);
  --line-soft: rgba(42, 37, 32, 0.08);

  /* ── Type ─────────────────────────────────────────────────────────────── */
  /* Newsreader carries the quotations — the words are the hero, so they get the
     literary serif. Hanken Grotesk is everything around them and steps back. */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans:  'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;

  --radius:    12px;
  --radius-lg: 20px;

  --shadow-card: 0 12px 30px -14px rgba(42, 37, 32, 0.28);
  --shadow-lift: 0 20px 50px -24px rgba(42, 37, 32, 0.4);
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--terracotta); text-decoration: none; }
a:hover { color: var(--clay); }

::selection { background: var(--gold); color: var(--espresso); }

img { max-width: 100%; height: auto; display: block; }

/* Respect the reader. Nothing here needs to move. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.wrap--narrow { max-width: 820px; }

main { min-height: 60vh; padding-bottom: 64px; }

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 245, 236, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: var(--text);
}
.brand-lockup:hover { color: var(--text); }

.brand-lockup__name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 20px;
  font-size: 14.5px;
  font-weight: 500;
}
.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--text); }

.site-search {
  flex: 1;
  max-width: 320px;
  margin-left: auto;
}
.site-search input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
}
.site-search input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: transparent;
}

@media (max-width: 720px) {
  .site-nav { display: none; }
  .site-search { max-width: none; }
}

/* ── Type ───────────────────────────────────────────────────────────────── */

.display {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  text-wrap: balance;
}

.heading {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 30px;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 24px;
  max-width: 62ch;
  text-wrap: pretty;
}

/* ── The quote itself ───────────────────────────────────────────────────── */

/* Text first, always. The brand guidelines are explicit: the quote lives as a
   real <blockquote> with a <cite> — indexable, selectable, translatable,
   readable by a screen reader. Never as an image alone. */
.quote-hero {
  background: linear-gradient(150deg, var(--ink), #2E2621);
  color: var(--cream);
  border-radius: var(--radius-lg);
  padding: clamp(32px, 6vw, 56px);
  margin: 0 0 24px;
  text-align: center;
}

.quote-hero__mark {
  font-family: var(--font-serif);
  font-size: 64px;
  line-height: 0.5;
  height: 30px;
  color: var(--gold);
}

.quote-hero blockquote {
  margin: 0 0 22px;
}

/* The quote text is the page's <h1> — every quote page needs one, and the
   quote itself is legacy's h1 verbatim. Reset the browser's default h1
   styling so it inherits the blockquote's typography instead of fighting it. */
.quote-hero blockquote h1 {
  font-family: var(--font-serif);
  font-size: clamp(21px, 3.2vw, 30px);
  font-weight: inherit;
  line-height: 1.32;
  margin: 0;
  color: var(--cream);
  text-wrap: pretty;
}

.quote-hero__rule {
  width: 36px;
  height: 2.5px;
  background: var(--gold);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.quote-hero cite {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

/* ── Quote cards ────────────────────────────────────────────────────────── */

.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
}

.quote-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.quote-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.quote-card blockquote {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.42;
  margin: 0 0 18px;
  color: var(--text);
  text-wrap: pretty;
}

.quote-card__author {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
}

.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sand);
  color: var(--clay);
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-sans);
}

/* ── Author / topic chips ───────────────────────────────────────────────── */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.chip:hover {
  background: var(--sand);
  border-color: var(--gold);
  color: var(--text);
}
.chip[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

/* ── Lists ──────────────────────────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
}

.mini-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--text);
}
.mini-card:hover {
  border-color: var(--gold);
  color: var(--text);
}
.mini-card__name { font-weight: 600; font-size: 15px; }
.mini-card__meta { font-size: 12.5px; color: var(--text-subtle); margin-top: 2px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn--primary { background: var(--terracotta); color: var(--cream); }
.btn--primary:hover { background: var(--clay); color: var(--cream); }
.btn--ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--text); color: var(--text); }

/* ── Pagination ─────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 40px 0;
  padding: 0;
  list-style: none;
}
.pagination a,
.pagination span {
  display: block;
  min-width: 40px;
  padding: 9px 12px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  color: var(--text-muted);
}
.pagination a:hover { border-color: var(--gold); }
.pagination [aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
  font-weight: 600;
}
.pagination .disabled { opacity: 0.4; }

/* ── Images on a quote page ─────────────────────────────────────────────── */

.image-versions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}
.image-versions img {
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  width: 100%;
}

/* ── Ads ────────────────────────────────────────────────────────────────── */

.ad-slot {
  margin: 32px 0;
  min-height: 90px;
  display: flex;
  justify-content: center;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  background: var(--ink);
  color: #948A7E;
  margin-top: 64px;
  padding: 48px 0 32px;
}
.site-footer a { color: #C9BFB2; }
.site-footer a:hover { color: var(--cream); }

.site-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 720px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}

.site-footer__brand {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--cream);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.site-footer__tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: rgba(244, 236, 221, 0.6);
  margin: 0 0 8px;
}

.site-footer__col-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.site-footer__legal {
  border-top: 1px solid rgba(244, 236, 221, 0.1);
  padding-top: 22px;
  font-size: 12.5px;
  color: #7A7166;
}

/* ── Utilities ──────────────────────────────────────────────────────────── */

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

.stack > * + * { margin-top: 16px; }
.section { margin: 0 0 56px; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

/* ── Creator ────────────────────────────────────────────────────────────────── */

.creator {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 32px;
  align-items: start;
  margin: 32px 0 64px;
}
@media (max-width: 900px) {
  .creator { grid-template-columns: 1fr; }
}

.creator__panel {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.creator__templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.tpl-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 76px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
}
.tpl-swatch[aria-pressed="true"] { border-color: var(--terracotta); }

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.creator__preview { position: sticky; top: 92px; }

/* The preview is CSS. The DOWNLOAD is rendered server-side by the same Python
   service as every other image on the site — one renderer, so the two cannot
   drift. This is an approximation, and deliberately so. */
.creator__canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 10%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}

.creator__mark {
  font-family: var(--font-serif);
  font-size: 44px;
  line-height: .5;
  height: 20px;
}
.creator__text {
  margin: 16px 0;
  line-height: 1.34;
  text-wrap: pretty;
}
.creator__rule { width: 28px; height: 3px; border-radius: 2px; margin-bottom: 10px; }
.creator__author { font-family: var(--font-sans); font-size: 13px; font-weight: 600; }
.creator__watermark {
  position: absolute;
  left: 0; right: 0; bottom: 5%;
  font-family: var(--font-serif);
  font-size: 11px;
  opacity: .5;
}

/* ── Save button ────────────────────────────────────────────────────────────── */

.save-btn {
  margin-left: auto;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  color: var(--text-subtle);
}
.save-btn:hover { color: var(--terracotta); }
.save-btn[aria-pressed="true"] { color: var(--terracotta); }
.save-btn[aria-pressed="true"] svg { fill: currentColor; }

/* ── User menu ──────────────────────────────────────────────────────────────── */

.user-menu { position: relative; flex: none; }
.user-menu__button {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--ink);
  color: var(--cream);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.user-menu__panel {
  position: absolute;
  right: 0; top: 44px;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 8px;
  z-index: 60;
}
.user-menu__panel a,
.user-menu__panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.user-menu__panel a:hover,
.user-menu__panel button:hover { background: var(--cream); }
