/* ============================================================
   THE QUOTE SHELF — styles.css
   Night (default) + Day theme
   Fonts: Fraunces (quotes/display) · DM Sans (UI) · DM Mono (catalog)
   Layout: sticky header → qotd banner → sidebar + scrollable grid
   ============================================================ */

/* ── TOKENS ───────────────────────────────────────────────── */
:root {
  /* night palette */
  --bg:           #0d0e13;
  --bg-1:         #13151c;
  --bg-2:         #1a1d27;
  --bg-3:         #222636;
  --border:       #2a2e42;
  --border-hi:    #383d55;

  --text:         #c8cde0;
  --text-dim:     #998f59;
  --text-bright:  #eef0f8;
  --text-muted:   #3e4260;

  --gold:         #c9893a;
  --gold-hi:      #e8a84a;
  --gold-glow:    rgba(201,137,58,.13);
  --gold-glow-hi: rgba(201,137,58,.22);

  --rose:         #c05a5a;
  --teal:         #4a8fa0;
  --green:        #4a9060;

  --font-d: 'Fraunces', Georgia, serif;
  --font-b: 'DM Sans', system-ui, sans-serif;
  --font-m: 'DM Mono', 'Courier New', monospace;

  --r-sm: 5px;
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 22px;

  --header-h: 56px;
  --qotd-h:   0px;   /* updated by JS */
  --sidebar-w: 240px;

  --tr: 200ms cubic-bezier(.25,.46,.45,.94);
  --tr-slow: 350ms cubic-bezier(.25,.46,.45,.94);

  --shadow: 0 2px 12px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 36px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.4);
  --shadow-modal: 0 24px 80px rgba(0,0,0,.7), 0 4px 16px rgba(0,0,0,.5);
}

[data-theme="day"] {
  --bg:           #f0ece2;
  --bg-1:         #faf7f0;
  --bg-2:         #f5f1e8;
  --bg-3:         #ede8db;
  --border:       #d8d2c4;
  --border-hi:    #c5bfb0;

  --text:         #3a3628;
  --text-dim:     #7a7260;
  --text-bright:  #18160f;
  --text-muted:   #b0a898;

  --gold:         #9a6520;
  --gold-hi:      #b87828;
  --gold-glow:    rgba(154,101,32,.1);
  --gold-glow-hi: rgba(154,101,32,.18);

  --shadow: 0 2px 8px rgba(0,0,0,.09), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.07);
  --shadow-modal: 0 24px 80px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.1);
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--tr-slow), color var(--tr-slow);
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }

/* ── SKIP LINK ────────────────────────────────────────────── */
.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--gold); color: #000;
  padding: .5rem 1rem; border-radius: var(--r); font-weight: 600; z-index: 9999;
}
.skip-link:focus { top: .75rem; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-b); font-size: .85rem; font-weight: 500;
  line-height: 1; white-space: nowrap; border-radius: var(--r-sm);
  transition: all var(--tr); cursor: pointer;
}
.btn-ghost {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); padding: .55rem 1rem;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-glow); }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
.btn-primary {
  background: var(--gold); border: 1px solid var(--gold);
  color: #000; padding: .55rem 1.1rem; font-weight: 600;
}
.btn-primary:hover { background: var(--gold-hi); border-color: var(--gold-hi); }
.btn-icon {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-dim); padding: .45rem;
  border-radius: var(--r-sm); width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--gold); border-color: var(--gold); }

/* ── HEADER ───────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 300;
  height: var(--header-h);
  background: rgba(13,14,19,.9);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  transition: background var(--tr-slow);
}
[data-theme="day"] .header {
  background: rgba(240,236,226,.92);
}
.header__inner {
  max-width: 1440px; margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-columns: 200px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  color: var(--text-bright); font-family: var(--font-d);
  font-size: 1.05rem; font-weight: 400; letter-spacing: -.01em;
  text-decoration: none; flex-shrink: 0;
}
.brand svg { color: var(--gold); }
.brand:hover { color: var(--gold-hi); }
.header__center { display: flex; align-items: center; }
.search-box {
  display: flex; align-items: center; gap: .6rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: .5rem .9rem;
  width: 100%; max-width: 520px;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.search-box:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.search-box svg { color: var(--text-dim); flex-shrink: 0; }
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-bright); font-size: .9rem; flex: 1;
}
.search-box input::placeholder { color: var(--text-dim); }
.header__actions { display: flex; align-items: center; gap: .5rem; }

/* ── QOTD BANNER ──────────────────────────────────────────── */
.qotd-banner {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}
.qotd-banner__inner {
  max-width: 1440px; margin: 0 auto;
  padding: .7rem 1.25rem;
  display: flex; align-items: baseline; gap: 1rem;
  flex-wrap: wrap;
}
.qotd-banner__label {
  display: flex; align-items: center; gap: .35rem;
  font-family: var(--font-m); font-size: .68rem;
  font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold); flex-shrink: 0;
}
.qotd-banner__quote {
  font-family: var(--font-d); font-size: 1.1rem; font-style: italic;
  color: var(--text-bright); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qotd-banner__quote::before { content: '\201C'; color: var(--gold); margin-right: .15em; }
.qotd-banner__quote::after  { content: '\201D'; color: var(--gold); margin-left: .1em; }
.qotd-banner__author {
  font-family: var(--font-b); font-size: .8rem; font-weight: 500;
  color: var(--text-dim); flex-shrink: 0;
}
.qotd-banner:hover .qotd-banner__quote { color: var(--gold-hi); }

/* ── LAYOUT ───────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1440px; margin: 0 auto;
  min-height: calc(100vh - var(--header-h) - 44px);
  align-items: start;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--border);
  padding: 1rem 0 2rem;
  display: flex; flex-direction: column; gap: 0;
  background: var(--bg-1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem .6rem; margin-bottom: .25rem;
  border-bottom: 1px solid var(--border);
}
.sidebar__title {
  font-family: var(--font-m); font-size: .7rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim);
}
.sidebar__count {
  font-family: var(--font-m); font-size: .68rem;
  color: var(--text-muted); background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 20px;
  padding: .1rem .5rem;
}
.sidebar__search {
  display: flex; align-items: center; gap: .5rem;
  margin: .6rem .75rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: .4rem .65rem;
  transition: border-color var(--tr);
}
.sidebar__search:focus-within { border-color: var(--gold); }
.sidebar__search svg { color: var(--text-dim); flex-shrink: 0; }
.sidebar__search input {
  background: none; border: none; outline: none;
  color: var(--text-bright); font-size: .82rem; width: 100%;
}
.sidebar__search input::placeholder { color: var(--text-muted); }

.sidebar__list { display: flex; flex-direction: column; gap: 1px; padding: 0 .5rem; flex: 1; }

.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; width: 100%; text-align: left;
  background: none; border: none;
  border-radius: var(--r-sm);
  padding: .5rem .6rem;
  color: var(--text-dim); font-size: 1rem;
  transition: background var(--tr), color var(--tr);
  cursor: pointer;
}
.cat-item:hover { background: var(--bg-3); color: var(--text); }
.cat-item.active {
  background: var(--gold-glow); color: var(--gold);
  font-weight: 600;
}
.cat-item__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item__count {
  font-family: var(--font-m); font-size: .66rem;
  background: var(--bg-3); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 20px;
  padding: .1rem .45rem; flex-shrink: 0;
}
.cat-item.active .cat-item__count { background: var(--gold-glow); border-color: var(--gold); color: var(--gold); }

.sidebar__more {
  margin: .5rem .75rem 0;
  background: none; border: 1px dashed var(--border);
  border-radius: var(--r-sm); padding: .45rem .75rem;
  color: var(--text-dim); font-size: .78rem;
  transition: all var(--tr); cursor: pointer; text-align: left;
}
.sidebar__more:hover { color: var(--gold); border-color: var(--gold); }

.sidebar__stats {
  margin-top: auto; padding: .75rem 1rem 0;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: .35rem;
}
.sidebar__stat {
  display: flex; justify-content: space-between;
  font-size: .75rem; color: var(--text-dim);
}
.sidebar__stat strong { color: var(--text); font-weight: 500; }

/* ── CONTENT / MAIN ───────────────────────────────────────── */
.content { padding: 1rem 1.25rem 3rem; min-width: 0; }

/* Controls bar */
.controls-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .85rem;
}
.controls-bar__left { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.controls-bar__right { display: flex; align-items: center; gap: .75rem; }
.filter-select {
  display: flex; align-items: center; gap: .4rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: .38rem .7rem;
  transition: border-color var(--tr);
}
.filter-select:focus-within { border-color: var(--gold); }
.filter-select label { font-size: .74rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.filter-select select { background: none; border: none; outline: none; color: var(--text-bright); font-size: .84rem; cursor: pointer; }
.filter-select select option { background: var(--bg-2); }
.results-meta { font-family: var(--font-m); font-size: .7rem; color: var(--text-dim); letter-spacing: .04em; }

/* Active filter chip */
.active-filter {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--gold-glow); border: 1px solid var(--gold);
  border-radius: 20px; padding: .3rem .7rem;
  font-size: .78rem; color: var(--gold); font-weight: 500;
  margin-bottom: .85rem;
}
.active-filter__clear {
  background: none; border: none; color: var(--gold);
  display: flex; align-items: center; cursor: pointer;
  opacity: .7; transition: opacity var(--tr);
}
.active-filter__clear:hover { opacity: 1; }

/* ── QUOTE GRID ───────────────────────────────────────────── */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* ── QUOTE CARD ───────────────────────────────────────────── */
.q-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.4rem 1.4rem 1rem;
  display: flex; flex-direction: column;
  gap: .75rem;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
  cursor: pointer;
}
.q-card::before {
  content: '\201C';
  position: absolute; top: .2rem; right: 1rem;
  font-family: var(--font-d); font-size: 4.5rem; line-height: 1;
  color: var(--gold); opacity: .06; pointer-events: none;
}
.q-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-hi); }
.q-card:hover .q-card__quote { color: var(--text-bright); }

.q-card__catalog {
  font-family: var(--font-m); font-size: .64rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted);
}
.q-card__quote {
  font-family: var(--font-d); font-size: 1.2rem; font-weight: 300;
  font-style: italic; line-height: 1.65; color: var(--text-bright);
  flex: 1;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.q-card__author { font-size: .82rem; font-weight: 600; color: var(--text); }
.q-card__source { font-size: .76rem; color: var(--text-dim); font-style: italic; }
.q-card__tags {
  display: flex; flex-wrap: wrap; gap: .3rem;
}
.q-card__tag {
  font-family: var(--font-m); font-size: .62rem; font-weight: 500;
  color: var(--text-dim); background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 3px;
  padding: .14rem .4rem; cursor: pointer;
  transition: all 140ms;
}
.q-card__tag:hover { color: var(--gold); border-color: var(--gold); }

.q-card__actions {
  display: flex; align-items: center; gap: .2rem;
  padding-top: .65rem;
  border-top: 1px solid var(--border);
}
.q-card__btn {
  display: flex; align-items: center; gap: .3rem;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: .76rem; font-weight: 500;
  font-family: var(--font-b); padding: .3rem .5rem;
  border-radius: var(--r-sm); transition: all 140ms;
}
.q-card__btn:hover { color: var(--gold); background: var(--gold-glow); }
.q-card__btn.active { color: var(--rose); }
.q-card__btn.active svg { fill: var(--rose); stroke: var(--rose); }
.q-card__btn--right { margin-left: auto; }

/* ── LOAD MORE ────────────────────────────────────────────── */
.load-more-row {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.load-more-count {
  font-family: var(--font-m); font-size: .72rem;
  color: var(--text-dim); letter-spacing: .04em;
}

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: .85rem; padding: 4rem 1rem; text-align: center;
  color: var(--text-dim);
}
.empty-state__icon { font-size: 2rem; color: var(--text-muted); }
.empty-state p { font-size: .95rem; }

/* ── FAVOURITES ───────────────────────────────────────────── */
.favs-section {
  margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.favs-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1rem;
}
.favs-header h3 {
  font-family: var(--font-d); font-size: 1.2rem; font-weight: 400;
  color: var(--text-bright); display: flex; align-items: center; gap: .5rem;
}
.favs-count {
  background: var(--gold); color: #000;
  font-family: var(--font-m); font-size: .7rem; font-weight: 600;
  border-radius: 20px; padding: .15rem .5rem;
}
.favs-row { display: flex; flex-wrap: wrap; gap: .85rem; }
.fav-mini {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: .9rem 1rem;
  max-width: 260px; position: relative; cursor: pointer;
  transition: border-color var(--tr);
}
.fav-mini:hover { border-color: var(--gold); }
.fav-mini p {
  font-family: var(--font-d); font-size: .88rem; font-style: italic;
  color: var(--text); line-height: 1.5; margin-bottom: .4rem;
}
.fav-mini small { font-size: .74rem; color: var(--text-dim); font-weight: 600; }
.fav-mini__remove {
  position: absolute; top: .4rem; right: .4rem;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all 140ms;
}
.fav-mini__remove:hover { color: var(--rose); background: rgba(192,90,90,.12); }

/* ── DETAIL OVERLAY ───────────────────────────────────────── */
.detail-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: var(--bg);
  overflow-y: auto;
  animation: slideIn .22s cubic-bezier(.25,.46,.45,.94);
}
.detail-overlay[hidden] { display: none; }
@keyframes slideIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.detail-panel {
  max-width: 860px; margin: 40px auto;
  padding: 1.25rem 1.5rem 4rem;
  display: flex; flex-direction: column; gap: 0;
}

.detail-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding-top: .85rem;
}
.detail-panel__catalog {
  font-family: var(--font-m); font-size: .68rem;
  color: var(--text-dim); letter-spacing: .08em; text-transform: uppercase;
}

/* Quote hero block */
.detail-quote-block {
  position: relative;
  padding: 2rem 2rem 1.75rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.detail-quote-block::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--gold-glow) 0%, transparent 55%);
  pointer-events: none;
}
.detail-quote-mark {
  font-family: var(--font-d); font-size: 6rem; line-height: 1;
  color: var(--gold); opacity: .2;
  position: absolute; top: .5rem; left: 1.25rem;
  pointer-events: none; user-select: none;
}
.detail-quote {
  font-family: var(--font-d); font-size: clamp(1.2rem,2.2vw,1.7rem);
  font-weight: 300; font-style: italic; line-height: 1.6;
  color: var(--text-bright);
  position: relative; z-index: 1;
  padding-left: .5rem;
  margin-bottom: 1.25rem;
}
.detail-attribution {
  display: flex; align-items: baseline; gap: .6rem;
  flex-wrap: wrap; position: relative; z-index: 1;
}
.detail-author { font-size: .95rem; font-weight: 600; color: var(--text); }
.detail-source { font-size: .85rem; font-style: italic; color: var(--text-dim); }
.detail-source::before { content: '— '; }

/* Tags */
.detail-tags {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin-bottom: 1.5rem;
}
.detail-tag {
  font-family: var(--font-m); font-size: .68rem; font-weight: 500;
  color: var(--text-dim); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 4px;
  padding: .2rem .5rem; cursor: pointer; transition: all 140ms;
}
.detail-tag:hover { color: var(--gold); border-color: var(--gold); background: var(--gold-glow); }

/* Action tabs */
.detail-tabs {
  display: flex; gap: .3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.detail-tab {
  display: flex; align-items: center; gap: .4rem;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-dim); font-size: .84rem; font-weight: 500;
  padding: .6rem .9rem; margin-bottom: -1px;
  cursor: pointer; transition: all var(--tr);
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.detail-tab-panels { margin-bottom: 2rem; }
.detail-tab-panel { display: none; }
.detail-tab-panel.active { display: block; }

/* Share panel */
.share-actions {
  display: grid; grid-template-columns: repeat(4,1fr); gap: .65rem;
  margin-bottom: 1rem;
}
.share-action {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: .9rem .5rem;
  color: var(--text-dim); font-size: .76rem; font-weight: 500;
  cursor: pointer; transition: all var(--tr);
}
.share-action:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-glow); }
.share-action svg { color: inherit; }

.share-url-row {
  display: flex; gap: .5rem; align-items: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); overflow: hidden; padding: 0;
}
.share-url-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-dim); font-family: var(--font-m); font-size: .76rem;
  padding: .6rem .85rem;
}
.share-url-row .btn { border-radius: 0; border: none; border-left: 1px solid var(--border); }

/* Image card panel */
.image-controls { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .65rem; }
.image-style-row { display: flex; align-items: center; gap: .75rem; }
.image-controls__label {
  font-size: .74rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-dim); width: 38px; flex-shrink: 0;
}
.style-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.style-pill, .size-pill {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 20px; padding: .28rem .75rem;
  font-size: .76rem; font-weight: 500; color: var(--text-dim);
  cursor: pointer; transition: all var(--tr);
}
.style-pill:hover, .size-pill:hover { border-color: var(--gold); color: var(--gold); }
.style-pill.active, .size-pill.active { background: var(--gold); border-color: var(--gold); color: #000; font-weight: 600; }

.canvas-wrap {
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--border); margin-bottom: 1rem;
  background: #111;
  max-height: 420px; display: flex; align-items: center; justify-content: center;
}
.canvas-wrap canvas { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; }

.image-actions { display: flex; gap: .65rem; flex-wrap: wrap; }

/* Embed panel */
.embed-intro { font-size: .85rem; color: var(--text-dim); margin-bottom: 1rem; }
.embed-with-preview {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-bottom: 1rem;
}
.embed-preview-wrap {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); overflow: auto;
  padding: 1.25rem; display: flex; align-items: center; justify-content: center;
}
.embed-preview blockquote {
  font-family: var(--font-d); font-style: italic; font-size: 1rem;
  color: var(--text-bright); line-height: 1.6; margin-bottom: .65rem;
}
.embed-preview blockquote::before { content: '\201C'; color: var(--gold); }
.embed-preview blockquote::after  { content: '\201D'; color: var(--gold); }
.embed-preview .ep-author { font-size: .8rem; font-weight: 600; color: var(--text-dim); }
.embed-preview .ep-source { font-size: .76rem; font-style: italic; color: var(--text-muted); }
.embed-preview a { color: var(--gold); font-size: .7rem; text-decoration: none; }
.embed-code-wrap {
  display: flex; flex-direction: column; gap: .5rem;
}
.embed-textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text-dim);
  font-family: var(--font-m); font-size: .72rem;
  padding: .75rem .9rem; resize: none; line-height: 1.55;
  flex: 1;
}
.embed-actions { display: flex; gap: .5rem; }
.embed-note { font-size: .76rem; color: var(--text-muted); font-style: italic; }

/* Detail footer */
.detail-panel__footer {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
.detail-fav-btn.active { color: var(--rose); border-color: var(--rose); }
.detail-fav-btn.active svg { fill: var(--rose); stroke: var(--rose); }

/* ── RANDOM MODAL ─────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.65); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.modal-bg[hidden] { display: none; }
.modal {
  background: var(--bg-1); border: 1px solid var(--border-hi);
  border-radius: var(--r-xl); padding: 1.75rem;
  max-width: 520px; width: 100%; position: relative;
  box-shadow: var(--shadow-modal);
  animation: popIn .24s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from { opacity:0; transform: scale(.94) translateY(12px); } to { opacity:1; transform: none; } }

.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .5rem;
}
.modal__eyebrow {
  font-family: var(--font-m); font-size: .68rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
}
.modal__close { flex-shrink: 0; }
.modal__catalog {
  font-family: var(--font-m); font-size: .65rem; color: var(--text-dim);
  letter-spacing: .06em; margin-bottom: .9rem; opacity: .6;
}
.modal__quote {
  font-family: var(--font-d); font-size: 1.15rem; font-weight: 300;
  font-style: italic; line-height: 1.65; color: var(--text-bright);
  margin-bottom: .85rem;
}
.modal__quote::before { content: '\201C'; color: var(--gold); font-size: 2rem; line-height: 0; vertical-align: -.4em; margin-right: .1em; }
.modal__attribution { font-size: .88rem; color: var(--text-dim); margin-bottom: .85rem; }
.modal__attribution span:first-child { font-weight: 600; color: var(--text); }
.modal__source::before { content: ' — '; }
.modal__tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1.25rem; }
.modal__tag {
  font-family: var(--font-m); font-size: .64rem;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 3px; padding: .15rem .4rem; color: var(--text-dim);
}
.modal__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── FOOTER ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}
.footer__inner {
  max-width: 1440px; margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.footer__inner span { font-size: .78rem; color: var(--text-dim); }
.footer__top {
  display: flex; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--text-dim); margin-left: auto;
  transition: color var(--tr);
}
.footer__top:hover { color: var(--gold); }

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text-bright); color: var(--bg);
  padding: .55rem 1.1rem; border-radius: 20px;
  font-size: .82rem; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 1000;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── FOCUS RINGS ──────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
  .share-actions { grid-template-columns: repeat(2,1fr); }
  .embed-with-preview { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    max-height: 280px;
  }
  .header__inner { grid-template-columns: auto 1fr auto; }
  .header__center { display: none; }
  .quote-grid { grid-template-columns: 1fr; }
  .detail-panel { padding: 1rem 1rem 3rem; }
  .share-actions { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 520px) {
  .share-actions { grid-template-columns: repeat(2,1fr); }
  .canvas-wrap { max-height: 260px; }
  .controls-bar { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .detail-overlay { animation: none; }
  .modal { animation: none; }
}
