/* ==========================================================================
   Nocturne Books — style.css
   Theme: "Midnight Library" (dark) + "Paper" (light)
   Plain CSS, mobile-first, CSS Grid + Flexbox. No frameworks.
   ========================================================================== */

/* ---------- Design tokens -------------------------------------------------- */
:root {
  /* Midnight (dark) theme — the default */
  --bg:            #0B1020;
  --bg-2:          #11182f;
  --surface:       rgba(255, 255, 255, 0.05);
  --surface-solid: #151c33;
  --border:        rgba(245, 184, 65, 0.18);
  --text:          #F7F3E9;
  --text-muted:    #b9b6ab;
  --accent:        #F5B841;  /* gold  */
  --accent-2:      #FF6B6B;  /* coral */
  --accent-ink:    #0B1020;  /* text on top of accent */
  --star:          #F5B841;
  --shadow:        0 20px 50px rgba(0, 0, 0, 0.45);
  --glow:          0 0 50px rgba(245, 184, 65, 0.25);

  /* Fonts */
  --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  /* Layout */
  --maxw: 1280px;
  --gutter: 16px;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 66px;

  color-scheme: dark;
}

/* Paper (light) theme */
:root[data-theme="light"] {
  --bg:            #FBF7EF;
  --bg-2:          #f3ecdd;
  --surface:       rgba(11, 16, 32, 0.04);
  --surface-solid: #ffffff;
  --border:        rgba(11, 16, 32, 0.12);
  --text:          #1b2233;
  --text-muted:    #5c6170;
  --accent:        #b6811a;  /* darker gold for AA contrast on cream */
  --accent-2:      #d7453f;  /* darker coral for AA contrast */
  --accent-ink:    #ffffff;
  --star:          #c8921c;
  --shadow:        0 16px 40px rgba(27, 34, 51, 0.12);
  --glow:          0 0 40px rgba(182, 129, 26, 0.18);

  color-scheme: light;
}

/* Follow the OS preference when the user hasn't chosen (no data-theme set). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:            #FBF7EF;
    --bg-2:          #f3ecdd;
    --surface:       rgba(11, 16, 32, 0.04);
    --surface-solid: #ffffff;
    --border:        rgba(11, 16, 32, 0.12);
    --text:          #1b2233;
    --text-muted:    #5c6170;
    --accent:        #b6811a;
    --accent-2:      #d7453f;
    --accent-ink:    #ffffff;
    --star:          #c8921c;
    --shadow:        0 16px 40px rgba(27, 34, 51, 0.12);
    --glow:          0 0 40px rgba(182, 129, 26, 0.18);
    color-scheme: light;
  }
}

/* ---------- Reset / base --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Subtle starfield / gradient backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(245, 184, 65, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(255, 107, 107, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

main { flex: 1 0 auto; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 700;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section { padding: clamp(2.5rem, 6vw, 5rem) 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.section-head h2 { font-size: clamp(1.5rem, 4vw, 2.3rem); margin: 0; }
.section-head p { color: var(--text-muted); margin: 0.25rem 0 0; }

.gradient-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
}

.muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------- Buttons -------------------------------------------------------- */
.btn {
  --_bg: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--_bg);
  color: var(--accent-ink);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.btn:active { transform: translateY(0); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn--coral { --_bg: var(--accent-2); }
.btn--block { width: 100%; }
.btn--sm { min-height: 38px; padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* Visible focus for keyboard users everywhere */
:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Header / navbar ------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--nav-h);
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  white-space: nowrap;
}
.nav__brand img { width: 34px; height: 34px; }
.nav__links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  margin-left: 0.5rem;
}
.nav__links a {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.nav__links a:hover { color: var(--text); background: var(--surface); }
.nav__links a[aria-current="page"] { color: var(--accent); }

.nav__search {
  margin-left: auto;
  position: relative;
  flex: 0 1 280px;
  display: flex;
}
.nav__search input {
  width: 100%;
  min-height: 42px;
  padding: 0.4rem 0.9rem 0.4rem 2.3rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.nav__search input::placeholder { color: var(--text-muted); }
.nav__search svg {
  position: absolute;
  left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.nav__actions { display: flex; align-items: center; gap: 0.25rem; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--surface); transform: translateY(-1px); }
.badge {
  position: absolute;
  top: 4px; right: 2px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}
.badge[hidden] { display: none; }

.nav__toggle { display: none; }

/* ---------- Currency selector (header + drawer) ---------------------------- */
.currency-select {
  min-height: 36px;
  padding: 0.35rem 1.9rem 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 0.2s, border-color 0.2s;
}
.currency-select:hover { border-color: var(--accent); }
.currency-select option { background: var(--surface-solid); color: var(--text); }
.nav__currency { margin-right: 0.25rem; }
.drawer__currency {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.drawer__currency .currency-select { min-height: 44px; }

/* ---------- Mobile drawer -------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s;
  z-index: 60;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100dvh;
  width: min(82vw, 320px);
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 70;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}
.drawer.open { transform: translateX(0); }
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.drawer nav a {
  display: block;
  padding: 0.85rem 0.5rem;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.drawer nav a[aria-current="page"] { color: var(--accent); }

/* ---------- Hero ----------------------------------------------------------- */
.hero { position: relative; padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3rem, 7vw, 6rem); }
.hero__grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}
.hero__title {
  font-size: clamp(2.2rem, 7vw, 4rem);
  margin: 0.5rem 0 1rem;
}
.hero__lead { font-size: 1.1rem; color: var(--text-muted); max-width: 48ch; }
.hero__cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

.hero__search {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  max-width: 460px;
}
.hero__search input {
  flex: 1;
  min-height: 48px;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* Fanned stack of covers */
.hero__fan {
  position: relative;
  height: clamp(280px, 42vw, 440px);
  perspective: 1200px;
}
.hero__fan .fan-card {
  position: absolute;
  top: 50%; left: 50%;
  width: clamp(120px, 22vw, 200px);
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transform-origin: bottom center;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.hero__fan .fan-card img { width: 100%; height: 100%; object-fit: cover; }
.hero__fan .fan-card:nth-child(1) { transform: translate(-50%, -50%) rotate(-24deg) translateX(-150px); z-index: 1; }
.hero__fan .fan-card:nth-child(2) { transform: translate(-50%, -50%) rotate(-12deg) translateX(-75px); z-index: 2; }
.hero__fan .fan-card:nth-child(3) { transform: translate(-50%, -52%) rotate(0deg); z-index: 3; box-shadow: var(--shadow), var(--glow); }
.hero__fan .fan-card:nth-child(4) { transform: translate(-50%, -50%) rotate(12deg) translateX(75px); z-index: 2; }
.hero__fan .fan-card:nth-child(5) { transform: translate(-50%, -50%) rotate(24deg) translateX(150px); z-index: 1; }
.hero__fan:hover .fan-card:nth-child(1) { transform: translate(-50%, -50%) rotate(-28deg) translateX(-175px); }
.hero__fan:hover .fan-card:nth-child(5) { transform: translate(-50%, -50%) rotate(28deg) translateX(175px); }

/* ---------- Stats strip ---------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.stat {
  text-align: center;
  padding: 1.25rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.stat__num {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.stat__label { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.35rem; }

/* ---------- Book card ------------------------------------------------------ */
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(0.85rem, 2.5vw, 1.5rem);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: box-shadow 0.25s, border-color 0.25s;
  transform-style: preserve-3d;
  will-change: transform;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); }

.card__cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-2), var(--surface-solid));
}
.card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card:hover .card__cover { transform: scale(1.05); }

/* Light sheen sweep on hover */
.card__cover-wrap::after {
  content: "";
  position: absolute;
  top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}
.card:hover .card__cover-wrap::after { left: 130%; }

/* CSS fallback cover (shown when the image is missing) */
.cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  text-align: center;
  font-family: var(--font-head);
  color: #fff;
  background: linear-gradient(145deg, #2a2140, #432a3f 55%, #1b2340);
}
.cover-fallback .cf-title { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.cover-fallback .cf-author { font-size: 0.82rem; font-style: italic; opacity: 0.85; }
.cover-fallback::before {
  content: "❧";
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.sale-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--accent-2);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  z-index: 3;
}

.wish-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.45);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 3;
  transition: transform 0.15s, background 0.2s;
}
.wish-btn:hover { transform: scale(1.1); }
.wish-btn.active { color: var(--accent-2); }
.wish-btn.active svg { fill: var(--accent-2); }

/* Add-to-cart slides up from the bottom of the cover */
.card__quickadd {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.6rem;
  transform: translateY(110%);
  transition: transform 0.28s ease;
  z-index: 3;
}
.card:hover .card__quickadd,
.card:focus-within .card__quickadd { transform: translateY(0); }

.card__body { padding: 0.85rem 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.card__genre { font-size: 0.7rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.card__title { font-size: 1.02rem; margin: 0; line-height: 1.25; }
.card__title a:hover { color: var(--accent); }
.card__author { color: var(--text-muted); font-size: 0.86rem; }

.rating { display: flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; color: var(--text-muted); }
.stars { color: var(--star); letter-spacing: 1px; }

.price-row { display: flex; align-items: baseline; gap: 0.5rem; margin-top: auto; padding-top: 0.4rem; }
.price { font-weight: 700; font-size: 1.05rem; }
.price--sale { color: var(--accent-2); }
.price--old { color: var(--text-muted); text-decoration: line-through; font-size: 0.9rem; font-weight: 500; }

/* ---------- List view (books page toggle) --------------------------------- */
.book-grid.is-list { grid-template-columns: 1fr; }
.book-grid.is-list .card { flex-direction: row; }
.book-grid.is-list .card__cover-wrap { width: 110px; flex: 0 0 110px; aspect-ratio: 2 / 3; }
.book-grid.is-list .card__quickadd { position: static; transform: none; padding: 0.5rem 0 0; }
.book-grid.is-list .card__body { padding: 0.9rem 1rem; }

/* ---------- Carousel ------------------------------------------------------- */
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 44%);
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.75rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.carousel > * { scroll-snap-align: start; }
.carousel::-webkit-scrollbar { height: 8px; }
.carousel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ---------- Genre tiles ---------------------------------------------------- */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.genre-tile {
  position: relative;
  padding: 1.5rem 1.25rem;
  min-height: 120px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(140deg, var(--surface-solid), var(--surface));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.genre-tile:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.genre-tile h3 { margin: 0; font-size: 1.15rem; }
.genre-tile span { color: var(--text-muted); font-size: 0.85rem; }
.genre-tile::before {
  content: "";
  position: absolute;
  top: -30px; right: -30px;
  width: 110px; height: 110px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  opacity: 0.25;
}

/* ---------- Panels / glass cards ------------------------------------------ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  backdrop-filter: blur(8px);
}

/* Author spotlight + quote */
.spotlight {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}
.spotlight__avatar {
  width: 92px; height: 92px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-size: 2rem; font-weight: 800;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.quote {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  line-height: 1.4;
  text-align: center;
}
.quote cite { display: block; font-size: 1rem; color: var(--accent); margin-top: 0.75rem; font-style: normal; }

/* ---------- Newsletter ----------------------------------------------------- */
.newsletter { text-align: center; }
.newsletter form {
  display: flex;
  gap: 0.5rem;
  max-width: 440px;
  margin: 1.25rem auto 0;
  flex-wrap: wrap;
}
.newsletter input[type="email"] {
  flex: 1 1 200px;
  min-height: 48px;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
}
.form-msg { margin-top: 0.75rem; font-size: 0.9rem; min-height: 1.2em; }
.form-msg.error { color: var(--accent-2); }
.form-msg.ok { color: var(--accent); }

/* ---------- Footer --------------------------------------------------------- */
.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, #000);
  padding: 2.5rem 0 1.5rem;
}
.footer__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
.footer__brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; }
.footer h4 { font-family: var(--font-body); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.footer a:hover { color: var(--accent); }
.footer__bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.attribution { max-width: 60ch; }

/* ---------- Books page layout --------------------------------------------- */
.shop-layout {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
.filters__field { margin-bottom: 1.25rem; }
.filters__field > label,
.filters legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.filters select,
.filters input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
}
.check-list { display: grid; gap: 0.5rem; max-height: 220px; overflow-y: auto; }
.check-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 32px;
}
.check-list input { width: 18px; height: 18px; accent-color: var(--accent); }

.range-wrap { display: flex; align-items: center; gap: 0.5rem; }
.range-wrap input[type="range"] { flex: 1; accent-color: var(--accent); min-height: 44px; }
.range-val { font-weight: 600; white-space: nowrap; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.toolbar .result-count { color: var(--text-muted); font-size: 0.9rem; }
.toolbar .spacer { flex: 1; }
.toolbar select {
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
}
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle button {
  width: 44px; height: 44px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: grid; place-items: center;
}
.view-toggle button.active { background: var(--accent); color: var(--accent-ink); }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .big { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* Filters as a bottom sheet on mobile */
.filters-toggle { display: none; }
.filters-backdrop { display: none; }

/* ---------- Book detail ---------------------------------------------------- */
.detail {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
.detail__cover {
  position: relative;
  max-width: 320px;
  margin: 0 auto;
  width: 100%;
}
.detail__cover .card__cover-wrap { border-radius: var(--radius); box-shadow: var(--shadow), var(--glow); }
.detail__title { font-size: clamp(1.8rem, 5vw, 2.8rem); margin-bottom: 0.25rem; }
.detail__author { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 1rem; }
.detail__meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.chip {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.detail__price { display: flex; align-items: baseline; gap: 0.6rem; margin: 1rem 0; }
.detail__price .price { font-size: 1.8rem; }
.vat-note { color: var(--text-muted); font-size: 0.82rem; }

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.qty button {
  width: 44px; height: 44px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}
.qty button:hover { background: var(--surface); }
.qty input {
  width: 48px; height: 44px;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.detail__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin: 1.25rem 0; }

/* ---------- Cart ----------------------------------------------------------- */
.cart-layout { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.cart-item__cover { width: 64px; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; }
.cart-item__cover img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__title { font-weight: 600; }
.cart-item__author { color: var(--text-muted); font-size: 0.85rem; }
.cart-item__controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.link-btn {
  background: none; border: none; color: var(--accent-2);
  cursor: pointer; font: inherit; padding: 0; text-decoration: underline;
}
.summary-row { display: flex; justify-content: space-between; padding: 0.4rem 0; }
.summary-row.total { font-size: 1.25rem; font-weight: 700; border-top: 1px solid var(--border); margin-top: 0.5rem; padding-top: 0.75rem; }

/* ---------- Modal ---------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}
.modal .big-emoji { font-size: 3rem; }

/* ---------- Toast ---------------------------------------------------------- */
.toast-stack {
  position: fixed;
  bottom: 1.25rem; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 120;
  width: min(92vw, 360px);
}
.toast {
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toast-in 0.25s ease;
}
.toast.leaving { animation: toast-out 0.25s ease forwards; }
.toast__icon { color: var(--accent); flex: 0 0 auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(14px); } }

/* ---------- Scroll reveal -------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Page hero / breadcrumbs --------------------------------------- */
.page-hero { padding: clamp(2rem, 5vw, 3.5rem) 0 1rem; }
.page-hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.breadcrumbs a:hover { color: var(--accent); }

/* ---------- 404 ------------------------------------------------------------ */
.notfound { text-align: center; padding: clamp(3rem, 10vw, 7rem) 0; }
.notfound .code {
  font-family: var(--font-head);
  font-size: clamp(5rem, 22vw, 11rem);
  font-weight: 800;
  line-height: 0.9;
}

/* ---------- Prose (about) -------------------------------------------------- */
.prose { max-width: 70ch; }
.prose p { margin: 0 0 1rem; color: var(--text-muted); }
.prose h2 { margin-top: 2rem; }
.value-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.5rem; }

/* ==========================================================================
   Responsive breakpoints
   ========================================================================== */
@media (min-width: 480px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .genre-grid { grid-template-columns: repeat(2, 1fr); }
  .carousel { grid-auto-columns: minmax(180px, 30%); }
  .value-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  :root { --gutter: 24px; }
  .nav__toggle { display: none; }
  .book-grid { grid-template-columns: repeat(3, 1fr); }
  .genre-grid { grid-template-columns: repeat(3, 1fr); }
  .carousel { grid-auto-columns: minmax(200px, 23%); }
  .hero__grid { grid-template-columns: 1.1fr 0.9fr; }
  .spotlight { grid-template-columns: auto 1fr; }
  .detail { grid-template-columns: 340px 1fr; align-items: start; }
  .shop-layout { grid-template-columns: 260px 1fr; align-items: start; }
  .cart-layout { grid-template-columns: 1fr 320px; align-items: start; }
  .footer__grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .value-grid { grid-template-columns: repeat(3, 1fr); }
  .filters { position: sticky; top: calc(var(--nav-h) + 16px); }
}

@media (min-width: 1024px) {
  .book-grid { grid-template-columns: repeat(4, 1fr); }
  .carousel { grid-auto-columns: minmax(200px, 19%); }
}

@media (min-width: 1280px) {
  .book-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- Mobile: hamburger, drawer, bottom-sheet filters --------------- */
@media (max-width: 767px) {
  .nav__links { display: none; }
  .nav__search { display: none; }
  .nav__toggle { display: inline-grid; }
  .nav__currency { display: none; } /* lives in the drawer on small screens */

  /* Filters become a slide-up bottom sheet */
  .filters-toggle { display: inline-flex; }
  .filters {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--surface-solid);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 1.25rem var(--gutter) 2rem;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 80;
    box-shadow: var(--shadow);
  }
  .filters.open { transform: translateY(0); }
  .filters-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s;
    z-index: 75;
  }
  .filters-backdrop.open { opacity: 1; visibility: visible; }
  .cart-item { grid-template-columns: 54px 1fr; }
  .cart-item__controls { grid-column: 1 / -1; }
}

/* ---------- Reduced motion ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .card { transform: none !important; }
  .hero__fan .fan-card { transition: none; }
}
