/* Storytel Books — Design System
 * Color palette extracted from storytel.com
 */

:root {
  --orange: #ff501c;
  --orange-dark: #d63d0e;
  --orange-soft: #ffefe8;
  --ink: #101010;
  --ink-soft: #2A2A2A;
  --muted: #6B6B68;
  --bg: #fffbfa;
  --surface: #FAF8F4;
  --surface-2: #F4F1EA;
  --border: #E8E5DE;
  --border-strong: #D4D0C7;
  --discount-bg: #FFE7DB;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(16,16,16,.04);
  --shadow: 0 4px 16px rgba(16,16,16,.06);
  --shadow-lg: 0 12px 40px rgba(16,16,16,.08);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: 'Fraunces', 'Playfair Display', Georgia, serif;

  --max-w: 1320px;
  --gutter: clamp(20px, 4vw, 48px);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

/* Form fields: 16px baseline prevents iOS Safari from auto-zooming on focus.
   Components can override but should not drop below 16px on mobile. */
input, textarea, select { font-size: 16px; font-family: inherit; }
input::placeholder, textarea::placeholder { font-size: 14px; }

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--orange); }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }

h1 { font-size: clamp(36px, 5vw, 64px); }
h2 { font-size: clamp(26px, 3vw, 40px); }
h3 { font-size: clamp(20px, 2vw, 26px); }

p { margin: 0; }

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }

.section { padding: clamp(28px, 3vw, 44px) 0; }
.section:first-of-type { padding-top: clamp(20px, 2.5vw, 36px); }
.section.section-tight { padding: clamp(20px, 2vw, 32px) 0; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}
.section-head h2 { font-size: clamp(22px, 2.5vw, 32px); }
.section-head .section-link { font-size: 14px; color: var(--muted); }
.section-head .section-link:hover { color: var(--orange); }
.section-eyebrow { display: inline-block; font-size: 12px; font-family: var(--font-sans); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); margin-bottom: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,251,250,.92);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: 32px;
  height: 72px;
  max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 26px; }
.nav { display: flex; gap: 28px; flex: 1; }
.nav a { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.nav a.active, .nav a:hover { color: var(--orange); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Hamburger button — hidden on desktop */
.menu-toggle { display: none; }

/* Mobile drawer — always hidden until .open, regardless of screen size */
.mobile-drawer {
  position: fixed; inset: 0;
  background: rgba(16,16,16,0.5);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: none;
}
.mobile-drawer.open { display: block; }
.mobile-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 86%; max-width: 360px;
  background: #fff;
  padding: 24px 20px;
  overflow-y: auto;
  animation: drawerIn .25s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.mobile-drawer-panel .close-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.mobile-drawer-panel .close-row button {
  width: 36px; height: 36px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  cursor: pointer;
}
.mobile-drawer-panel .close-row button:hover { background: var(--surface-2); color: var(--orange); }
.mobile-drawer-panel ul { list-style: none; padding: 0; margin: 0; }
.mobile-drawer-panel ul li a, .mobile-drawer-panel ul li button {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 4px;
  font-size: 16px; font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  border-top: 0; border-left: 0; border-right: 0;
  width: 100%; text-align: left;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.mobile-drawer-panel ul li a:hover, .mobile-drawer-panel ul li button:hover { color: var(--orange); }
.mobile-drawer-panel .drawer-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
  padding: 20px 4px 6px;
}
.mobile-drawer-panel .lang-switch {
  display: flex; gap: 4px;
  margin-top: 20px;
  padding: 4px; background: var(--surface);
  border-radius: 999px;
}
.mobile-drawer-panel .lang-switch button {
  flex: 1; padding: 8px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  border: 0;
  background: none;
  cursor: pointer;
}
.mobile-drawer-panel .lang-switch button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

@media (max-width: 900px) {
  .topbar-inner { gap: 12px; height: 60px; }
  .nav { display: none; }
  .menu-toggle {
    display: inline-flex;
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    border-radius: 999px;
    color: var(--ink);
    margin-right: -4px;
  }
  .menu-toggle:hover { background: var(--surface); }
  .topbar-actions > .lang-switch { display: none; }
}
.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  color: var(--ink);
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn .badge {
  position: absolute; transform: translate(12px,-12px);
  background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-sans);
}
.icon-btn-wrap { position: relative; }

/* Lang switch */
.lang-switch { display: flex; gap: 4px; border: 1px solid var(--border); border-radius: 999px; padding: 3px; margin-left: 8px; }
.lang-switch button { padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 999px; }
.lang-switch button.active { background: var(--ink); color: #fff; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: transform .08s ease, background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); color: #fff; }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-secondary:hover { background: var(--ink-soft); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-large { padding: 16px 28px; font-size: 16px; }

/* Utils */
.text-muted { color: var(--muted); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.spacer { flex: 1; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
