/* Dr Pro store — tokens come from the books themselves (navy header bar, ice title box, hexagon tags). */
:root {
  --abyss: #03202f;
  --navy: #004d73;
  --navy-2: #0a6590;
  --sky: #6cc3ea;
  --ice: #e6f5fb;
  --frost: #f3f8fb;
  --paper: #ffffff;
  --ink: #0d2a3a;
  --muted: #587282;
  --line: #d3e4ec;
  --pulse: #d8323c;
  --pulse-deep: #b0232c;
  --ok: #17835b;

  --f-display: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --f-sign: "Dancing Script", "Segoe Script", cursive;

  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgb(3 32 47 / 6%), 0 8px 24px -12px rgb(3 32 47 / 22%);
  --shadow-book: -1px 0 0 rgb(255 255 255 / 25%) inset, 0 2px 4px rgb(3 32 47 / 18%), 0 22px 40px -18px rgb(3 32 47 / 55%);
  --wrap: 1180px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 400 16.5px/1.75 var(--f-body);
  color: var(--ink);
  background: var(--frost);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: var(--navy); }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.en { font-family: var(--f-display); direction: ltr; unicode-bidi: isolate; }
.num { font-family: var(--f-mono); direction: ltr; unicode-bidi: isolate; font-feature-settings: "tnum"; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgb(3 32 47 / 92%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(108 195 234 / 16%);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo {
  font: 700 30px/1 var(--f-sign); color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: 10px; direction: ltr;
}
.logo .hex { width: 26px; height: 26px; color: var(--sky); }
.nav { display: flex; gap: 4px; margin-inline-start: auto; align-items: center; }
.nav a {
  color: #cfe6f1; text-decoration: none; font-size: 15px; font-weight: 500;
  padding: 8px 12px; border-radius: 999px; transition: background .2s, color .2s;
}
.nav a:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.nav a[aria-current="page"] { color: #fff; background: rgb(108 195 234 / 16%); }
.nav .account {
  border: 1px solid rgb(108 195 234 / 40%); color: #fff; margin-inline-start: 6px;
  display: inline-flex; align-items: center; gap: 8px;
}
.nav .account .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sky); }
@media (max-width: 640px) {
  .site-header .wrap { gap: 10px; }
  .logo { font-size: 25px; }
  .logo .hex { display: none; }
  .nav a { padding: 7px 9px; font-size: 14px; }
  .nav .hide-sm { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--navy); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 999px; border: 0;
  background: var(--bg); color: var(--fg);
  font: 600 16px/1 var(--f-body); text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .55; cursor: progress; transform: none; }
.btn-buy { --bg: var(--pulse); box-shadow: 0 10px 24px -12px var(--pulse); }
.btn-buy:hover { --bg: var(--pulse-deep); }
.btn-ghost { --bg: transparent; --fg: #fff; box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 35%); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px #fff; }
.btn-line { --bg: transparent; --fg: var(--navy); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-line:hover { box-shadow: inset 0 0 0 1.5px var(--navy); }
.btn-ok { --bg: var(--ok); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(900px 520px at 12% 110%, rgb(10 101 144 / 55%), transparent 60%),
    radial-gradient(700px 400px at 95% -10%, rgb(0 77 115 / 70%), transparent 60%),
    var(--abyss);
}
.hero::before, .page-hero::before { /* hexagon lattice, as on the book covers */
  content: ""; position: absolute; inset: 0; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='97' viewBox='0 0 84 97'%3E%3Cpath d='M42 1 83 24.5v48L42 96 1 72.5v-48z' fill='none' stroke='%236cc3ea' stroke-width='1.2'/%3E%3C/svg%3E");
  background-size: 84px 97px;
  mask-image: linear-gradient(to left, #000 10%, transparent 75%);
}
.hero .wrap {
  position: relative; display: grid; grid-template-columns: 1.02fr 1fr; gap: 48px; align-items: end;
  padding-block: 72px 0;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 14px/1 var(--f-body); color: var(--sky); letter-spacing: .01em;
}
.eyebrow::before { content: ""; width: 28px; height: 2px; background: currentColor; border-radius: 2px; }
.hero h1 {
  font: 800 clamp(38px, 5.4vw, 66px)/1.12 var(--f-display);
  margin: 18px 0 20px; letter-spacing: -.01em; text-wrap: balance;
}
.hero h1 .count { color: var(--sky); font-family: var(--f-display); }
.hero .lede { font-size: 18px; color: #bcd7e4; max-width: 34em; margin: 0 0 30px; }
.hero-copy { padding-bottom: 76px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-facts {
  display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 34px 0 0; padding: 0; list-style: none;
  color: #9fc2d3; font-size: 14.5px;
}
.hero-facts li { display: flex; align-items: center; gap: 8px; }
.hero-facts svg { width: 16px; height: 16px; color: var(--sky); }

/* The shelf: every spine's thickness is its real page count. */
.shelf { position: relative; align-self: end; }
.shelf-row {
  display: flex; align-items: flex-end; justify-content: center; gap: 4px;
  padding: 40px 12px 0; min-height: 420px;
}
.spine {
  --h: 330px;
  position: relative; flex: none; height: var(--h);
  border-radius: 4px 4px 1px 1px;
  background:
    linear-gradient(90deg, rgb(0 0 0 / 28%), transparent 18%, rgb(255 255 255 / 10%) 50%, transparent 82%, rgb(0 0 0 / 30%)),
    var(--c, var(--navy));
  color: #fff; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 14px 0 12px;
  box-shadow: 0 -1px 0 rgb(255 255 255 / 18%) inset, 6px 0 14px -8px rgb(0 0 0 / 60%);
  transform-origin: bottom center;
  transition: transform .45s var(--ease), box-shadow .3s;
  animation: spine-in .8s var(--ease) backwards;
  animation-delay: calc(var(--i) * 70ms + 150ms);
}
.spine::before { /* sky rule like the cover */
  content: ""; position: absolute; inset-inline: 18%; top: 44px; height: 2px; background: var(--sky); opacity: .9;
}
.spine .hex-tag {
  width: 26px; height: 29px; display: grid; place-items: center;
  font: 600 11px/1 var(--f-mono); color: var(--abyss); background: var(--sky);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.spine .spine-title {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font: 700 15px/1 var(--f-display); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  direction: ltr;
}
.spine .spine-sign { font: 700 13px/1 var(--f-sign); writing-mode: vertical-rl; transform: rotate(180deg); opacity: .75; direction: ltr; }
.spine:hover, .spine:focus-visible {
  transform: translateY(-26px);
  box-shadow: 0 -1px 0 rgb(255 255 255 / 25%) inset, 0 26px 30px -14px rgb(0 0 0 / 70%);
  outline-offset: 4px;
}
.spine .peek {
  position: absolute; bottom: calc(100% + 36px); left: 50%; translate: -50% 8px;
  width: 170px; padding: 10px 12px; border-radius: 10px;
  background: #fff; color: var(--ink); box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.5; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s var(--ease); z-index: 3;
}
.spine .peek b { display: block; font: 700 14px/1.4 var(--f-body); }
.spine .peek .num { color: var(--muted); }
.spine:hover .peek, .spine:focus-visible .peek { opacity: 1; translate: -50% 0; }
.plank {
  height: 16px; margin-inline: -12px; border-radius: 3px 3px 0 0;
  background: linear-gradient(#0f5f86, #0a4665);
  box-shadow: 0 -2px 0 rgb(108 195 234 / 45%) inset, 0 20px 40px -10px rgb(0 0 0 / 60%);
}
.shelf-caption {
  margin: 0; padding: 12px 0 18px; text-align: center; font-size: 13px; color: #8fb3c5;
}
@keyframes spine-in { from { transform: translateY(40px); opacity: 0; } }

@media (max-width: 960px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 8px; padding-top: 52px; }
  .hero-copy { padding-bottom: 12px; }
  .shelf-row { justify-content: flex-start; overflow-x: auto; min-height: 380px; padding-top: 70px; scrollbar-width: none; }
  .shelf-row::-webkit-scrollbar { display: none; }
  .spine { --h: 280px; }
  .spine .peek { display: none; }
}

/* ---------- Sections ---------- */
.section { padding-block: 88px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 36px; flex-wrap: wrap; }
.section-head h2 {
  font: 800 clamp(28px, 3.4vw, 40px)/1.2 var(--f-display); margin: 8px 0 0;
}
.section-head p { margin: 6px 0 0; color: var(--muted); max-width: 36em; }
.section-head .eyebrow { color: var(--navy-2); }

/* Book cards */
.grid-books { display: grid; grid-template-columns: repeat(4, 1fr); gap: 34px 26px; }
@media (max-width: 1040px) { .grid-books { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .grid-books { grid-template-columns: repeat(2, 1fr); gap: 28px 16px; } }

.book-card { position: relative; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.book-card .cover-wrap {
  position: relative; padding: 22px 26px 26px; border-radius: var(--r);
  background: linear-gradient(160deg, #fff, var(--ice));
  border: 1px solid var(--line);
  transition: background .3s;
}
.book3d {
  position: relative; border-radius: 3px 6px 6px 3px; overflow: hidden;
  aspect-ratio: 595 / 842; background: var(--navy);
  box-shadow: var(--shadow-book);
  transform: perspective(900px) rotateY(0deg);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.book3d img { width: 100%; height: 100%; object-fit: cover; }
.book3d::after { /* binding edge on the left: the books are English, bound left */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7%;
  background: linear-gradient(90deg, rgb(0 0 0 / 30%), rgb(255 255 255 / 14%) 45%, transparent);
}
.book-card:hover .book3d, .book-card:focus-visible .book3d {
  transform: perspective(900px) rotateY(-14deg) translateY(-4px);
  box-shadow: -1px 0 0 rgb(255 255 255 / 25%) inset, 14px 26px 40px -18px rgb(3 32 47 / 60%);
}
.book-card .owned-badge {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2;
  background: var(--ok); color: #fff; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.book-card h3 { font: 700 19px/1.4 var(--f-body); margin: 16px 0 2px; }
.book-card .en-title { font: 500 13px/1.3 var(--f-display); color: var(--muted); direction: ltr; text-align: right; }
.book-card .tagline { font-size: 14px; color: var(--muted); margin: 8px 0 12px; line-height: 1.65; }
.book-card .meta {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 12px; border-top: 1px dashed var(--line);
}
.meta-stats { font-size: 13px; color: var(--muted); display: flex; gap: 10px; }
.price { font: 700 19px/1 var(--f-display); color: var(--navy); white-space: nowrap; }
.price small { font: 500 13px/1 var(--f-body); color: var(--muted); margin-inline-start: 5px; }
@media (max-width: 760px) {
  .book-card .cover-wrap { padding: 14px 16px 18px; }
  .book-card h3 { font-size: 16px; }
  .book-card .tagline { display: none; }
  .book-card .meta { flex-direction: column; align-items: flex-start; }
}

/* Skeletons */
.skeleton { background: linear-gradient(90deg, #e5eef3, #f3f8fb, #e5eef3); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Bundle band */
.bundle-band {
  position: relative; overflow: hidden; border-radius: 24px; color: #fff;
  background:
    radial-gradient(600px 300px at 0% 100%, rgb(108 195 234 / 22%), transparent 70%),
    linear-gradient(135deg, var(--navy), var(--abyss));
  display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; gap: 24px;
  padding: 56px;
}
.bundle-band h2 { font: 800 clamp(28px, 3.4vw, 42px)/1.2 var(--f-display); margin: 12px 0 14px; }
.bundle-band p { color: #c3dce8; margin: 0 0 26px; max-width: 30em; }
.bundle-price { display: flex; align-items: baseline; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.bundle-price .now { font: 800 44px/1 var(--f-display); }
.bundle-price .now small, .bundle-price s small { font-size: 18px; font-weight: 500; margin-inline-start: 5px; }
.bundle-price s { color: #8fb3c5; font-size: 18px; }
.save-chip { background: var(--pulse); color: #fff; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; }
.cover-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 16px; padding: 8px; }
.cover-grid .book3d {
  transform: rotate(calc(var(--t) * 1deg));
  box-shadow: 0 0 0 1px rgb(108 195 234 / 25%), 0 14px 28px -10px rgb(0 0 0 / 70%);
  transition: transform .45s var(--ease);
}
.cover-grid a:hover .book3d, .cover-grid a:focus-visible .book3d { transform: rotate(0) translateY(-6px) scale(1.04); }
.bundle-band:hover .cover-grid .book3d { transform: rotate(0); }
@media (max-width: 900px) {
  .bundle-band { grid-template-columns: 1fr; padding: 36px 22px; }
  .bundle-band .cover-grid { order: -1; gap: 10px; }
}

/* Steps (a real sequence) */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: step; position: relative; padding: 26px 24px 24px; border-radius: var(--r);
  background: var(--paper); border: 1px solid var(--line);
}
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 38px; height: 43px; margin-bottom: 14px;
  font: 600 16px/1 var(--f-mono); color: #fff; background: var(--navy);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.steps h3 { margin: 0 0 6px; font: 700 18px/1.4 var(--f-body); }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* FAQ */
.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 20px 0; font-weight: 600; font-size: 17px;
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 26px/1 var(--f-mono); color: var(--navy-2); transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 20px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { background: var(--abyss); color: #9fc2d3; padding: 56px 0 28px; margin-top: 0; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; margin: 0 0 12px; font-size: 15px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: #cfe6f1; text-decoration: none; font-size: 15px; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid rgb(108 195 234 / 14%); padding-top: 20px; font-size: 13px; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr 1fr; } .site-footer .brand-col { grid-column: 1 / -1; } }

/* ---------- Book page ---------- */
.crumbs { font-size: 14px; color: var(--muted); padding-top: 26px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--navy); }
.product { display: grid; grid-template-columns: 1fr 1.05fr; gap: 64px; padding-block: 24px 72px; align-items: start; }
.product > * { min-width: 0; } /* keep the thumbnail strip from widening the page on phones */
.product-media { position: sticky; top: 88px; }
.stage {
  position: relative; border-radius: 22px; padding: 44px;
  background:
    radial-gradient(400px 260px at 70% 20%, rgb(255 255 255 / 80%), transparent 70%),
    linear-gradient(160deg, var(--ice), #cfe8f3);
  border: 1px solid var(--line);
  display: grid; place-items: center;
}
.stage .book3d { width: min(330px, 100%); transform: perspective(1100px) rotateY(-12deg); }
.stage .book3d.page { border-radius: 4px; transform: none; }
.stage .book3d.page::after { display: none; }
.thumbs { display: flex; gap: 10px; margin-top: 14px; overflow-x: auto; padding: 2px 2px 6px; }
.thumbs button {
  flex: none; width: 66px; padding: 0; border: 2px solid transparent; border-radius: 6px;
  background: var(--paper); cursor: pointer; overflow: hidden; box-shadow: var(--shadow);
}
.thumbs button[aria-pressed="true"] { border-color: var(--navy); }
.thumbs img { width: 100%; aspect-ratio: 595/842; object-fit: cover; }
.zoom-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

.product-info h1 { font: 800 clamp(30px, 3.8vw, 46px)/1.2 var(--f-display); margin: 6px 0 8px; }
.product-info .en-title { font: 500 16px/1.3 var(--f-display); color: var(--navy-2); direction: ltr; text-align: right; }
.product-info .tagline { font-size: 18px; color: var(--muted); margin: 14px 0 24px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); margin-bottom: 24px; }
.facts div { padding: 14px 16px; text-align: center; }
.facts div + div { border-inline-start: 1px solid var(--line); }
.facts b { display: block; font: 700 24px/1.2 var(--f-display); color: var(--navy); }
.facts span { font-size: 13px; color: var(--muted); }

.buy-box { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.buy-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.buy-row .price { font-size: 36px; }
.buy-row s { color: var(--muted); }
.assurances { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; font-size: 14.5px; color: var(--muted); }
.assurances li { display: flex; gap: 10px; align-items: center; }
.assurances svg { width: 18px; height: 18px; color: var(--ok); flex: none; }
.form-msg { margin: 12px 0 0; font-size: 14.5px; color: var(--pulse-deep); }
.form-msg.ok { color: var(--ok); }

.block { margin-top: 44px; }
.block h2 { font: 700 22px/1.3 var(--f-display); margin: 0 0 14px; }
.block p { margin: 0; }

/* Contents, styled after the books' own chapter tags */
.toc { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: ch; }
.toc li {
  counter-increment: ch; display: flex; align-items: center; gap: 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px;
}
.toc li::before {
  content: "Ch" counter(ch); flex: none; display: grid; place-items: center; width: 44px; height: 38px;
  font: 700 12.5px/1 var(--f-display); color: #fff; background: var(--navy);
  clip-path: polygon(22% 0, 78% 0, 100% 50%, 78% 100%, 22% 100%, 0 50%);
}
.toc li .en { font-size: 15px; }
.toc li .pages { margin-inline-start: auto; font-size: 13px; color: var(--muted); }
.toc a { text-decoration: none; color: inherit; display: contents; }
.toc a:hover .en { color: var(--navy); text-decoration: underline; }

.upsell {
  margin-top: 44px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 20px 22px; border-radius: 16px; background: var(--ice); border: 1px dashed #9ccfe5;
}
.upsell b { font-size: 17px; }
.upsell p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }


@media (max-width: 900px) {
  .product { grid-template-columns: 1fr; gap: 32px; }
  .product-media { position: static; }
  .stage { padding: 28px; }
  .stage .book3d { width: min(240px, 100%); }
}

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.lightbox::backdrop { background: rgb(3 32 47 / 88%); backdrop-filter: blur(4px); }
.lightbox img { max-height: 92vh; max-width: 94vw; width: auto; border-radius: 6px; box-shadow: 0 30px 60px rgb(0 0 0 / 50%); }
.lightbox .close {
  position: fixed; top: 16px; left: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: #fff; color: var(--ink); font-size: 24px; cursor: pointer;
}
.lightbox .wm { position: fixed; bottom: 14px; left: 0; right: 0; text-align: center; color: #cfe6f1; font-size: 13px; }

/* ---------- Library ---------- */
.page-hero { background: var(--abyss); color: #fff; padding: 48px 0 40px; position: relative; overflow: hidden; }
.page-hero h1 { font: 800 clamp(30px, 4vw, 44px)/1.2 var(--f-display); margin: 8px 0 6px; }
.page-hero p { color: #a9c9d8; margin: 0; }
.page-hero .wrap { display: flex; justify-content: space-between; align-items: end; gap: 18px; flex-wrap: wrap; }

.purchase { margin-top: 40px; }
.purchase-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 20px; border-bottom: 2px solid var(--navy);
}
.purchase-head h2 { font: 700 22px/1.3 var(--f-display); margin: 0; display: flex; align-items: center; gap: 10px; }
.purchase-head .tag { font: 600 12px/1 var(--f-body); background: var(--ice); color: var(--navy); padding: 6px 10px; border-radius: 999px; }
.purchase-head .when { font-size: 13.5px; color: var(--muted); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.lib-item {
  display: grid; grid-template-columns: 92px 1fr; gap: 16px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px;
}
.lib-item .book3d { width: 92px; }
.lib-item h3 { margin: 0; font: 700 17px/1.4 var(--f-body); }
.lib-item h3 a { color: inherit; text-decoration: none; }
.lib-item .en-title { font: 500 12.5px/1.3 var(--f-display); color: var(--muted); direction: ltr; text-align: right; margin-bottom: 10px; }
.lib-item .file-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.lib-item .btn { min-height: 40px; padding: 0 16px; font-size: 14.5px; }
.empty {
  text-align: center; padding: 64px 20px; border: 2px dashed var(--line); border-radius: 20px; margin-top: 40px; background: var(--paper);
}
.empty h2 { font: 700 24px/1.3 var(--f-display); margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 20px; }

/* ---------- Forms / auth / checkout ---------- */
.narrow { max-width: 480px; margin: 56px auto 88px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.card h1 { font: 800 30px/1.25 var(--f-display); margin: 0 0 8px; }
.card .sub { color: var(--muted); margin: 0 0 24px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 14.5px; }
.field input {
  width: 100%; min-width: 0;
  font: inherit; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--frost);
  transition: border-color .2s, background .2s;
}
.field input:focus { outline: none; border-color: var(--navy); background: #fff; }
.notice {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 20px;
  background: #fff5e6; color: #7a4a00; border: 1px solid #f3d7a6;
}
.notice.info { background: var(--ice); color: var(--navy); border-color: #b9e0f0; }
.refund-note { display: block; margin: 0 0 18px; }

/* Sign-in / sign-up */
.auth-card .notice { display: block; }
.btn-google {
  --bg: #fff; --fg: var(--ink); gap: 10px;
  box-shadow: inset 0 0 0 1.5px var(--line), 0 1px 2px rgb(3 32 47 / 6%);
}
.btn-google:hover { box-shadow: inset 0 0 0 1.5px var(--navy), 0 4px 12px -6px rgb(3 32 47 / 25%); }
.btn-google svg { width: 20px; height: 20px; flex: none; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; color: var(--muted); font-size: 13.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pw { position: relative; }
/* The field is left-to-right, so the toggle sits on the physical right in both directions. */
.pw input { padding-right: 72px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; translate: 0 -50%;
  border: 0; background: none; color: var(--navy); font: 600 13px/1 var(--f-body); padding: 8px 10px; cursor: pointer; border-radius: 8px;
}
.pw-toggle:hover { background: var(--ice); }
.field .hint { color: var(--muted); font-size: 12.5px; }
.auth-switch { text-align: center; margin: 22px 0 0; font-size: 15px; }
.auth-switch a { font-weight: 700; }
.auth-help { text-align: center; color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }
.order-line { display: grid; grid-template-columns: 70px 1fr auto; gap: 16px; align-items: center; padding: 16px 0; border-block: 1px solid var(--line); margin-bottom: 20px; }
.order-line .book3d { width: 70px; }
.order-line .stack { width: 70px; height: 99px; border-radius: 4px; background: linear-gradient(135deg, var(--navy), var(--abyss)); display: grid; place-items: center; color: #fff; font: 700 22px/1 var(--f-display); box-shadow: var(--shadow-book); }
.success-mark { width: 64px; height: 64px; border-radius: 50%; background: #e3f5ec; color: var(--ok); display: grid; place-items: center; margin-bottom: 16px; }
.success-mark svg { width: 34px; height: 34px; }

/* ---------- Prose (policies) ---------- */
.prose { max-width: 760px; padding-block: 48px 88px; }
.prose h2 { font: 700 22px/1.4 var(--f-display); margin: 40px 0 10px; color: var(--navy); }
.prose p, .prose li { color: #2c4655; }
.prose ul { padding-inline-start: 22px; }
.prose .updated { color: var(--muted); font-size: 14px; }
.prose .callout { background: var(--ice); border-inline-start: 4px solid var(--navy); padding: 14px 18px; border-radius: 8px; margin: 24px 0; }

.message-page { max-width: 520px; margin: 18vh auto; text-align: center; padding: 0 16px; }
.message-page h1 { font: 800 30px/1.3 var(--f-display); }
.message-page p { color: var(--muted); }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; translate: -50% 20px; z-index: 60;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 15px;
  opacity: 0; transition: opacity .25s, translate .25s var(--ease); pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; translate: -50% 0; }

/* WhatsApp chat button — fixed on the side of every page */
.wa-float {
  position: fixed; bottom: 22px; left: 22px; z-index: 55;
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: #25d366; color: #fff; text-decoration: none;
  box-shadow: 0 6px 18px -4px rgb(18 140 70 / 55%), 0 2px 4px rgb(3 32 47 / 15%);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.wa-float svg { width: 32px; height: 32px; }
.wa-float::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: #25d366;
  z-index: -1; animation: wa-ring 2.8s var(--ease) infinite;
}
.wa-float:hover { transform: scale(1.07); box-shadow: 0 10px 24px -6px rgb(18 140 70 / 65%); }
.wa-float:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.wa-tip {
  position: absolute; left: calc(100% + 12px); top: 50%; translate: -6px -50%;
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  padding: 7px 12px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, translate .2s var(--ease);
}
.wa-float:hover .wa-tip, .wa-float:focus-visible .wa-tip { opacity: 1; translate: 0 -50%; }
@keyframes wa-ring { 0% { transform: scale(1); opacity: .45; } 70%, 100% { transform: scale(1.55); opacity: 0; } }
@media (max-width: 760px) {
  .wa-float { bottom: 14px; left: 14px; width: 48px; height: 48px; }
  .wa-float svg { width: 26px; height: 26px; }
  .wa-tip { display: none; }
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
.toc-books li::before { content: counter(ch); width: 34px; font-family: var(--f-mono); }
.toc-books li { gap: 12px; }
.toc-books li span:nth-of-type(2) { color: var(--muted); font-size: 14px; }
.num + small { margin-inline-start: 4px; }
main { min-height: calc(100vh - 64px); }
.site-footer .logo { font-size: 30px; color: #fff; text-decoration: none; margin-bottom: 8px; }
.hero .wrap > * { min-width: 0; }
.book-card .owned-badge { top: auto; bottom: 10px; }
.lib-item .file-meta { display: flex; flex-wrap: wrap; gap: 0 12px; }
.lib-item .file-meta span { white-space: nowrap; }
@media (max-width: 520px) {
  .facts b { font-size: 19px; }
  .lib-item { grid-template-columns: 76px 1fr; }
  .lib-item .book3d { width: 76px; }
}

/* ---------- Packages ---------- */
.package + .package { margin-top: 72px; }
.pkg-facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 22px; }
.pkg-facts li { background: rgb(255 255 255 / 8%); border: 1px solid rgb(108 195 234 / 25%); border-radius: 999px; padding: 4px 14px; font-size: 14px; color: #cfe6f1; }
.pkg-facts b { color: #fff; font-size: 15px; margin-inline-end: 4px; }
.per { color: var(--muted); font-size: 14px; }
.bundle-band .per { color: #9fc2d3; }
.package-books { margin-top: 44px; }
.sub-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  font: 700 22px/1.3 var(--f-display); margin: 0 0 22px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.sub-head span { font: 400 14.5px/1.5 var(--f-body); color: var(--muted); }
.card-link { font-size: 13.5px; font-weight: 600; color: var(--navy); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.card-link svg { width: 15px; height: 15px; transition: transform .25s var(--ease); }
.book-card:hover .card-link svg { transform: translateX(-4px); }

.soon { margin-top: 72px; }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.soon-card {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r);
  border: 1.5px dashed var(--line); background: var(--paper); color: var(--muted);
}
.soon-card b { display: block; color: var(--ink); font-size: 16px; }
.soon-card span { font-size: 13px; }
.soon-tag {
  flex: none; display: grid; place-items: center; width: 54px; height: 60px;
  background: var(--ice); color: var(--navy); font: 700 13px/1 var(--f-display);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

/* Package page: one row per book */
.contents-section { background: var(--paper); border-top: 1px solid var(--line); padding-block: 64px; }
.book-rows { display: grid; gap: 14px; }
.book-row {
  display: grid; grid-template-columns: 86px 1fr auto; gap: 22px; align-items: center;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--frost);
  transition: border-color .2s, background .2s;
}
.book-row:hover { border-color: #a9d3e6; background: #fff; }
.book-row .book3d { width: 86px; }
.book-row h3 { margin: 0; font: 700 18px/1.4 var(--f-body); }
.book-row h3 a { color: inherit; text-decoration: none; }
.book-row .en-title { font: 500 13px/1.3 var(--f-display); color: var(--muted); direction: ltr; text-align: right; }
.book-row p { margin: 6px 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.book-row-actions { display: grid; gap: 8px; min-width: 200px; }
.book-row-actions .btn { min-height: 42px; font-size: 14.5px; padding: 0 16px; }
@media (max-width: 760px) {
  .book-row { grid-template-columns: 72px 1fr; gap: 14px; }
  .book-row .book3d { width: 72px; }
  .book-row-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; min-width: 0; }
  .book-row p { display: none; }
}

.sample-btn { --fg: var(--navy); background: #fff; }
.sample-btn[disabled] { cursor: not-allowed; opacity: .6; }
.sample-btn .num { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* Book page */
.sample-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 18px; margin-bottom: 16px; border-radius: 16px;
  background: var(--ice); border: 1px dashed #9ccfe5;
}
.sample-box b { font-size: 17px; }
.sample-box p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.in-package {
  display: flex; align-items: center; gap: 14px; margin: -4px -4px 18px; padding: 12px 14px;
  border-radius: 12px; background: var(--frost); color: inherit; text-decoration: none;
  border: 1px solid var(--line); transition: border-color .2s;
}
.in-package:hover { border-color: var(--navy); }
.in-package b { display: block; font-size: 15px; }
.in-package small { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.in-package > svg { width: 18px; height: 18px; margin-inline-start: auto; flex: none; color: var(--navy); }
.in-package-tag {
  flex: none; display: grid; place-items: center; width: 40px; height: 45px;
  background: var(--navy); color: #fff; font: 700 15px/1 var(--f-mono);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.buy-note { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; font-size: 14px; color: var(--navy); }
.buy-note svg { width: 18px; height: 18px; flex: none; }
.stage-page { padding: 0; border: 0; cursor: zoom-in; width: min(330px, 100%); }

.sibling-row { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 16px; scrollbar-width: thin; }
.sibling { flex: none; width: 150px; text-decoration: none; color: inherit; }
.sibling .book3d { margin-bottom: 10px; transition: transform .35s var(--ease); }
.sibling:hover .book3d { transform: translateY(-4px); }
.sibling b { display: block; font-size: 14.5px; line-height: 1.4; }
.sibling span { font-size: 13px; color: var(--muted); }

.order-line .stack { align-content: center; gap: 4px; }
.order-line .stack small { font: 500 12px/1 var(--f-body); opacity: .8; }

/* ---------- Store grid (packages explorer) ---------- */
.explorer-hero { padding: 40px 0 34px; }
.explorer-head { width: 100%; }
.search {
  position: relative; display: flex; gap: 8px; margin-top: 22px; max-width: 760px;
  background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 12px 30px -14px rgb(0 0 0 / 60%);
}
.search svg { position: absolute; inset-inline-start: 22px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink);
  padding: 10px 50px 10px 12px;
}
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search:focus-within { box-shadow: 0 0 0 3px var(--sky), 0 12px 30px -14px rgb(0 0 0 / 60%); }
.search .btn { min-height: 44px; }

.explorer { padding-block: 26px 88px; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding-bottom: 18px; margin-bottom: 26px; border-bottom: 1px solid var(--line);
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper);
  font-size: 14.5px; font-weight: 600; color: var(--ink); transition: border-color .2s, background .2s, color .2s;
}
.chips button:hover { border-color: var(--navy); }
.chips button .num { font-size: 12px; min-width: 22px; padding: 2px 6px; border-radius: 999px; background: var(--frost); color: var(--muted); }
.chips button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips button[aria-pressed="true"] .num { background: rgb(255 255 255 / 18%); color: #fff; }
.toolbar-end { display: flex; align-items: center; gap: 16px; }
.result-count { font-size: 14px; color: var(--muted); white-space: nowrap; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.sort select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 7px 10px; cursor: pointer;
}

.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.p-grid > .empty { grid-column: 1 / -1; margin-top: 0; }
.p-card {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
a.p-card:hover, a.p-card:focus-visible { transform: translateY(-4px); box-shadow: 0 22px 40px -22px rgb(3 32 47 / 45%); border-color: #b9dcec; }
.p-card-media { position: relative; aspect-ratio: 1; background: var(--ice); overflow: hidden; }
.p-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
a.p-card:hover .p-card-media img { transform: scale(1.04); }
.p-card-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='97' viewBox='0 0 84 97'%3E%3Cpath d='M42 1 83 24.5v48L42 96 1 72.5v-48z' fill='none' stroke='%239ccfe5' stroke-width='1.2'/%3E%3C/svg%3E") center / 84px 97px,
    linear-gradient(160deg, #f3f9fc, var(--ice));
}
.p-card-placeholder span {
  display: grid; place-items: center; width: 120px; height: 138px; color: #fff; font: 800 26px/1 var(--f-display);
  background: linear-gradient(160deg, var(--navy-2), var(--abyss));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.p-card-badges { position: absolute; top: 12px; inset-inline-start: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgb(3 32 47 / 12%); }
.badge-ok { background: var(--ok); color: #fff; }
.badge-soon { background: var(--ink); color: #fff; }
.p-card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.p-card-code { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--navy-2); text-align: right; }
.p-card h3 { margin: 4px 0 6px; font: 700 19px/1.4 var(--f-body); }
.p-card p {
  margin: 0 0 12px; font-size: 14px; line-height: 1.65; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.p-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.p-card-meta span { font-size: 12.5px; padding: 3px 9px; border-radius: 6px; background: var(--frost); color: var(--muted); }
.p-card-foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 14px; border-top: 1px dashed var(--line);
}
.p-card-foot .price { font-size: 24px; }
.p-card-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--pulse); }
.p-card-cta svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
a.p-card:hover .p-card-cta svg { transform: translateX(-4px); }
.p-card-soon { font-size: 14px; font-weight: 600; color: var(--muted); }
.p-card.is-soon { cursor: default; }
.p-card.is-soon .p-card-media { filter: saturate(.6); }

@media (max-width: 640px) {
  .explorer-hero { padding: 28px 0 24px; }
  .search .btn { display: none; }
  .search input { padding-inline-end: 12px; }
  .toolbar { gap: 10px; }
  .toolbar-end { width: 100%; justify-content: space-between; }
  .p-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .p-card-body { padding: 12px; }
  .p-card h3 { font-size: 15.5px; }
  .p-card p, .p-card-meta span:nth-child(n+2) { display: none; }
  .p-card-meta { margin-bottom: 10px; }
  .p-card-foot { flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 10px; }
  .p-card-foot .price { font-size: 20px; }
  .badge { font-size: 11px; padding: 3px 8px; }

  /* A lone package gets the full row, with its full details. */
  .p-grid:has(> .p-card:only-child) { grid-template-columns: 1fr; }
  .p-grid > .p-card:only-child .p-card-body { padding: 18px; }
  .p-grid > .p-card:only-child h3 { font-size: 19px; }
  .p-grid > .p-card:only-child p { display: block; }
  .p-grid > .p-card:only-child .p-card-meta span { display: inline-flex; }
  .p-grid > .p-card:only-child .p-card-foot { flex-direction: row; align-items: center; }
  .p-grid > .p-card:only-child .p-card-media img { max-height: 300px; margin-inline: auto; }
}
