/* themes.css — 3 visual themes for Book Tracker
   Inspired by the user's favourite series in each genre.
   Each [data-theme] overrides the CSS variables defined in style.css
   plus adds genre-specific typographic and component treatments.        */

/* ── Google Fonts (all 3 theme families) ─────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cinzel+Decorative:wght@400;700&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Exo+2:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════════════════════
   SCI-FI
   Inspired by: Red Rising · Dune · Hyperion · Expeditionary Forces
   ═══════════════════════════════════════════════════════════════ */
[data-theme="scifi"] {
  --bg:          #060b14;
  --surface:     #0d1628;
  --surface2:    #152035;
  --accent:      #c1121f;   /* Red Rising — Ares crimson              */
  --accent2:     #e8c84a;   /* Aureate gold / Dune spice              */
  --accent3:     #38b6e8;   /* Hyperion datasphere blue               */
  --text:        #dce8f8;   /* cold starlight white                   */
  --muted:       #6a82a0;   /* distant nebula grey                    */
  --radius:      8px;
  --shadow:      0 8px 40px rgba(0,0,0,.65);
  --font-display: 'Orbitron', sans-serif;
  --font-body:    'Exo 2', sans-serif;
  --accent-rgb:  193, 18, 31;
  --accent3-rgb: 56, 182, 232;
}

/* Starfield radial glow + faint dot grid */
[data-theme="scifi"] body {
  background-image:
    radial-gradient(ellipse at 50% -5%, rgba(193,18,31,.14) 0%, transparent 55%),
    radial-gradient(circle, rgba(56,182,232,.03) 1px, transparent 1px);
  background-size: 100% 100%, 38px 38px;
}

[data-theme="scifi"] header {
  background: rgba(9,18,36,.96);
  border-bottom: 1px solid rgba(193,18,31,.35);
  backdrop-filter: blur(10px);
}

[data-theme="scifi"] h1 {
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 1.25rem;
  color: var(--text);
}

[data-theme="scifi"] .tab {
  font-family: 'Exo 2', sans-serif;
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .08em;
}

[data-theme="scifi"] .tab.active {
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
}

[data-theme="scifi"] .book-card {
  border: 1px solid rgba(193,18,31,.08);
  border-radius: 8px;
}

[data-theme="scifi"] .book-card:hover {
  border-color: rgba(193,18,31,.4);
  box-shadow: 0 0 0 1px rgba(193,18,31,.15),
              0 8px 32px rgba(0,0,0,.65),
              0 0 40px rgba(193,18,31,.08);
}

[data-theme="scifi"] .btn-add {
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
  border: 1px solid rgba(193,18,31,.5);
  box-shadow: 0 0 14px rgba(193,18,31,.25);
}

[data-theme="scifi"] .btn-add:hover {
  box-shadow: 0 0 22px rgba(193,18,31,.45);
}

[data-theme="scifi"] .genre-pill {
  border-radius: 2px;
  text-transform: uppercase;
  font-size: .6rem;
  letter-spacing: .07em;
}

[data-theme="scifi"] .modal {
  border-radius: 6px;
  border: 1px solid rgba(193,18,31,.2);
  box-shadow: 0 0 60px rgba(193,18,31,.08), var(--shadow);
}

[data-theme="scifi"] .meta-grid {
  border: 1px solid rgba(56,182,232,.1);
}

[data-theme="scifi"] .stat-card {
  border: 1px solid rgba(193,18,31,.2);
  box-shadow: 0 0 20px rgba(193,18,31,.05);
}

[data-theme="scifi"] .section-label {
  letter-spacing: .14em;
}

/* ═══════════════════════════════════════════════════════════════
   FANTASY
   Inspired by: The First Law · Mistborn · A Game of Thrones
   ═══════════════════════════════════════════════════════════════ */
[data-theme="fantasy"] {
  --bg:          #09070a;
  --surface:     #14100f;
  --surface2:    #1e1812;
  --accent:      #9b2335;   /* Mistborn — koloss blood & ash fires    */
  --accent2:     #b87333;   /* Allomancy bronze/copper                */
  --accent3:     #8faab8;   /* Luthadel mist silver                   */
  --text:        #ede4d3;   /* candlelight parchment                  */
  --muted:       #7a6a58;   /* ashfall grey                           */
  --radius:      4px;
  --shadow:      0 8px 32px rgba(0,0,0,.75);
  --font-display: 'Cinzel', serif;
  --font-body:    'Crimson Pro', serif;
  --accent-rgb:  155, 35, 53;
  --accent3-rgb: 143, 170, 184;
}

/* Ember glow rising from below */
[data-theme="fantasy"] body {
  background-image: radial-gradient(ellipse at 50% 110%, rgba(155,35,53,.12) 0%, transparent 55%);
}

[data-theme="fantasy"] header {
  background: rgba(18,14,12,.97);
  border-bottom: 2px solid rgba(155,35,53,.35);
}

[data-theme="fantasy"] h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: .04em;
}

[data-theme="fantasy"] .tab {
  font-family: 'Cinzel', serif;
  font-size: .8rem;
  letter-spacing: .03em;
}

[data-theme="fantasy"] .tab.active {
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
}

[data-theme="fantasy"] .book-card {
  border: 1px solid rgba(155,35,53,.15);
  border-radius: 4px;
}

[data-theme="fantasy"] .book-card:hover {
  border-color: rgba(155,35,53,.45);
  box-shadow: 0 4px 32px rgba(0,0,0,.75);
}

[data-theme="fantasy"] .book-title {
  font-family: 'Cinzel', serif;
  font-size: .82rem;
  line-height: 1.4;
}

[data-theme="fantasy"] .book-author {
  font-style: italic;
}

[data-theme="fantasy"] .btn-add {
  border-radius: 2px;
  font-family: 'Cinzel', serif;
  font-size: .76rem;
  letter-spacing: .06em;
  padding: 10px 20px;
}

[data-theme="fantasy"] .btn-search {
  border-radius: 2px;
}

[data-theme="fantasy"] .genre-pill {
  border-radius: 2px;
  font-family: 'Crimson Pro', serif;
  font-size: .78rem;
  font-style: italic;
  padding: 2px 8px;
}

[data-theme="fantasy"] .tone-pill {
  border-radius: 2px;
  font-family: 'Crimson Pro', serif;
}

[data-theme="fantasy"] .modal {
  border-radius: 2px;
  border: 1px solid rgba(155,35,53,.25);
}

[data-theme="fantasy"] .modal h2 {
  font-family: 'Cinzel', serif;
  letter-spacing: .04em;
}

[data-theme="fantasy"] .detail-meta h3 {
  font-family: 'Cinzel', serif;
}

[data-theme="fantasy"] .stat-section-title {
  font-family: 'Cinzel', serif;
  letter-spacing: .06em;
}

[data-theme="fantasy"] .section-label {
  font-family: 'Cinzel', serif;
  font-size: .65rem;
  letter-spacing: .06em;
}

[data-theme="fantasy"] .stat-card {
  border: 1px solid rgba(155,35,53,.18);
}

[data-theme="fantasy"] .stat-bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

[data-theme="fantasy"] .shelf-ovw-pill {
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   HISTORICAL
   Inspired by: Eagles of the Empire · Essex Dogs · SPQR
   Plantagenet England · Ancient Rome
   ═══════════════════════════════════════════════════════════════ */
[data-theme="historical"] {
  --bg:          #0d0a07;
  --surface:     #1a1610;
  --surface2:    #261e14;
  --accent:      #8c1c1c;   /* SPQR legion red                        */
  --accent2:     #c4a03a;   /* Roman aurum / Plantagenet gold          */
  --accent3:     #4a7c64;   /* verdigris — oxidised bronze eagle       */
  --text:        #f2e8d5;   /* aged vellum / torchlight                */
  --muted:       #96876a;   /* faded manuscript ink                    */
  --radius:      2px;
  --shadow:      0 6px 28px rgba(0,0,0,.7);
  --font-display: 'Cinzel Decorative', serif;
  --font-body:    'EB Garamond', serif;
  --accent-rgb:  140, 28, 28;
  --accent3-rgb: 74, 124, 100;
}

/* Subtle manuscript ruling lines */
[data-theme="historical"] body {
  background-image: repeating-linear-gradient(
    transparent,
    transparent 59px,
    rgba(139,26,26,.04) 59px,
    rgba(139,26,26,.04) 60px
  );
}

[data-theme="historical"] header {
  background: rgba(24,20,14,.97);
  border-bottom: 3px double rgba(139,26,26,.35);
}

[data-theme="historical"] h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.15rem;
  letter-spacing: .06em;
  font-weight: 700;
}

[data-theme="historical"] .tab {
  font-family: 'Cinzel Decorative', serif;
  font-size: .68rem;
  letter-spacing: .04em;
}

[data-theme="historical"] .tab.active {
  border-bottom: 2px solid var(--accent2);
  color: var(--accent2);
}

[data-theme="historical"] .book-card {
  border: 1px solid rgba(139,26,26,.18);
  border-radius: 2px;
}

[data-theme="historical"] .book-card:hover {
  border-color: rgba(196,160,58,.4);
  box-shadow: 0 4px 24px rgba(0,0,0,.7);
}

[data-theme="historical"] .book-title {
  font-family: 'EB Garamond', serif;
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.35;
}

[data-theme="historical"] .book-author {
  font-style: italic;
  font-size: .8rem;
}

[data-theme="historical"] .btn-add {
  font-family: 'Cinzel Decorative', serif;
  font-size: .7rem;
  letter-spacing: .05em;
  border-radius: 999px;
}

[data-theme="historical"] .btn-search {
  border-radius: 2px;
  font-family: 'EB Garamond', serif;
}

[data-theme="historical"] .genre-pill {
  border-radius: 0;
  font-family: 'EB Garamond', serif;
  font-size: .82rem;
  font-style: italic;
  padding: 2px 8px;
}

[data-theme="historical"] .tone-pill {
  border-radius: 0;
  font-family: 'EB Garamond', serif;
  font-style: italic;
}

[data-theme="historical"] .modal {
  border-radius: 0;
  border: 1px solid rgba(139,26,26,.3);
  border-top: 3px solid var(--accent);
}

[data-theme="historical"] .modal h2 {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.1rem;
  letter-spacing: .04em;
}

[data-theme="historical"] .detail-meta h3 {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1rem;
}

[data-theme="historical"] .section-label {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-size: .88rem;
  opacity: .85;
}

[data-theme="historical"] .stat-section-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: .75rem;
}

[data-theme="historical"] .stat-card {
  border: 1px solid rgba(139,26,26,.2);
  border-top: 2px solid rgba(196,160,58,.3);
}

[data-theme="historical"] .stat-bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

[data-theme="historical"] .shelf-ovw-pill {
  border-radius: 0;
  border-color: rgba(139,26,26,.3);
}

/* ═══════════════════════════════════════════════════════════════
   THEME DOCK — floating switcher (bottom-right)
   ═══════════════════════════════════════════════════════════════ */
.theme-dock {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: calc(var(--radius) + 6px);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow);
  transition: background .3s, border-color .3s;
}

.theme-dock-label {
  font-size: .58rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid var(--surface2);
  font-family: var(--font-display);
  white-space: nowrap;
}

.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 11px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.theme-btn-icon { font-size: .95rem; line-height: 1; }

.theme-btn-name {
  font-size: .58rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .2s;
}

/* Colour swatch dots */
.theme-swatch {
  display: flex;
  gap: 2px;
  margin: 1px 0;
}
.theme-swatch span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.theme-btn:hover {
  background: var(--surface2);
}
.theme-btn:hover .theme-btn-name { color: var(--text); }

.theme-btn.active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb, 193,18,31), .12);
}
.theme-btn.active .theme-btn-name { color: var(--accent); }

@media (max-width: 600px) {
  .theme-dock { bottom: 16px; right: 16px; padding: 8px 10px; }
  .theme-dock-label { display: none; }
  .theme-btn { padding: 6px 8px; }
}

/* On mobile the bottom nav bar appears, so float the theme dock above it */
@media (max-width: 820px) {
  .theme-dock {
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════════════════════════════
   HEADER CANVAS — themed decorative art layer
   ═══════════════════════════════════════════════════════════════ */
header { overflow: clip; position: relative; }

.header-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  /* Visible at both edges, transparent in centre so h1/buttons stay legible */
  -webkit-mask-image: linear-gradient(to right,
    black 0%, rgba(0,0,0,.85) 10%,
    transparent 25%, transparent 75%,
    rgba(0,0,0,.85) 90%, black 100%);
  mask-image: linear-gradient(to right,
    black 0%, rgba(0,0,0,.85) 10%,
    transparent 25%, transparent 75%,
    rgba(0,0,0,.85) 90%, black 100%);
}

.theme-art {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
}

[data-theme="scifi"]      .art-scifi      { display: block; }
[data-theme="fantasy"]    .art-fantasy    { display: block; }
[data-theme="historical"] .art-historical { display: block; }

.header-inner,
.setup-banner,
.shelf-tabs { position: relative; z-index: 1; }

@media (max-width: 600px) {
  .header-canvas {
    -webkit-mask-image: linear-gradient(to right,
      black 0%, transparent 22%, transparent 58%, black 100%);
    mask-image: linear-gradient(to right,
      black 0%, transparent 22%, transparent 58%, black 100%);
    opacity: .75;
  }
}
