/* ==========================================================================
   OEAC Digital Library - design system
   Orange #FF6B00 · Black #050505 · White
   Dark is the default theme; [data-theme="light"] flips the surfaces.
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --orange: #FF6B00;
  --orange-bright: #FF8C33;
  --orange-dark: #CC5500;
  --orange-glow: rgba(255, 107, 0, 0.5);

  --black: #050505;
  --black-soft: #0E0E0E;
  --black-card: #141414;
  --white: #FFFFFF;
  --gray-line: rgba(255, 255, 255, 0.08);
  --txt: #FFFFFF;
  --txt-dim: rgba(255, 255, 255, 0.55);
  --txt-dimmer: rgba(255, 255, 255, 0.4);
  --surface: rgba(20, 20, 20, 0.7);
  --surface-2: rgba(255, 255, 255, 0.04);
  --page-bg: var(--black);
  --nav-bg: rgba(5, 5, 5, 0.4);
  --nav-bg-solid: rgba(5, 5, 5, 0.92);
  --shadow-card: 0 30px 55px -25px rgba(0, 0, 0, 0.9);
}

[data-theme="light"] {
  --black: #F7F7F8;
  --black-soft: #FFFFFF;
  --black-card: #FFFFFF;
  --white: #0A0A0A;
  --gray-line: rgba(10, 10, 10, 0.10);
  --txt: #0A0A0A;
  --txt-dim: rgba(10, 10, 10, 0.62);
  --txt-dimmer: rgba(10, 10, 10, 0.45);
  --surface: rgba(255, 255, 255, 0.85);
  --surface-2: rgba(10, 10, 10, 0.03);
  --page-bg: #F7F7F8;
  --nav-bg: rgba(255, 255, 255, 0.75);
  --nav-bg-solid: rgba(255, 255, 255, 0.95);
  --shadow-card: 0 24px 50px -28px rgba(0, 0, 0, 0.35);
}

html { scroll-behavior: smooth; }

body {
  background: var(--page-bg);
  color: var(--txt);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

body[dir="rtl"] { font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif; }

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

a { color: inherit; }
img { max-width: 100%; }

/* ==========================================================================
   FLEXIBILITY HELPERS
   Long, unbreakable tokens (book titles, ISBNs, source URLs, transliterated
   Persian/Pashto strings) must wrap instead of widening the page.
   ========================================================================== */
h1, h2, h3, h4, h5, h6, p, li, dd {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.breadcrumbs, .reader-bar .rt, .palette-item .t strong,
.book-info h3, .showcase-card h3, .list-item .info,
.detail-meta .m .v, .alert, .badge, .pill, code, kbd {
  overflow-wrap: anywhere;
}
table.tbl td { overflow-wrap: anywhere; }

/* Two-up form rows collapse to one column on narrow screens. */
.form-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; }

/* Contact page: form column + fixed-width aside, stacked when there is no room. */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
nav.topnav {
  position: fixed; top: 0; left: 0; right: 0;
  padding: 1.1rem 2.5rem;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
  z-index: 1000;
  transition: all .4s cubic-bezier(.2,.9,.3,1);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
}
nav.topnav.scrolled {
  padding: .75rem 2.5rem;
  background: var(--nav-bg-solid);
  border-bottom: 1px solid rgba(255,107,0,.15);
}
.logo {
  display: flex; align-items: center; gap: .7rem;
  font-weight: 900; font-size: 1.25rem; letter-spacing: -.8px;
  cursor: pointer; user-select: none; text-decoration: none; white-space: nowrap;
}
.logo-mark {
  width: 32px; height: 32px; position: relative;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-mark::before {
  content: ''; position: absolute; inset: 0;
  border: 2px solid var(--orange); border-radius: 9px;
  animation: logoSpin 9s linear infinite;
}
.logo-mark::after {
  content: ''; width: 8px; height: 8px; background: var(--orange);
  border-radius: 50%; box-shadow: 0 0 14px var(--orange);
  animation: pulse 2s ease-in-out infinite;
}
.logo .accent { color: var(--orange); }
@keyframes logoSpin { from { transform: rotate(45deg);} to { transform: rotate(405deg);} }
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: .6; }
}

.nav-links {
  display: flex; gap: .3rem; list-style: none;
  background: var(--surface); padding: .3rem; border-radius: 60px;
  border: 1px solid rgba(255,107,0,.12);
}
.nav-links a {
  text-decoration: none; color: var(--txt-dim); font-weight: 500; font-size: .85rem;
  padding: .5rem 1.1rem; border-radius: 60px; transition: all .3s; display: block;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--txt); background: rgba(255,107,0,.12); }
.nav-links a.active { color: var(--orange); background: rgba(255,107,0,.12); }

.nav-actions { display: flex; gap: .6rem; align-items: center; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid rgba(255,107,0,.25);
  color: var(--txt); cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all .3s; font-size: 1rem; flex-shrink: 0;
}
.icon-btn:hover { background: var(--orange); color: #050505; border-color: var(--orange); }

.nav-btn {
  background: transparent; border: 1px solid rgba(255,107,0,.35); color: var(--txt);
  padding: .55rem 1.25rem; border-radius: 60px; font-weight: 600; font-size: .82rem;
  cursor: pointer; transition: all .3s; font-family: inherit; text-decoration: none;
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
}
.nav-btn:hover {
  background: var(--orange); color: #050505; border-color: var(--orange);
  box-shadow: 0 0 22px var(--orange-glow); transform: translateY(-2px);
}
.nav-btn.solid { background: var(--orange); color: #050505; border-color: var(--orange); }
.nav-btn.solid:hover { background: var(--orange-bright); }

.lang-switch { display: flex; gap: 2px; background: var(--surface); border-radius: 60px; padding: 3px; }
.lang-switch a {
  font-size: .72rem; font-weight: 700; padding: .3rem .55rem; border-radius: 60px;
  text-decoration: none; color: var(--txt-dimmer); text-transform: uppercase;
}
.lang-switch a.on { background: var(--orange); color: #050505; }

.burger { display: none; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  padding: .9rem 2rem; border-radius: 60px; font-weight: 700; font-size: .92rem;
  cursor: pointer; transition: all .35s cubic-bezier(.2,.9,.3,1);
  display: inline-flex; align-items: center; gap: .55rem; border: none;
  font-family: inherit; position: relative; overflow: hidden; text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--orange); color: #050505; box-shadow: 0 12px 35px -10px var(--orange-glow); }
.btn-primary::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transition: left .6s;
}
.btn-primary:hover::before { left: 100%; }
.btn-primary:hover {
  background: var(--orange-bright); transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 50px -12px var(--orange-glow);
}
.btn-outline {
  background: var(--surface-2); border: 1.5px solid rgba(255,107,0,.45); color: var(--txt);
  backdrop-filter: blur(10px);
}
.btn-outline:hover { border-color: var(--orange); background: rgba(255,107,0,.12); transform: translateY(-4px); }
.btn-sm { padding: .5rem 1.05rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; border: 1px solid var(--gray-line); color: var(--txt-dim); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; }
.btn-danger { background: rgba(220,50,50,.15); border: 1px solid rgba(220,50,50,.4); color: #ff8080; }
.btn-danger:hover { background: #d33333; color: #fff; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(35px);} to { opacity: 1; transform: translateY(0);} }

/* ==========================================================================
   HERO + 3D BOOK
   ========================================================================== */
.hero {
  position: relative; min-height: 100vh; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; align-items: center;
  background: radial-gradient(ellipse at 70% 45%, rgba(255,107,0,.13) 0%, transparent 62%);
  padding-top: 4rem;
}
[data-theme="light"] .hero { background: radial-gradient(ellipse at 70% 45%, rgba(255,107,0,.10) 0%, transparent 62%); }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,107,0,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,0,.05) 1px, transparent 1px);
  background-size: 60px 60px; z-index: 1; pointer-events: none;
  mask-image: radial-gradient(ellipse at 70% 50%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 50%, black 20%, transparent 75%);
}
.glow-orb { position: absolute; border-radius: 50%; filter: blur(90px); z-index: 1; pointer-events: none; opacity: .55; }
.glow-orb-1 { width: 520px; height: 520px; background: rgba(255,107,0,.22); top: 4%; right: 8%; animation: orbFloat 14s ease-in-out infinite; }
.glow-orb-2 { width: 380px; height: 380px; background: rgba(255,140,51,.14); bottom: 8%; left: 4%; animation: orbFloat 18s ease-in-out infinite reverse; }
@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(40px,-50px) scale(1.15); }
}

.hero-left {
  position: relative; z-index: 10; padding: 0 2.5rem 0 4rem;
  display: flex; flex-direction: column; justify-content: center; height: 100%;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: .6rem;
  background: rgba(255,107,0,.1); border: 1px solid rgba(255,107,0,.35);
  padding: .5rem 1.2rem; border-radius: 60px; font-size: .74rem; font-weight: 600;
  color: var(--orange); margin-bottom: 1.6rem; letter-spacing: 1px; text-transform: uppercase;
  backdrop-filter: blur(10px); width: fit-content; animation: fadeUp .9s ease backwards;
}
.hero-badge .dot {
  width: 7px; height: 7px; background: var(--orange); border-radius: 50%;
  animation: pulse 2s infinite; box-shadow: 0 0 10px var(--orange);
}
.hero-title {
  font-size: clamp(2.3rem, 5vw, 4.4rem); font-weight: 900; line-height: .98;
  letter-spacing: -3px; margin-bottom: 1.5rem; animation: fadeUp .9s ease .1s backwards;
}
.hero-title .accent { color: var(--orange); text-shadow: 0 0 70px rgba(255,107,0,.55); }
.hero-title .outline {
  -webkit-text-stroke: 2px var(--txt); color: transparent; opacity: .9;
}
.hero-subtitle {
  font-size: clamp(.92rem, 1.3vw, 1.05rem); color: var(--txt-dim); max-width: 500px;
  margin-bottom: 2.2rem; line-height: 1.75; animation: fadeUp .9s ease .25s backwards;
}
.hero-actions { display: flex; gap: .9rem; flex-wrap: wrap; animation: fadeUp .9s ease .4s backwards; }
.hero-stats { display: flex; gap: 2.2rem; margin-top: 2.5rem; animation: fadeUp .9s ease .55s backwards; flex-wrap: wrap; }
.hero-stat .num { font-size: 1.5rem; font-weight: 900; color: var(--orange); letter-spacing: -1px; line-height: 1; }
.hero-stat .lbl { font-size: .68rem; color: var(--txt-dimmer); text-transform: uppercase; letter-spacing: 2px; margin-top: .3rem; }

.hero-right {
  position: relative; z-index: 10; height: 100%;
  display: flex; align-items: center; justify-content: center;
  perspective: 1800px; animation: fadeLeft 1.2s ease .3s backwards;
}
@keyframes fadeLeft { from { opacity: 0; transform: translateX(60px);} to { opacity: 1; transform: translateX(0);} }

.book-stage {
  position: relative; width: 400px; height: 550px; transform-style: preserve-3d;
  transition: transform .35s cubic-bezier(.2,.9,.3,1);
}
.book-stage::after {
  content: ''; position: absolute; bottom: -60px; left: 50%;
  transform: translateX(-50%) rotateX(85deg); width: 380px; height: 100px;
  background: radial-gradient(ellipse, rgba(255,107,0,.35) 0%, transparent 70%);
  filter: blur(22px); z-index: -1;
}
.book-3d { position: absolute; inset: 0; transform-style: preserve-3d; animation: bookFloat 7s ease-in-out infinite; }
@keyframes bookFloat {
  0%,100% { transform: translateY(0) rotateY(-12deg) rotateX(2deg); }
  50% { transform: translateY(-16px) rotateY(-12deg) rotateX(2deg); }
}
.book-back {
  position: absolute; inset: 0; background: linear-gradient(135deg, #1A1A1A 0%, #0A0A0A 100%);
  border-radius: 4px 12px 12px 4px; box-shadow: inset 0 0 40px rgba(0,0,0,.8);
  transform: translateZ(-20px); border-right: 3px solid #000;
}
.book-spine-3d {
  position: absolute; top: 0; left: 0; bottom: 0; width: 42px;
  background: linear-gradient(90deg, #8B3A00 0%, #CC5500 50%, #8B3A00 100%);
  transform: rotateY(-90deg) translateZ(21px); transform-origin: left center;
  border-radius: 4px 0 0 4px; box-shadow: inset -6px 0 20px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 1;
}
.book-spine-3d span {
  writing-mode: vertical-rl; transform: rotate(180deg); font-size: .7rem; font-weight: 800;
  letter-spacing: 5px; color: rgba(255,255,255,.85); text-transform: uppercase;
}
.pages-stack {
  position: absolute; top: 8px; bottom: 8px; left: 42px; right: 6px;
  background: linear-gradient(90deg, #E8E0D4 0%, #F8F4EE 5%, #F8F4EE 95%, #E8E0D4 100%);
  border-radius: 0 10px 10px 0; box-shadow: inset 0 0 30px rgba(0,0,0,.2);
  transform: translateZ(-10px); overflow: hidden;
}
.pages-stack::before {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(to bottom, transparent, transparent 2px,
    rgba(0,0,0,.06) 2px, rgba(0,0,0,.06) 3px);
}
.turning-page {
  position: absolute; top: 8px; bottom: 8px; left: 42px; right: 6px;
  background: linear-gradient(135deg, #F8F4EE 0%, #EDE5D8 100%);
  border-radius: 0 10px 10px 0; transform-origin: left center;
  transform-style: preserve-3d; backface-visibility: hidden;
  box-shadow: inset 0 0 30px rgba(0,0,0,.1), 4px 0 15px rgba(0,0,0,.3);
  z-index: 5; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.turning-page::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.08) 0%, transparent 15%, transparent 85%, rgba(0,0,0,.08) 100%);
  border-radius: 0 10px 10px 0;
}
.page-number { position: absolute; bottom: 18px; right: 22px; font-size: .68rem; color: rgba(0,0,0,.28); font-weight: 600; }
.page-number.left { left: 22px; right: auto; }

.book-front {
  position: absolute; inset: 0; border-radius: 4px 14px 14px 4px; overflow: hidden;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.5,0,.2,1);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.9), 0 0 60px -10px rgba(255,107,0,.3),
              inset 0 0 60px rgba(0,0,0,.3);
  z-index: 10; backface-visibility: hidden;
}
.book-front.opened { transform: rotateY(-170deg); }
.front-design {
  position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease;
  display: flex; flex-direction: column; justify-content: space-between; padding: 2.6rem 2.1rem;
}
.front-design.active { opacity: 1; }
.front-1 { background: linear-gradient(150deg, #FF6B00 0%, #CC5500 60%, #7A3300 100%); }
.front-2 { background: linear-gradient(150deg, #1A1A1A 0%, #2E2E2E 50%, #0A0A0A 100%); }
.front-3 { background: linear-gradient(150deg, #FF8C33 0%, #FF6B00 50%, #CC5500 100%); }
.front-design::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 14px,
    rgba(255,255,255,.03) 14px, rgba(255,255,255,.03) 15px);
}
.front-design .spine-shade { position: absolute; left: 0; top: 0; bottom: 0; width: 30px; background: linear-gradient(90deg, rgba(0,0,0,.5), transparent); }
.front-design .label { font-size: .66rem; font-weight: 700; letter-spacing: 4px; text-transform: uppercase; color: rgba(255,255,255,.65); position: relative; z-index: 2; }
.front-design .icon-big { font-size: 5rem; text-align: center; filter: drop-shadow(0 15px 30px rgba(0,0,0,.5)); position: relative; z-index: 2; animation: iconBob 4s ease-in-out infinite; }
@keyframes iconBob { 0%,100% { transform: translateY(0) rotate(-3deg);} 50% { transform: translateY(-12px) rotate(3deg);} }
.front-design .title-big { font-size: 1.8rem; font-weight: 900; letter-spacing: -1px; line-height: 1.05; color: #fff; position: relative; z-index: 2; }
.front-design .title-big .accent { color: #FFE0B3; font-size: .66rem; letter-spacing: 3px; text-transform: uppercase; display: block; margin-bottom: .5rem; font-weight: 600; }
.front-2 .title-big .accent { color: var(--orange); }
.front-design .sub { font-size: .78rem; color: rgba(255,255,255,.7); position: relative; z-index: 2; margin-top: .7rem; }

.final-page {
  position: absolute; top: 8px; bottom: 8px; left: 42px; right: 6px;
  background: linear-gradient(135deg, #F8F4EE 0%, #EDE5D8 100%);
  border-radius: 0 10px 10px 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2.5rem 1.6rem;
  z-index: 4; opacity: 0; transition: opacity .4s ease;
  box-shadow: inset 0 0 40px rgba(0,0,0,.1); text-align: center;
}
.final-page.visible { opacity: 1; }
.final-page .final-logo { font-size: 3.2rem; margin-bottom: 1.2rem; animation: finalPulse 2s ease-in-out infinite; }
@keyframes finalPulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.08);} }
.final-page h2 { font-size: 1.4rem; font-weight: 900; letter-spacing: -.8px; color: #0A0A0A; line-height: 1.2; margin-bottom: .7rem; }
.final-page h2 .accent { color: var(--orange-dark); }
.final-page p { font-size: .78rem; color: #666; letter-spacing: 3px; text-transform: uppercase; font-weight: 600; }
.final-page .final-line { width: 60px; height: 3px; background: var(--orange); border-radius: 3px; margin: 1rem 0; }

.flip-counter { position: absolute; bottom: -96px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .5rem; z-index: 20; }
.flip-counter .count { font-size: .68rem; color: var(--txt-dimmer); letter-spacing: 3px; text-transform: uppercase; font-weight: 600; white-space: nowrap; }
.flip-counter .count .num { color: var(--orange); font-weight: 800; }
.flip-progress { width: 190px; height: 3px; background: var(--gray-line); border-radius: 3px; overflow: hidden; }
.flip-progress .bar { height: 100%; width: 0; background: var(--orange); border-radius: 3px; box-shadow: 0 0 12px var(--orange); transition: width .1s linear; }
.flip-status { font-size: .62rem; color: var(--orange); letter-spacing: 4px; text-transform: uppercase; font-weight: 700; opacity: .85; }

.scroll-hint {
  position: absolute; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 15;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  color: var(--txt-dimmer); font-size: .62rem; letter-spacing: 4px; text-transform: uppercase;
  animation: fadeUp .9s ease 1s backwards;
}
.scroll-hint .line { width: 1px; height: 40px; background: linear-gradient(to bottom, var(--orange), transparent); animation: scrollLine 2s ease-in-out infinite; }
@keyframes scrollLine {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ==========================================================================
   LAYOUT BLOCKS
   ========================================================================== */
.wrap { max-width: 1600px; margin: 0 auto; padding: 0 2.5rem; }
/* padding-block only — a `padding` shorthand here would also zero the
   horizontal padding inherited from .wrap on `class="section wrap"` elements,
   which pushed every page's content flush against the left edge. */
.section { padding-block: 3.5rem 4rem; }
.section + .section { border-top: 1px solid var(--gray-line); }

.stats-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem;
  padding: 2.2rem 2.5rem;
  background: linear-gradient(180deg, rgba(255,107,0,.05) 0%, transparent 100%);
  border-bottom: 1px solid var(--gray-line);
}
.stat-item { text-align: center; padding: 1rem; transition: transform .3s; }
.stat-item:hover { transform: translateY(-5px); }
.stat-item .num { font-size: 2rem; font-weight: 900; color: var(--orange); letter-spacing: -1.5px; line-height: 1; margin-bottom: .35rem; }
.stat-item .label { font-size: .68rem; color: var(--txt-dimmer); text-transform: uppercase; letter-spacing: 2.5px; }

.section-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 2.2rem; flex-wrap: wrap; gap: 1.2rem;
}
.section-title h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); font-weight: 900; letter-spacing: -1.5px; line-height: 1.1; margin-bottom: .35rem; }
.section-title h2 .accent { color: var(--orange); }
.section-title p { color: var(--txt-dimmer); font-size: .92rem; }

.view-switcher { display: flex; background: var(--surface); border: 1px solid rgba(255,107,0,.18); border-radius: 60px; padding: .3rem; backdrop-filter: blur(10px); }
.view-btn {
  background: transparent; border: none; color: var(--txt-dim); padding: .6rem 1.3rem;
  border-radius: 60px; font-weight: 600; font-size: .82rem; cursor: pointer;
  transition: all .3s; display: flex; align-items: center; gap: .45rem;
  white-space: nowrap; font-family: inherit;
}
.view-btn svg { width: 14px; height: 14px; fill: currentColor; }
.view-btn.active { background: var(--orange); color: #050505; box-shadow: 0 0 20px var(--orange-glow); }
.view-btn:not(.active):hover { color: var(--txt); background: rgba(255,107,0,.1); }

.view-container { display: none; }
.view-container.active { display: block; animation: viewFade .45s ease; }
@keyframes viewFade { from { opacity: 0; transform: translateY(15px);} to { opacity: 1; transform: translateY(0);} }

/* ==========================================================================
   BOOK CARDS
   ========================================================================== */
.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.4rem; }

.book-card {
  background: linear-gradient(155deg, var(--black-card) 0%, var(--black-soft) 100%);
  border: 1px solid rgba(255,107,0,.12); border-radius: 20px; padding: 1.4rem;
  position: relative; overflow: hidden;
  transition: all .45s cubic-bezier(.2,.9,.3,1); cursor: pointer;
  display: flex; flex-direction: column;
}
.book-card::after {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .45s;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(255,107,0,.16) 0%, transparent 55%);
  pointer-events: none;
}
.book-card:hover {
  border-color: rgba(255,107,0,.5); transform: translateY(-8px);
  box-shadow: var(--shadow-card), 0 0 40px rgba(255,107,0,.08);
}
.book-card:hover::after { opacity: 1; }

.book-cover-card {
  width: 100%; height: 210px; border-radius: 13px; margin-bottom: 1.1rem;
  position: relative; overflow: hidden; display: flex; align-items: center;
  justify-content: center; transition: transform .5s cubic-bezier(.2,.9,.3,1);
  background-size: cover; background-position: center;
}
.book-card:hover .book-cover-card { transform: scale(1.03); }
.book-cover-card img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.book-cover-card .icon { font-size: 3.2rem; filter: drop-shadow(0 8px 16px rgba(0,0,0,.5)); transition: transform .5s; position: relative; z-index: 2; }
.book-card:hover .book-cover-card .icon { transform: scale(1.15) rotate(-6deg); }
.book-cover-card .tag {
  position: absolute; top: .7rem; inset-inline-end: .7rem; background: rgba(0,0,0,.78);
  backdrop-filter: blur(8px); padding: .22rem .65rem; border-radius: 60px;
  font-size: .62rem; font-weight: 700; color: var(--orange); letter-spacing: 1px;
  text-transform: uppercase; z-index: 3;
}
.book-cover-card .tag.paid { color: #FFD166; }

/* generated cover when no artwork exists */
.cover-gen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: rgba(255,255,255,.92); text-align: center; padding: 1rem;
  font-size: 1.05rem; letter-spacing: -.5px; line-height: 1.3;
  background: linear-gradient(135deg, #FF6B00 0%, #8B3A00 100%);
  background-size: 200% 200%; animation: genShift 8s ease-in-out infinite;
}
@keyframes genShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.cover-gen.g2 { background: linear-gradient(135deg, #1A1A1A 0%, #3A3A3A 100%); }
.cover-gen.g3 { background: linear-gradient(135deg, #FF8C33 0%, #CC5500 100%); }
.cover-gen.g4 { background: linear-gradient(135deg, #CC5500 0%, #5A2500 100%); }
.cover-gen.g5 { background: linear-gradient(135deg, #2E2E2E 0%, #0A0A0A 100%); }

.book-info h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: .25rem; letter-spacing: -.3px; line-height: 1.35; }
.book-info h3 a { text-decoration: none; }
.book-info h3 a:hover { color: var(--orange); }
.book-info .author { font-size: .8rem; color: var(--txt-dimmer); margin-bottom: .9rem; }
.book-footer { display: flex; justify-content: space-between; align-items: center; padding-top: .8rem; border-top: 1px solid var(--gray-line); margin-top: auto; }
.book-meta { display: flex; gap: .8rem; font-size: .74rem; color: var(--txt-dimmer); align-items: center; flex-wrap: wrap; }
.book-meta .rating { color: var(--orange); font-weight: 700; }
.pill { font-size: .65rem; padding: .15rem .5rem; border-radius: 30px; background: var(--surface-2); border: 1px solid var(--gray-line); color: var(--txt-dim); }
.pill.lang { text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }

.card-actions { display: flex; gap: .4rem; align-items: center; }
.dl-btn, .fav-btn {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,107,0,.1);
  border: 1px solid rgba(255,107,0,.3); display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all .3s; color: var(--orange);
  flex-shrink: 0; font-size: .95rem; text-decoration: none;
}
.dl-btn:hover, .fav-btn:hover { background: var(--orange); color: #050505; transform: scale(1.12) rotate(12deg); box-shadow: 0 0 22px var(--orange-glow); }
.dl-btn svg { width: 16px; height: 16px; fill: currentColor; }
.fav-btn.on { background: var(--orange); color: #050505; }

/* ==========================================================================
   LIST VIEW
   ========================================================================== */
.list-view { display: flex; flex-direction: column; gap: .6rem; }
.list-item {
  display: grid; grid-template-columns: 52px 1fr 90px 90px 120px; align-items: center;
  gap: 1.2rem; padding: 1rem 1.2rem; background: var(--surface);
  border: 1px solid rgba(255,107,0,.1); border-radius: 14px; transition: all .35s; cursor: pointer;
}
/* .info is the truncating column: without min-width:0 the 1fr track refuses to
   shrink below its content and a long unbroken title pushes the whole row out. */
.list-item .info { min-width: 0; overflow-wrap: anywhere; }
.list-item:hover { background: rgba(255,107,0,.05); border-color: rgba(255,107,0,.35); transform: translateX(8px); }
body[dir="rtl"] .list-item:hover { transform: translateX(-8px); }
.list-thumb {
  width: 52px; height: 52px; border-radius: 11px; display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem; flex-shrink: 0; overflow: hidden;
  background-size: cover; background-position: center;
}
.list-item .info h4 { font-size: .95rem; font-weight: 600; margin-bottom: .12rem; }
.list-item .info span { font-size: .76rem; color: var(--txt-dimmer); }
.list-item .stat { font-size: .74rem; color: var(--txt-dim); text-align: center; }
.list-item .stat strong { display: block; color: var(--orange); font-size: .92rem; font-weight: 700; }
.list-item .download {
  background: rgba(255,107,0,.1); border: 1px solid rgba(255,107,0,.3); color: var(--orange);
  padding: .45rem .85rem; border-radius: 60px; font-size: .74rem; font-weight: 700;
  cursor: pointer; transition: all .3s; display: flex; align-items: center;
  gap: .3rem; justify-content: center; font-family: inherit; text-decoration: none;
}
.list-item .download:hover { background: var(--orange); color: #050505; box-shadow: 0 0 18px var(--orange-glow); transform: scale(1.05); }
.list-item .download svg { width: 12px; height: 12px; fill: currentColor; }

/* ==========================================================================
   SHOWCASE VIEW
   ========================================================================== */
.showcase-view { display: flex; gap: 1.4rem; overflow-x: auto; padding: .4rem 0 1.6rem; scroll-snap-type: x mandatory; scrollbar-width: none; min-width: 0; -webkit-overflow-scrolling: touch; }
.showcase-view::-webkit-scrollbar { display: none; }
.showcase-card {
  flex: 0 0 min(340px, 78vw); scroll-snap-align: start;
  background: linear-gradient(155deg, var(--black-card), var(--black-soft));
  border: 1px solid rgba(255,107,0,.12); border-radius: 22px; padding: 1.6rem;
  transition: all .45s cubic-bezier(.2,.9,.3,1); cursor: pointer; position: relative; overflow: hidden;
}
.showcase-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  opacity: 0; transition: opacity .4s;
}
.showcase-card:hover { border-color: rgba(255,107,0,.5); transform: translateY(-8px); box-shadow: var(--shadow-card), 0 0 50px rgba(255,107,0,.1); }
.showcase-card:hover::before { opacity: 1; }
.showcase-card .cover-large {
  width: 100%; height: 230px; border-radius: 15px; margin-bottom: 1.2rem;
  display: flex; align-items: center; justify-content: center; font-size: 3.6rem;
  position: relative; overflow: hidden; transition: transform .5s;
  background-size: cover; background-position: center;
}
.showcase-card:hover .cover-large { transform: scale(1.03); }
.showcase-card .cover-large::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.6), transparent 55%); }
.showcase-card h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: .3rem; letter-spacing: -.4px; }
.showcase-card .author { color: var(--txt-dimmer); font-size: .83rem; margin-bottom: .9rem; }
.showcase-card .desc { color: var(--txt-dim); font-size: .86rem; margin-bottom: 1.2rem; line-height: 1.6; }
.showcase-card .actions { display: flex; gap: .6rem; }
.showcase-card .btn-primary { flex: 1; justify-content: center; padding: .8rem; font-size: .83rem; }
.showcase-card .btn-icon {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255,107,0,.1);
  border: 1px solid rgba(255,107,0,.3); color: var(--orange); display: flex;
  align-items: center; justify-content: center; cursor: pointer; transition: all .3s;
  font-size: 1.05rem; font-family: inherit;
}
.showcase-card .btn-icon:hover { background: var(--orange); color: #050505; transform: rotate(15deg); box-shadow: 0 0 20px var(--orange-glow); }

/* ==========================================================================
   CATEGORY CARDS
   ========================================================================== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.1rem; margin-top: 1.6rem; }
.cat-card {
  background: linear-gradient(155deg, var(--black-card), var(--black-soft));
  border: 1px solid rgba(255,107,0,.12); border-radius: 18px; padding: 1.7rem 1.3rem;
  text-align: center; cursor: pointer; transition: all .4s cubic-bezier(.2,.9,.3,1);
  position: relative; overflow: hidden; text-decoration: none; display: block;
}
.cat-card::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,107,0,.14) 0%, transparent 60%);
  opacity: 0; transform: scale(.5); transition: transform .6s, opacity .5s;
}
.cat-card:hover { border-color: rgba(255,107,0,.5); transform: translateY(-6px); box-shadow: var(--shadow-card); }
.cat-card:hover::before { opacity: 1; transform: scale(1); }
.cat-card .cat-icon { font-size: 2.3rem; margin-bottom: .8rem; display: block; transition: transform .4s; }
.cat-card:hover .cat-icon { transform: scale(1.15) rotate(-8deg); }
.cat-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.cat-card span { font-size: .75rem; color: var(--txt-dimmer); }
.cat-card .kind {
  position: absolute; top: .6rem; inset-inline-end: .6rem; font-size: .55rem;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--txt-dimmer);
  border: 1px solid var(--gray-line); padding: .1rem .4rem; border-radius: 20px;
}

/* ==========================================================================
   FILTER BAR
   ========================================================================== */
.filters {
  background: var(--surface); border: 1px solid rgba(255,107,0,.14); border-radius: 20px;
  padding: 1.2rem 1.4rem; margin-bottom: 1.8rem; backdrop-filter: blur(12px);
}
.filter-row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.filter-row + .filter-row { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--gray-line); }
.filter-group { display: flex; flex-direction: column; gap: .3rem; flex: 1 1 160px; min-width: 0; }
/* The search box is deliberately twice as wide as a single select. */
.filter-group--wide { flex: 2 1 240px; }
/* The trailing submit button must never stretch or wrap into a full-width bar. */
.filter-group--btn { flex: 0 0 auto; justify-content: flex-end; }
.filter-group label { font-size: .66rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--txt-dimmer); font-weight: 700; }
select, input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea {
  background: var(--surface-2); border: 1px solid rgba(255,107,0,.22); color: var(--txt);
  padding: .6rem .9rem; border-radius: 12px; font-size: .86rem; outline: none;
  transition: all .3s; font-family: inherit; width: 100%;
}
select:focus, input:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 20px rgba(255,107,0,.16); }
select option { background: #101010; color: #fff; }
[data-theme="light"] select option { background: #fff; color: #111; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  font-size: .74rem; padding: .35rem .8rem; border-radius: 60px; border: 1px solid var(--gray-line);
  background: var(--surface-2); color: var(--txt-dim); cursor: pointer; transition: all .25s;
  text-decoration: none; white-space: nowrap;
}
.chip:hover { border-color: var(--orange); color: var(--orange); }
.chip.on { background: var(--orange); border-color: var(--orange); color: #050505; font-weight: 700; }

/* ==========================================================================
   CTA / NEWSLETTER
   ========================================================================== */
.cta-section {
  padding: 4.5rem 2.5rem; text-align: center;
  background: linear-gradient(180deg, transparent, rgba(255,107,0,.06));
  border-top: 1px solid var(--gray-line); border-bottom: 1px solid var(--gray-line);
  position: relative; overflow: hidden;
}
.cta-section::before {
  content: ''; position: absolute; top: 50%; left: 50%; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,107,0,.1) 0%, transparent 70%);
  transform: translate(-50%,-50%); pointer-events: none;
}
.cta-section h2 { font-size: clamp(1.7rem, 3.8vw, 2.8rem); font-weight: 900; letter-spacing: -2px; margin-bottom: .9rem; position: relative; }
.cta-section h2 .accent { color: var(--orange); }
.cta-section p { color: var(--txt-dim); max-width: 550px; margin: 0 auto 1.8rem; font-size: .96rem; position: relative; }
.newsletter-form { display: flex; gap: .6rem; max-width: 470px; margin: 0 auto; position: relative; flex-wrap: wrap; justify-content: center; }
.newsletter-form input { flex: 1; min-width: 210px; padding: .9rem 1.4rem; border-radius: 60px; }
.newsletter-form button { padding: .9rem 1.9rem; background: var(--orange); border: none; border-radius: 60px; color: #050505; font-weight: 700; font-size: .88rem; cursor: pointer; transition: all .3s; font-family: inherit; white-space: nowrap; }
.newsletter-form button:hover { background: var(--orange-bright); transform: translateY(-3px); box-shadow: 0 12px 30px -8px var(--orange-glow); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer.site-footer {
  padding: 2.5rem 2.5rem 2rem; display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 1.4rem; max-width: 1600px; margin: 0 auto;
}
footer .copy { color: var(--txt-dimmer); font-size: .78rem; }
footer .links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
footer .links a { color: var(--txt-dimmer); text-decoration: none; font-size: .78rem; transition: color .3s; }
footer .links a:hover { color: var(--orange); }

/* ==========================================================================
   TOAST / MODAL / SEARCH OVERLAY
   ========================================================================== */
.toast {
  position: fixed; bottom: 1.8rem; left: 50%;
  transform: translateX(-50%) translateY(100px); background: var(--orange); color: #050505;
  padding: .85rem 1.8rem; border-radius: 60px; font-weight: 700; font-size: .88rem;
  z-index: 3000; opacity: 0; transition: all .4s cubic-bezier(.2,.9,.3,1);
  box-shadow: 0 15px 40px -10px var(--orange-glow); pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.82); backdrop-filter: blur(8px);
  z-index: 2500; display: none; padding: 6vh 1.5rem 2rem; overflow-y: auto;
}
[data-theme="light"] .overlay { background: rgba(20,20,20,.55); }
.overlay.open { display: block; animation: viewFade .3s ease; }
.modal {
  max-width: 900px; margin: 0 auto; background: var(--black-card);
  border: 1px solid rgba(255,107,0,.25); border-radius: 22px; overflow: hidden;
  box-shadow: 0 40px 90px -30px #000;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--gray-line); }
.modal-head h3 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.3px; }
.modal-body { padding: 1.4rem; }
.modal-close { background: transparent; border: 1px solid var(--gray-line); color: var(--txt); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; line-height: 1; transition: all .3s; flex-shrink: 0; }
.modal-close:hover { background: var(--orange); color: #050505; border-color: var(--orange); }

/* command palette */
.palette { max-width: 660px; margin: 0 auto; background: var(--black-card); border: 1px solid rgba(255,107,0,.3); border-radius: 18px; overflow: hidden; box-shadow: 0 40px 90px -30px #000; }
.palette input {
  border: none; border-radius: 0; background: transparent; padding: 1.1rem 1.3rem;
  font-size: 1.05rem; border-bottom: 1px solid var(--gray-line);
}
.palette input:focus { box-shadow: none; border-color: var(--orange); }
.palette-results { max-height: 52vh; overflow-y: auto; }
.palette-item { display: flex; gap: .9rem; align-items: center; padding: .8rem 1.3rem; cursor: pointer; border-bottom: 1px solid var(--gray-line); text-decoration: none; transition: background .2s; }
.palette-item:hover, .palette-item.sel { background: rgba(255,107,0,.11); }
.palette-item .t { flex: 1; min-width: 0; }
.palette-item .t strong { display: block; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .t span { font-size: .75rem; color: var(--txt-dimmer); }
.palette-item .ic { width: 40px; height: 40px; border-radius: 9px; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.palette-hint { padding: .6rem 1.3rem; font-size: .68rem; color: var(--txt-dimmer); display: flex; gap: 1rem; flex-wrap: wrap; }
kbd { background: var(--surface-2); border: 1px solid var(--gray-line); border-radius: 5px; padding: .05rem .35rem; font-size: .68rem; font-family: inherit; }

/* ==========================================================================
   BOOK DETAIL / READER
   ========================================================================== */
/* The first track keeps the 320px cover on desktop but is allowed to shrink;
   the second track is minmax(0,1fr) so a 200-character title can never widen
   the grid past the viewport. */
.detail-grid { display: grid; grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
/* Grid/flex children default to min-width:auto, which lets long unbreakable
   words push the track wider than the page. Neutralise that here. */
.detail-grid > * { min-width: 0; }
.detail-cover { border-radius: 18px; overflow: hidden; position: relative; aspect-ratio: 3/4.2; background-size: cover; background-position: center; box-shadow: var(--shadow-card); }
.detail-actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.2rem; }
.detail-meta { display: flex; gap: 1.6rem; flex-wrap: wrap; margin: 1.4rem 0; padding: 1.1rem 0; border-top: 1px solid var(--gray-line); border-bottom: 1px solid var(--gray-line); }
.detail-meta .m .k { font-size: .64rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--txt-dimmer); }
.detail-meta .m .v { font-size: 1rem; font-weight: 700; color: var(--orange); }
.breadcrumbs { font-size: .76rem; color: var(--txt-dimmer); margin-bottom: 1rem; }
.breadcrumbs a { color: var(--txt-dim); text-decoration: none; }
.breadcrumbs a:hover { color: var(--orange); }
.badge-row { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .9rem; }
.badge { font-size: .66rem; padding: .2rem .6rem; border-radius: 40px; border: 1px solid rgba(255,107,0,.35); color: var(--orange); background: rgba(255,107,0,.08); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.badge.gray { border-color: var(--gray-line); color: var(--txt-dimmer); background: var(--surface-2); }

.reader-shell { position: fixed; inset: 0; background: #0A0A0A; z-index: 3000; display: flex; flex-direction: column; }
.reader-bar { display: flex; align-items: center; gap: .8rem; padding: .6rem 1rem; background: rgba(5,5,5,.96); border-bottom: 1px solid rgba(255,107,0,.2); flex-wrap: wrap; }
.reader-bar .rt { font-weight: 700; font-size: .88rem; flex: 1; min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.reader-progress { height: 3px; background: rgba(255,255,255,.12); position: relative; }
.reader-progress .bar { height: 100%; background: var(--orange); width: 0; transition: width .2s; }
.reader-canvas { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px; background: #111; }
/* Flex children shrink by default in a column flex container, which silently
   squashed every PDF page down to min-height. Never let a page shrink. */
.reader-canvas > * { flex: 0 0 auto; }
.reader-canvas .ph { margin: auto; }
.reader-canvas canvas { max-width: 100%; height: auto; box-shadow: 0 10px 30px rgba(0,0,0,.6); background: #fff; }
.reader-canvas .ph { color: rgba(255,255,255,.5); font-size: .85rem; padding: 3rem; text-align: center; }
.reader-nav { display: flex; align-items: center; gap: .5rem; justify-content: center; padding: .5rem; background: rgba(5,5,5,.96); border-top: 1px solid rgba(255,107,0,.2); flex-wrap: wrap; color: #fff; }

/* reading progress bar under card */
.progress-mini { height: 4px; background: var(--gray-line); border-radius: 4px; overflow: hidden; margin-top: .6rem; }
.progress-mini i { display: block; height: 100%; background: var(--orange); border-radius: 4px; }

/* ==========================================================================
   DASHBOARD
   ========================================================================== */
.dash { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.dash-side {
  background: var(--black-soft); border-inline-end: 1px solid var(--gray-line);
  padding: 1.4rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.dash-side .who { display: flex; gap: .7rem; align-items: center; padding: .8rem; border-radius: 14px; background: var(--surface-2); margin-bottom: 1.2rem; }
.dash-side .who .av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--orange), #8B3A00); display: flex; align-items: center; justify-content: center; font-weight: 900; color: #fff; flex-shrink: 0; }
.dash-side .who .nm { font-size: .85rem; font-weight: 700; line-height: 1.2; }
.dash-side .who .rl { font-size: .66rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--orange); }
.dash-nav { list-style: none; display: flex; flex-direction: column; gap: .2rem; }
.dash-nav a {
  display: flex; align-items: center; gap: .65rem; padding: .62rem .8rem; border-radius: 11px;
  text-decoration: none; color: var(--txt-dim); font-size: .85rem; font-weight: 500; transition: all .25s;
}
.dash-nav a:hover { background: var(--surface-2); color: var(--txt); }
.dash-nav a.active { background: rgba(255,107,0,.14); color: var(--orange); font-weight: 700; }
.dash-nav .grp { font-size: .62rem; text-transform: uppercase; letter-spacing: 1.8px; color: var(--txt-dimmer); padding: 1rem .8rem .35rem; }
.dash-main { padding: 1.8rem 2rem 3rem; min-width: 0; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.dash-head h1 { font-size: 1.7rem; font-weight: 900; letter-spacing: -1px; }
.dash-head p { color: var(--txt-dimmer); font-size: .85rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.kpi { background: var(--black-card); border: 1px solid var(--gray-line); border-radius: 16px; padding: 1.1rem 1.2rem; }
.kpi .k { font-size: .64rem; text-transform: uppercase; letter-spacing: 1.6px; color: var(--txt-dimmer); }
.kpi .v { font-size: 1.7rem; font-weight: 900; color: var(--orange); letter-spacing: -1px; line-height: 1.2; }
.kpi .s { font-size: .72rem; color: var(--txt-dimmer); }

.panel { background: var(--black-card); border: 1px solid var(--gray-line); border-radius: 18px; padding: 1.3rem; margin-bottom: 1.3rem; }
.panel h3 { font-size: 1rem; font-weight: 800; margin-bottom: .9rem; letter-spacing: -.3px; }
.panel .hint { font-size: .78rem; color: var(--txt-dimmer); margin-bottom: .9rem; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; }
table.tbl th { text-align: start; font-size: .66rem; text-transform: uppercase; letter-spacing: 1.3px; color: var(--txt-dimmer); padding: .6rem .7rem; border-bottom: 1px solid var(--gray-line); white-space: nowrap; }
table.tbl td { padding: .7rem; border-bottom: 1px solid var(--gray-line); vertical-align: middle; }
table.tbl tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

.status { font-size: .66rem; font-weight: 700; padding: .18rem .55rem; border-radius: 30px; text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; }
.status.published, .status.paid { background: rgba(40,180,90,.16); color: #4ade80; }
.status.pending, .status.awaiting_verification { background: rgba(255,180,0,.16); color: #ffc247; }
.status.draft, .status.rejected, .status.refunded { background: rgba(220,60,60,.16); color: #ff8080; }
.status.user { background: var(--surface-2); color: var(--txt-dim); }
.status.editor { background: rgba(255,107,0,.16); color: var(--orange); }
.status.admin { background: rgba(120,80,255,.18); color: #b49cff; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; }
.form-grid .full { grid-column: 1 / -1; }
label.fl { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: 1.4px; color: var(--txt-dimmer); font-weight: 700; margin-bottom: .3rem; }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--gray-line); margin-bottom: 1.3rem; flex-wrap: wrap; }
.tabs a { padding: .6rem 1rem; font-size: .84rem; font-weight: 600; color: var(--txt-dimmer); text-decoration: none; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--orange); border-bottom-color: var(--orange); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--txt-dimmer); }
.empty .big { font-size: 2.6rem; margin-bottom: .8rem; }

.alert { padding: .8rem 1.1rem; border-radius: 12px; font-size: .85rem; margin-bottom: 1rem; border: 1px solid; }
.alert.ok { background: rgba(40,180,90,.1); border-color: rgba(40,180,90,.4); color: #4ade80; }
.alert.err { background: rgba(220,60,60,.1); border-color: rgba(220,60,60,.4); color: #ff8080; }
.alert.warn { background: rgba(255,180,0,.1); border-color: rgba(255,180,0,.4); color: #ffc247; }
.alert.info { background: rgba(255,107,0,.08); border-color: rgba(255,107,0,.35); color: var(--orange); }

/* quiz */
.quiz-q { background: var(--black-card); border: 1px solid var(--gray-line); border-radius: 16px; padding: 1.2rem; margin-bottom: 1rem; }
.quiz-q .qt { font-weight: 700; margin-bottom: .9rem; font-size: .95rem; }
.quiz-opt { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; border-radius: 10px; cursor: pointer; transition: background .2s; font-size: .88rem; }
.quiz-opt:hover { background: var(--surface-2); }
.quiz-opt input { width: auto; margin-top: .3rem; accent-color: var(--orange); }
.quiz-opt.right { background: rgba(40,180,90,.12); }
.quiz-opt.wrong { background: rgba(220,60,60,.12); }
.score-ring { width: 120px; height: 120px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 900; margin: 0 auto 1rem; border: 4px solid var(--orange); color: var(--orange); }

/* auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 6rem 1.5rem 3rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--black-card); border: 1px solid rgba(255,107,0,.2); border-radius: 22px; padding: 2.2rem; box-shadow: var(--shadow-card); }
.auth-card h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -.8px; margin-bottom: .4rem; }
.auth-card .sub { color: var(--txt-dimmer); font-size: .85rem; margin-bottom: 1.6rem; }
.auth-card .field { margin-bottom: .9rem; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .82rem; color: var(--txt-dim); }
.check input { width: auto; accent-color: var(--orange); }

/* ==========================================================================
   RESPONSIVE
   Below 1200px the filter bar stops being a wrapping flex row: a lone wrapped
   item used to stretch to the full row (a 664px-wide "Field" select at 768px).
   An explicit column count keeps every control the same size instead.
   ========================================================================== */
@media (max-width: 1199px) {
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; align-items: end; }
  .filter-row > .chips { grid-column: 1 / -1; }
  .filter-group--wide { grid-column: 1 / -1; }
  .filter-group--btn { justify-content: flex-start; }
  .filter-group--btn label { display: none; }
}
@media (min-width: 520px) and (max-width: 859px) {
  .filter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* 5 tracks = the 4 wide-row controls (search spans 2) and the 5 narrow-row
   controls each stay on one line, exactly like the desktop flex layout. */
@media (min-width: 860px) and (max-width: 1199px) {
  .filter-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .filter-group--wide { grid-column: span 2; }
}
@media (max-width: 1150px) {
  /* minmax(0,1fr) — with a plain 1fr the column is held open by the 400px
     book stage and the hero text spills ~46px past a 360px viewport. */
  .hero { grid-template-columns: minmax(0, 1fr); min-height: auto; padding: 6.5rem 0 3rem; }
  .hero-left { padding: 0 2rem; text-align: center; align-items: center; min-width: 0; }
  .hero-subtitle { margin-inline: auto; }
  .hero-actions, .hero-stats { justify-content: center; }
  .hero-right { height: 600px; margin-top: 1rem; }
  .book-stage { transform: scale(.85); }
  .detail-grid { grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 1.6rem; }
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: static; height: auto; border-inline-end: none; border-bottom: 1px solid var(--gray-line); }
  .dash-nav { flex-direction: row; flex-wrap: wrap; }
  .dash-nav .grp { display: none; }
}
@media (max-width: 1024px) {
  .wrap, .stats-bar { padding-inline: 1.6rem; }
  .list-item { grid-template-columns: 48px minmax(0, 1fr) 80px 100px; }
  .list-item .stat:nth-child(4) { display: none; }
}
@media (max-width: 860px) {
  nav.topnav { padding: .9rem 1.2rem; }
  nav.topnav.scrolled { padding: .7rem 1.2rem; }
  .logo { font-size: 1.05rem; }
  .grid-view { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .showcase-card { flex: 0 0 290px; }
}

/* ---- header: shed, then collapse -----------------------------------------
   The full header (logo + the 7-link pill + search, theme, language, desktop
   app, sign in, sign up) has an intrinsic width of roughly 1460px. Below that
   the right-hand controls were pushed past the viewport and silently hidden by
   body{overflow-x:hidden} — at 900-1440px the "Create account" button simply
   was not on screen. Trim the secondary controls, then collapse the middle
   pill into the burger, as the viewport narrows. */
@media (max-width: 1460px) {
  nav.topnav, nav.topnav.scrolled { padding-inline: 1.6rem; }
  .nav-links a { padding: .5rem .75rem; font-size: .82rem; }
  .lang-switch a { padding: .3rem .45rem; }
}
@media (max-width: 1420px) {
  .nav-actions .lang-switch { display: none; }
}
@media (max-width: 1200px) {
  .nav-links {
    display: none; position: fixed; top: 62px; left: 1rem; right: 1rem;
    flex-direction: column; border-radius: 18px; padding: .6rem;
    background: var(--nav-bg-solid); border: 1px solid rgba(255,107,0,.25);
    backdrop-filter: blur(20px); box-shadow: 0 20px 50px -20px #000;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .7rem 1rem; font-size: .85rem; }
  .burger { display: flex; }
}

/* The book detail keeps its two columns down to 700px — switching to a single
   column at 860 wasted half the width beside a 260px cover while the title
   stayed buried under five full-width buttons. */
@media (max-width: 700px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-cover { max-width: 200px; margin-inline: auto; }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
  .detail-actions .btn-block { padding: .7rem 1rem; font-size: .84rem; }
  .detail-actions .btn-primary { grid-column: 1 / -1; }
  .detail-meta { gap: 1rem 1.6rem; }
}
@media (max-width: 640px) {
  .hero-title { letter-spacing: -2px; }
  .hero-right { height: 460px; }
  .book-stage { transform: scale(.62); }
  .grid-view { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); padding: 1.4rem; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .view-switcher { width: 100%; overflow-x: auto; }
  .view-btn { flex: 1; justify-content: center; }
  .list-item { grid-template-columns: 46px minmax(0, 1fr) 74px; gap: .8rem; padding: .9rem; }
  .list-item .stat { display: none; }
  .list-item .download { padding: .4rem .7rem; font-size: .7rem; }
  /* Let wide dashboard/privacy tables reflow their headers instead of forcing
     a 450px minimum width inside the scroll panel. */
  table.tbl th { white-space: normal; }
  /* The decorative blur orbs are wider than a phone. They were already clipped
     by .hero{overflow:hidden}; sizing them down just stops the wasted paint. */
  .glow-orb-1 { width: 320px; height: 320px; right: 2%; }
  .glow-orb-2 { width: 260px; height: 260px; left: 2%; }
  .reader-bar { gap: .5rem; padding: .5rem .7rem; }
  .reader-bar .rt { min-width: 60px; }
  .dash-main { padding: 1.2rem 1rem 2.5rem; }
  .hide-sm { display: none !important; }
}

/* Very narrow phones: the fixed-height nav controls (logo + theme + Sign up +
   burger) used to push the burger ~68px off a 360px screen. */
@media (max-width: 520px) {
  nav.topnav, nav.topnav.scrolled { padding: .8rem .85rem; gap: .5rem; }
  .nav-actions { gap: .35rem; min-width: 0; }
  .logo { font-size: 1rem; gap: .5rem; }
  .icon-btn { width: 36px; height: 36px; }
  .nav-btn { padding: .5rem .85rem; font-size: .76rem; }
  /* A long account name (role + name) must not squeeze the burger off-screen. */
  .nav-actions .nav-btn:not(.solid):not(.hide-sm) { flex-shrink: 1; min-width: 0; overflow: hidden; }
}

/* Smallest phones: the logo + theme + "Create account" + burger still needed a
   few more pixels so the burger stays fully on screen at 360px. */
@media (max-width: 400px) {
  nav.topnav, nav.topnav.scrolled { padding: .75rem .75rem; gap: .4rem; }
  .logo { font-size: .95rem; gap: .45rem; }
  .nav-btn { padding: .45rem .7rem; font-size: .74rem; }
  .icon-btn { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
