/*
 * Light is the original zelBooks palette, unchanged.
 * Dark is a warm "library after sunset" counterpart — never inverted, never
 * pure black: the same paper/brass/wine personality with the lights turned
 * down. Every color below is a semantic slot so components never hardcode a
 * literal and both themes stay in sync.
 */
:root {
  /* --- text & paper --- */
  --ink: #2B2620;          /* body text */
  --ink-deep: #14181F;     /* text sitting ON gold */
  --ivory: #141412;        /* headings / primary text */
  --dim: #161512;          /* secondary text */
  --dim-soft: #cf9d27;     /* small caps labels, counts */
  --panel: #F2ECD9;        /* cards */
  --panel-raised: #E7DDC1; /* raised surface */

  /* --- accents --- */
  --brass: #cf9d27;
  --brass-bright: #cf9d27;
  --stamp: #7A2E3D;
  --wood-hi: #9C7A2E;
  --wood-lo: #7a570a;

  --gold-rgb: 207, 157, 39;  /* for gold tints that need an alpha channel */
  --radius: 4px;
  --border: rgba(43, 38, 32, 0.12);

  /* --- surfaces --- */
  --bg: #E8E1CC;
  --nav-bg: rgba(232, 225, 204, 0.88);
  --nav-border: rgba(43, 38, 32, 0.1);
  --alpha-nav-bg: rgba(232, 225, 204, 0.92);
  --chip-bg: var(--panel);
  --chip-hover: var(--panel-raised);
  --scrim: rgba(20, 24, 31, 0.7);
  --overlay: rgba(10, 12, 16, 0.7);
  --overlay-soft: rgba(10, 12, 16, 0.55);
  --overlay-blur: none;

  /* --- search pill --- */
  --search-bg: var(--panel);
  --search-border: rgba(207, 157, 39, 0.28);
  --search-blur: none;
  --search-halo: none;     /* warm light pooling behind the pill (dark only) */
  --placeholder: var(--dim-soft);

  /* --- elevation --- */
  --shadow-soft: 0 1px 2px rgba(43, 38, 32, 0.05), 0 6px 20px rgba(43, 38, 32, 0.08);
  --shadow-soft-hover: 0 1px 2px rgba(43, 38, 32, 0.06), 0 8px 24px rgba(43, 38, 32, 0.1);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.16);
  --shadow-modal: 0 24px 70px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 16px 44px rgba(0, 0, 0, 0.4);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.3);
  --focus-glow: 0 10px 28px rgba(207, 157, 39, 0.16), 0 0 0 4px rgba(207, 157, 39, 0.14);
  --chip-glow: none;

  /* --- books: real spines, so the lighting is part of the identity --- */
  --spine-shadow: inset -6px 0 10px rgba(0, 0, 0, 0.22), inset 2px 0 0 rgba(255, 255, 255, 0.08), 2px 3px 6px rgba(0, 0, 0, 0.35);
  --spine-shadow-hover: inset -6px 0 10px rgba(0, 0, 0, 0.22), inset 2px 0 0 rgba(255, 255, 255, 0.08), 4px 14px 22px rgba(0, 0, 0, 0.55);
  --shelf-shadow: 0 8px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --group-shelf-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);

  /* --- hero --- */
  --hero-glow: none;
  --hero-art-saturate: 1;
  --hero-art-shadow: drop-shadow(0 14px 24px rgba(43, 38, 32, 0.16));
  --sparkle-opacity: 0;    /* light theme keeps the hero exactly as designed */
}

[data-theme="dark"] {
  --ink: #D3C7B5;
  --ink-deep: #1A1613;
  --ivory: #F4EFE7;
  --dim: #D3C7B5;
  --dim-soft: #9D917F;
  --panel: #211d19;
  --panel-raised: #2b2622;

  --brass: #D4A64C;
  --brass-bright: #E4B55E;
  /* wine lifted into a rose so it still reads against dark paper */
  --stamp: #C08292;
  --wood-hi: #8A6B2C;
  --wood-lo: #5E4308;

  --gold-rgb: 212, 166, 76;
  --border: rgba(255, 255, 255, 0.08);

  --bg: #161412;
  --nav-bg: rgba(22, 20, 18, 0.82);
  --nav-border: rgba(255, 255, 255, 0.07);
  --alpha-nav-bg: rgba(22, 20, 18, 0.92);
  --chip-bg: #2A2622;
  --chip-hover: #3A332C;
  --scrim: rgba(0, 0, 0, 0.45);
  --overlay: rgba(18, 15, 13, 0.72);
  --overlay-soft: rgba(18, 15, 13, 0.62);
  --overlay-blur: blur(6px);

  /* floating glass, lit from within rather than outlined */
  --search-bg: rgba(43, 38, 34, 0.55);
  --search-border: rgba(212, 166, 76, 0.22);
  --search-blur: blur(12px) saturate(1.1);
  --search-halo: radial-gradient(60% 140% at 50% 50%, rgba(212, 166, 76, 0.13), transparent 70%);
  --placeholder: #A99C88;

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.34);
  --shadow-soft-hover: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 30px rgba(0, 0, 0, 0.42);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 28px 80px rgba(0, 0, 0, 0.62);
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.5);
  --shadow-sheet: 0 -10px 38px rgba(0, 0, 0, 0.5);
  --focus-glow: 0 12px 34px rgba(212, 166, 76, 0.2), 0 0 0 4px rgba(212, 166, 76, 0.17);
  --chip-glow: 0 0 0 3px rgba(212, 166, 76, 0.14), 0 4px 14px rgba(212, 166, 76, 0.1);

  /* deeper falloff + a warmer top highlight = candlelit shelf, not flat cards */
  --spine-shadow: inset -7px 0 12px rgba(0, 0, 0, 0.42), inset 2px 0 0 rgba(255, 236, 200, 0.14), 2px 4px 10px rgba(0, 0, 0, 0.55);
  --spine-shadow-hover: inset -7px 0 12px rgba(0, 0, 0, 0.42), inset 2px 0 0 rgba(255, 236, 200, 0.18), 6px 18px 32px rgba(0, 0, 0, 0.66);
  --shelf-shadow: 0 10px 22px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 236, 200, 0.14);
  --group-shelf-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);

  --hero-glow: radial-gradient(120% 150% at 22% 0%, rgba(212, 166, 76, 0.1), transparent 62%),
               radial-gradient(90% 120% at 78% 40%, rgba(192, 130, 146, 0.06), transparent 66%);
  --hero-art-saturate: 1.16;
  --hero-art-shadow: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.5));
  --sparkle-opacity: 1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(176,141,87,0.06), transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(63,84,67,0.05), transparent 45%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.amharic { font-family: 'Noto Serif Ethiopic', serif; }
.mono { font-family: 'IBM Plex Mono', monospace; }

h1, h2, h3, .display {
  font-family: 'Libre Caslon Display', serif;
  font-weight: 400;
  letter-spacing: -0.005em;
  margin: 0;
}

a { color: inherit; }
button { font-family: inherit; }

::selection { background: var(--brass); color: var(--ink-deep); }

::-webkit-scrollbar { height: 6px; width: 6px; }
::-webkit-scrollbar-thumb { background: var(--panel-raised); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/*
 * Theme cross-fade. Applied only while the toggle is switching, so the whole
 * page eases over together instead of components snapping at different rates
 * (their own hover transitions differ from 150ms to 250ms). Transitions never
 * run on first paint, so the initial theme still lands with no flash.
 */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: background-color 250ms ease-in-out,
              background-image 250ms ease-in-out,
              color 250ms ease-in-out,
              border-color 250ms ease-in-out,
              box-shadow 250ms ease-in-out,
              fill 250ms ease-in-out,
              opacity 250ms ease-in-out !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
