/* =========================================================================
   ForeverAfter.life — Quotes library (public index + single quote page)
   Ported from the design (Quotes.html / Quote.html). The design's local design
   tokens are aliased onto the site's --ff-* tokens so the pages inherit the
   shared palette. Loaded only on the quote pages (linked from their templates).
   ========================================================================= */

:root {
  --surface: var(--ff-surface);
  --surface-2: var(--ff-surface-2);
  --ink: var(--ff-ink);
  --ink-2: var(--ff-ink-2);
  --ink-3: var(--ff-ink-3);
  --line: var(--ff-line);
  --line-soft: var(--ff-line-soft);
  --accent: var(--ff-accent);
  --accent-deep: var(--ff-accent-deep);
  --accent-soft: var(--ff-accent-soft);
  --accent-tint: var(--ff-accent-tint);
  --font-serif: var(--ff-font-serif);
  --font-sans: var(--ff-font-sans);
  --radius-lg: var(--ff-radius-lg);
  --serif-tighten: -0.01em;
  --shadow-sm: var(--ff-shadow-sm);
  --shadow-md: 0 8px 30px oklch(0.4 0.03 250 / 0.08), 0 3px 10px oklch(0.4 0.03 250 / 0.05);
  --shadow-lg: var(--ff-shadow-lg);
}

/* ---- Shared page shell ---- */
.q-wrap, .qv-wrap { max-width: 1040px; margin: 0 auto; }
.q-wrap { padding: 46px 32px 120px; }
.qv-wrap { padding: 20px 32px 80px; }
@media (max-width: 640px) {
  .q-wrap { padding: 32px 18px 90px; }
  .qv-wrap { padding: 16px 18px 64px; }
}

/* ============================ Index ============================ */
.q-head { padding-bottom: 30px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.q-head h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(2.1rem, 4vw, 2.9rem); line-height: 1.05; letter-spacing: -0.01em; }
.q-head p { color: var(--ink-2); font-size: 1.01rem; margin: 10px 0 0; max-width: 480px; }
.q-head-cta { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.q-head-cta .muted { color: var(--ink-3); }

.q-tools { display: flex; flex-direction: column; gap: 18px; margin-bottom: 30px; }
.q-search-wrap { position: relative; max-width: 460px; }
.q-search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.q-search-icon svg { width: 18px; height: 18px; display: block; }
.q-search { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 13px 44px 13px 46px; transition: border-color .2s, box-shadow .2s; box-shadow: var(--shadow-sm); }
.q-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.q-search::placeholder { color: var(--ink-3); }
.q-search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink-3); display: none; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; line-height: 1; }
.q-search-clear:hover { background: var(--line); color: var(--ink); }
.q-search-clear.visible { display: flex; }

.q-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.q-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all .16s; }
.q-chip:hover { border-color: var(--accent); color: var(--accent-deep); }
.q-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px oklch(0.6 0.1 234 / 0.22); }
.q-chip .n { font-size: 0.78rem; opacity: 0.7; font-weight: 500; }
.q-chip[aria-pressed="true"] .n { opacity: 0.85; }

.q-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 740px) { .q-grid { grid-template-columns: 1fr; } }

.q-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 28px 28px 20px; transition: box-shadow .22s, transform .22s, border-color .22s; }
.q-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: oklch(0.88 0.02 234); }
.q-card[hidden] { display: none; }
.q-mark { font-family: var(--font-serif); font-size: 3.4rem; line-height: 0.6; color: var(--accent-soft); height: 28px; margin-bottom: 6px; user-select: none; }
.q-text { font-family: var(--font-serif); font-weight: 500; font-size: 1.42rem; line-height: 1.38; color: var(--ink); letter-spacing: var(--serif-tighten); }
.q-text a.spot { color: inherit; }
.q-text a.spot:hover { color: var(--accent-deep); }
.q-by { margin-top: 16px; display: flex; align-items: center; gap: 10px; }
.q-by .ln { width: 18px; height: 1px; background: var(--accent); opacity: 0.6; }
.q-by .nm { font-size: 0.92rem; font-weight: 600; color: var(--ink-2); }
.q-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 6px; }
.q-cat { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-deep); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-right: auto; }
.q-act { width: 34px; height: 34px; border-radius: 50%; border: 1px solid transparent; background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; transition: all .15s; text-decoration: none; }
.q-act:hover { background: var(--surface-2); color: var(--accent-deep); border-color: var(--line); }
.q-act svg { width: 16px; height: 16px; }
.q-act.copied { color: oklch(0.55 0.13 150); }

.q-empty { display: none; text-align: center; padding: 64px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.q-empty.show { display: block; }
.q-empty .ic { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 18px; color: var(--ink-3); }
.q-empty .ic svg { width: 24px; height: 24px; }
.q-empty h3 { font-family: var(--font-serif); font-weight: 500; font-size: 1.5rem; margin-bottom: 8px; }
.q-empty p { color: var(--ink-2); font-size: 0.97rem; max-width: 320px; margin: 0 auto; }
.q-text mark { background: var(--accent-soft); color: var(--accent-deep); border-radius: 2px; padding: 0; font-weight: inherit; }

/* ============================ Single quote ============================ */
.qv-crumb { display: flex; align-items: center; gap: 9px; color: var(--ink-3); font-size: 0.9rem; font-weight: 500; margin: 14px 0 26px; }
.qv-crumb a { color: var(--ink-3); transition: color .15s; }
.qv-crumb a:hover { color: var(--accent-deep); }
.qv-crumb .sep { opacity: 0.6; }

.qv-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-md); padding: 18px clamp(28px, 6vw, 84px) 0; }
.qv-inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; text-align: center; padding: clamp(40px, 7vw, 76px) 0 clamp(36px, 6vw, 60px); }
.qv-mark { font-family: var(--font-serif); font-size: 5rem; line-height: 0.4; color: var(--accent-soft); user-select: none; height: 38px; }
.qv-text { font-family: var(--font-serif); font-weight: 500; font-size: clamp(1.9rem, 4.4vw, 3.1rem); line-height: 1.24; letter-spacing: -0.015em; color: var(--ink); margin-top: 18px; }
.qv-by { margin-top: 34px; display: inline-flex; align-items: center; gap: 14px; }
.qv-by .ln { width: 30px; height: 1px; background: var(--accent); opacity: 0.55; }
.qv-by .nm { font-family: var(--font-sans); font-size: 1.04rem; font-weight: 600; color: var(--ink-2); letter-spacing: 0.01em; }
.qv-cat-row { margin-top: 30px; }
.qv-cat { display: inline-block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-deep); background: var(--accent-soft); padding: 6px 14px; border-radius: 999px; }

.qv-actions { position: relative; z-index: 1; border-top: 1px solid var(--line-soft); margin: 0 clamp(-12px, -2vw, -40px); padding: 18px clamp(20px, 4vw, 44px); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; background: linear-gradient(180deg, transparent, var(--accent-tint)); }
.qv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 12px 20px; border-radius: 999px; font-size: 0.93rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: all .18s; cursor: pointer; text-decoration: none; }
.qv-btn svg { width: 17px; height: 17px; }
.qv-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.qv-btn.copied { border-color: oklch(0.7 0.13 150); color: oklch(0.5 0.13 150); }
.qv-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 18px oklch(0.6 0.1 234 / 0.28); }
.qv-btn-primary:hover { filter: brightness(1.04); color: #fff; border-color: var(--accent); transform: translateY(-1px); }

.qv-sub { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.qv-share { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qv-share-lbl { font-size: 0.86rem; color: var(--ink-3); font-weight: 500; }
.qv-soc { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: all .16s; text-decoration: none; }
.qv-soc:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.qv-soc svg { width: 17px; height: 17px; }
.qv-browse { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 600; color: var(--accent-deep); }
.qv-browse:hover { text-decoration: underline; text-underline-offset: 3px; }
.qv-browse svg { width: 16px; height: 16px; }

/* ---- Toast (shared) ---- */
.q-toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; font-size: 0.9rem; font-weight: 500; padding: 12px 20px; border-radius: 999px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; }
.q-toast.show { opacity: 1; transform: translate(-50%, 0); }
.q-toast .tk { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 10px; color: #fff; }
