/* Famous Quotations Network – slate & gold, since 1998 */

@font-face { font-family: "Lora"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/lora-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400; font-display: swap; src: url("/static/fonts/lora-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/lora-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }

:root {
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --slate: #24333f;
  --slate-2: #33475a;
  --slate-3: #3f566c;
  --gold: #f6cd34;
  --gold-ink: #24333f;           /* text on gold */
  --orange: #d98a1f;

  --page: #f5f1e8;               /* warm off-white */
  --paper: #fffdf9;
  --panel: #faf6ec;
  --ink: #26323d;
  --heading: #24333f;
  --muted: #56616c;
  --line: #d9d2c3;
  --line-strong: #b9b09d;
  --link: #1d4e89;
  --link-hover: #11335d;
  --qotd-bg: #fdf4d3;
  --qotd-border: #f0c63a;
  --qotd-label: #6f5300;
  --pill-bg: #f1ece0;
  --pill-ink: #3a4652;
  --ok: #2e7d4f;
  --warn: #a14f0c;
  --shadow: 0 1px 0 rgba(36, 51, 63, 0.06), 0 8px 24px rgba(36, 51, 63, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #10171d;
    --paper: #16212a;
    --panel: #1b2833;
    --ink: #e3e7ea;
    --heading: #f3e4a8;
    --muted: #a6b0b9;
    --line: #2c3a46;
    --line-strong: #43535f;
    --link: #93bdf2;
    --link-hover: #c3dbfa;
    --qotd-bg: #2a2614;
    --qotd-border: #8f7a22;
    --qotd-label: #f1d470;
    --pill-bg: #22313d;
    --pill-ink: #d6dde3;
    --ok: #3f9a64;
    --warn: #c96f2a;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #10171d;
  --paper: #16212a;
  --panel: #1b2833;
  --ink: #e3e7ea;
  --heading: #f3e4a8;
  --muted: #a6b0b9;
  --line: #2c3a46;
  --line-strong: #43535f;
  --link: #93bdf2;
  --link-hover: #c3dbfa;
  --qotd-bg: #2a2614;
  --qotd-border: #8f7a22;
  --qotd-label: #f1d470;
  --pill-bg: #22313d;
  --pill-ink: #d6dde3;
  --ok: #3f9a64;
  --warn: #c96f2a;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}
a { color: var(--link); text-decoration: none; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 2px; }
button { font: inherit; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--gold); color: var(--gold-ink);
  padding: 10px 16px; border-radius: 4px; font-weight: 700;
}
.skip-link:focus { top: 12px; text-decoration: none; }

.wrap { max-width: 1120px; margin: 0 auto; background: var(--paper); box-shadow: var(--shadow); }

/* ---------- Header ---------- */
.site-header { background: var(--slate); padding: 20px 28px 0; color: #fff; }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; flex-direction: column; line-height: 1; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-main { font: 600 34px/1 var(--serif); color: var(--gold); letter-spacing: 0.2px; }
.logo-sub { font-size: 12px; color: #c9d3dc; letter-spacing: 6px; text-transform: uppercase; margin-top: 7px; }
.header-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search { display: flex; align-items: center; gap: 8px; margin: 0; position: relative; }
.search label { font-variant: small-caps; color: var(--gold); font-size: 15px; letter-spacing: 1px; }
.search-field { position: relative; }
.search input {
  width: 250px; max-width: 52vw; height: 40px; border: 1px solid var(--gold); border-radius: 3px;
  padding: 0 12px; font: inherit; font-size: 15px; background: #fff; color: #1d2731;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
  background: var(--gold); color: var(--gold-ink); border: 0; border-radius: 3px; font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; color: var(--gold-ink); filter: brightness(0.95); }
.btn-dark { background: var(--slate); color: var(--gold); }
.btn-dark:hover { color: var(--gold); }
.btn-ghost { background: transparent; color: var(--link); border: 1px solid var(--line-strong); }
.btn-ghost:hover { color: var(--link-hover); background: var(--panel); filter: none; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 3px; border: 1px solid #4b6074; background: transparent; color: var(--gold);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.theme-toggle:hover { background: var(--slate-2); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

.tabs {
  display: flex; gap: 4px; margin-top: 18px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; background: var(--slate-2); color: #fff; padding: 10px 18px; font-size: 15px; border-radius: 4px 4px 0 0;
}
.tabs a:hover { text-decoration: none; background: var(--slate-3); color: #fff; }
.tabs a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.gold-rule { height: 6px; background: var(--gold); }

.az-bar { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; padding: 10px 28px; background: var(--panel); border-bottom: 1px solid var(--line); }
.az-bar-label { font-variant: small-caps; letter-spacing: 1px; color: var(--muted); font-size: 15px; margin-right: 4px; }
.az-bar nav { display: flex; flex-wrap: wrap; gap: 2px; }
.az-bar a { min-width: 28px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 3px; font-weight: 600; font-size: 15px; }
.az-bar a:hover, .az-bar a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); text-decoration: none; }

/* Mobile sticky search */
.mobile-search { display: none; }
@media (max-width: 720px) {
  .mobile-search {
    display: flex; position: fixed; left: 0; right: 0; top: 0; z-index: 30; gap: 8px; padding: 8px 12px;
    background: var(--slate); box-shadow: 0 2px 8px rgba(0,0,0,.25); transform: translateY(-110%); transition: transform .2s ease;
  }
  .mobile-search.is-visible { transform: none; }
  .mobile-search .search-field { flex: 1; }
  .mobile-search input { width: 100%; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .mobile-search { transition: none; } }

/* ---------- Layout ---------- */
.cols { display: flex; flex-wrap: wrap; align-items: stretch; }
.col-left { flex: 1 1 200px; max-width: 100%; padding: 24px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 24px; }
.col-main { flex: 999 1 520px; min-width: 0; padding: 28px 36px 40px; display: flex; flex-direction: column; gap: 28px; }
.col-right { flex: 1 1 250px; max-width: 100%; padding: 24px 20px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 22px; }
.layout-wide .col-main { flex-basis: 640px; }

.box { display: flex; flex-direction: column; gap: 6px; }
.box-title {
  margin: 0 0 6px; background: var(--gold); color: var(--gold-ink); font-size: 15px; font-variant: small-caps; font-weight: 700;
  letter-spacing: 2px; text-align: center; padding: 3px 0; border-radius: 3px;
}
.box-title.dark { background: var(--slate); color: var(--gold); }
.arrow-list { list-style: none; margin: 0; padding: 0; }
.arrow-list li { padding: 3px 0 3px 16px; position: relative; }
.arrow-list li::before {
  content: ""; position: absolute; left: 1px; top: 0.72em; border-left: 8px solid var(--orange);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 22px; }
@media (max-width: 760px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }

h1, h2.section { font-family: var(--serif); font-variant: small-caps; color: var(--heading); letter-spacing: 0.5px; margin: 0; font-weight: 600; }
h1 { font-size: 32px; line-height: 1.15; }
h2.section { font-size: 23px; line-height: 1.25; }
.lede { margin: 0; font-size: 18px; }
.meta { color: var(--muted); font-size: 15px; }
.crumbs { font-size: 14px; color: var(--muted); }
.count { color: var(--muted); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; border-radius: 999px;
  background: var(--pill-bg); color: var(--pill-ink); border: 1px solid var(--line); font-size: 15px; cursor: pointer;
}
a.pill:hover { text-decoration: none; border-color: var(--gold); color: var(--pill-ink); }
.pill .count { font-size: 13px; }
.pill[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.pill[aria-pressed="true"] .count { color: var(--gold-ink); }
.pill-sm { min-height: 28px; padding: 2px 10px; font-size: 13px; }

/* Quote of the day */
.qotd { background: var(--qotd-bg); border: 1px solid var(--qotd-border); border-radius: 6px; padding: 26px 30px; display: flex; flex-direction: column; gap: 12px; }
.qotd-label { font-variant: small-caps; letter-spacing: 2px; font-size: 15px; color: var(--qotd-label); font-weight: 700; }
.qotd blockquote { margin: 0; font: 400 28px/1.4 var(--serif); color: var(--heading); }
.qotd-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.qotd-author { font-variant: small-caps; letter-spacing: 1px; font-size: 18px; font-weight: 600; }

/* A–Z grid on home */
.az { display: flex; flex-wrap: wrap; gap: 6px; }
.az a {
  min-width: 38px; height: 38px; padding: 0 6px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 3px; font-weight: 700; background: var(--paper);
}
.az a:hover, .az a[aria-current="page"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); text-decoration: none; }

/* ---------- Quotes ---------- */
.quote-list { display: flex; flex-direction: column; }
.quote { border-bottom: 1px solid var(--line); padding: 26px 0; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 70px; }
.quote:first-child { padding-top: 6px; }
.quote:target { background: var(--qotd-bg); box-shadow: 0 0 0 14px var(--qotd-bg); border-radius: 2px; }
.quote blockquote { margin: 0; font: 400 23px/1.5 var(--serif); color: var(--heading); }
.quote-author { font-variant: small-caps; letter-spacing: 1px; font-size: 17px; font-weight: 600; }
.quote-author a { color: var(--link); }
.quote-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px; color: var(--muted); }
.quote-actions { display: none; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.js .quote-actions { display: flex; }
.act {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 3px;
  border: 1px solid var(--line); background: transparent; color: var(--link); font-size: 14px; font-weight: 600; cursor: pointer;
}
.act:hover { background: var(--panel); border-color: var(--line-strong); text-decoration: none; }
.act svg { width: 16px; height: 16px; flex: none; }
.act-engrave { background: var(--slate); color: var(--gold); border-color: var(--slate); }
.act-engrave:hover { background: var(--slate-2); border-color: var(--slate-2); }
.badge { color: #fff; font-weight: 700; padding: 2px 9px; border-radius: 10px; font-size: 12px; }
.badge.ok { background: var(--ok); }
.badge.warn { background: var(--warn); }
.badge.neutral { background: #5b6874; }
a.badge:hover { color: #fff; text-decoration: none; filter: brightness(1.1); }
.source { font-style: normal; color: var(--muted); font-size: 14px; flex-basis: 100%; order: -1; }
.quote-meta .badge { order: -2; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--slate); color: #fff;
  padding: 10px 18px; border-radius: 4px; font-size: 15px; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

/* Author / topic header */
.page-head { display: flex; flex-direction: column; gap: 8px; padding-bottom: 4px; }
.filter-note { font-size: 15px; color: var(--muted); }

.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 12px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 3px; background: var(--paper);
}
.pager a:hover { text-decoration: none; border-color: var(--gold); }
.pager [aria-current="page"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 700; }

.related { border-top: 1px solid var(--line); padding-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.letter-group { display: flex; flex-direction: column; gap: 8px; }
.notice { padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: 4px; color: var(--muted); }

/* ---------- Search suggestions ---------- */
.suggest {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 40; min-width: 100%; width: max-content; max-width: min(420px, 92vw);
  margin: 0; padding: 4px 0; list-style: none; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.suggest[hidden] { display: none; }
.suggest li { padding: 8px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 14px; font-size: 15px; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--pill-bg); }
.suggest .kind { color: var(--muted); font-size: 13px; }
.suggest mark { background: none; color: inherit; font-weight: 700; }

/* ---------- Engrave preview ---------- */
dialog.engrave {
  border: 0; border-radius: 8px; padding: 0; width: min(560px, 94vw); background: var(--paper); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog.engrave::backdrop { background: rgba(16, 23, 29, 0.6); }
.engrave-body { padding: 24px 26px; display: flex; flex-direction: column; gap: 16px; }
.engrave-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.engrave-head h2 { margin: 0; font: 600 22px/1.2 var(--serif); font-variant: small-caps; color: var(--heading); }
.close-btn { width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted); font-size: 26px; cursor: pointer; border-radius: 3px; }
.close-btn:hover { background: var(--panel); }
.metal {
  position: relative; margin: 4px auto; width: 100%; max-width: 440px; padding: 34px 30px 30px; border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, rgba(0,0,0,.03) 1px 3px),
    linear-gradient(135deg, #e9ecef 0%, #c9ced3 35%, #f4f6f7 55%, #b9bfc5 80%, #dfe3e6 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 6px rgba(0,0,0,.18), 0 6px 18px rgba(0,0,0,.25);
  color: #4d5862; text-align: center;
}
.metal::before {
  content: ""; position: absolute; top: 12px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #6b747c, #2c3236); box-shadow: inset 0 1px 2px rgba(0,0,0,.6);
}
.metal-text { margin: 10px 0 0; font: 400 21px/1.45 var(--serif); text-shadow: 0 1px 0 rgba(255,255,255,.8), 0 -1px 0 rgba(0,0,0,.25); }
.metal-author { margin-top: 12px; font-variant: small-caps; letter-spacing: 2px; font-size: 15px; text-shadow: 0 1px 0 rgba(255,255,255,.8); }
.metal.long .metal-text { font-size: 16px; }
.engrave-note { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { background: var(--slate); color: #c9d3dc; padding-bottom: 20px; }
.site-footer svg { display: block; width: 100%; height: 70px; background: var(--paper); }
.footer-row { padding: 0 28px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-row a { color: var(--gold); }

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

@media (max-width: 720px) {
  body { font-size: 16px; }
  .site-header { padding: 16px 16px 0; }
  .header-tools { width: 100%; }
  .header-tools .search { flex: 1; }
  .header-tools .search-field { flex: 1; }
  .header-tools .search input { width: 100%; max-width: none; }
  .header-tools .search label { display: none; }
  .az-bar { padding: 8px 16px; }
  .col-main { padding: 22px 16px 32px; }
  .col-left, .col-right { border: 0; border-top: 1px solid var(--line); padding: 22px 16px; }
  .col-left { order: 2; }
  .col-right { order: 3; }
  h1 { font-size: 27px; }
  .qotd { padding: 20px; }
  .qotd blockquote { font-size: 23px; }
  .quote blockquote { font-size: 20px; }
  .quote-actions { margin-left: 0; }
  .footer-row { padding: 0 16px; }
}
