/* ==========================================================================
   Amar Patente — amarpatente.com
   Custom marketing site. No framework, no build step.
   Sections are ordered the same way they appear in index.html.
   Bangla font: Anek Bangla (see --font-bn below).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces — a night road: deep navy, never pure black. */
  --ink: #05091a;
  --ink-2: #080e26;
  --ink-3: #0c1533;
  --card: rgba(255, 255, 255, 0.038);
  --card-hi: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.10);
  --line-hi: rgba(255, 255, 255, 0.22);

  /* Text */
  --text: #eef2ff;
  --muted: #9aa6c9;
  --muted-2: #6f7ca2;

  /* Brand — the tricolore, straight off the logo. */
  --green: #00a65a;
  --green-lo: #06301f;
  --red: #e5303c;
  --red-lo: #340d12;
  --gold: #ffc53d;
  --blue: #2f6bff;
  --blue-lo: #0b1c4d;
  --violet: #8b5cf6;

  /* Type */
  --font: "Plus Jakarta Sans", "Anek Bangla", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  --font-bn: "Anek Bangla", "Plus Jakarta Sans", -apple-system, sans-serif;

  /* Layout */
  --wrap: 1200px;
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --radius: 22px;
  --radius-sm: 14px;
  --radius-lg: 34px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 0.55s;

  --header-h: 104px;
}

/* Bengali needs a taller line and its own family to stay readable. */
html[lang="bn"] body,
html[lang="bn"] .btn,
html[lang="bn"] .eyebrow {
  font-family: var(--font-bn);
}
html[lang="bn"] p,
html[lang="bn"] li {
  line-height: 1.85;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 18px);
}

body {
  font-family: var(--font);
  background: var(--ink);
  color: var(--text);
  line-height: 1.65;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* The page sits on a fixed field of light so scrolling feels like moving
   through space rather than sliding a flat sheet. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60rem 40rem at 78% -10%, rgba(47, 107, 255, 0.20), transparent 62%),
    radial-gradient(46rem 34rem at 8% 8%, rgba(0, 166, 90, 0.14), transparent 60%),
    radial-gradient(50rem 40rem at 50% 108%, rgba(229, 48, 60, 0.13), transparent 62%),
    var(--ink);
}

/* Fine road-grain so the flat navy never reads as dead space. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.045'/%3E%3C/svg%3E");
}

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

/* The hidden attribute must win. A class that sets display — .lib-empty is
   display:grid — beats the browser's own [hidden]{display:none}, which is why
   the "pick a chapter" placeholder stayed on screen above an open document. */
[hidden] {
  display: none !important;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

ul {
  list-style: none;
}

::selection {
  background: var(--gold);
  color: #10131f;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */

.wrap {
  width: min(100% - (var(--gutter) * 2), var(--wrap));
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: clamp(3.75rem, 6.5vw, 6.25rem);
}

.section--tight {
  padding-block: clamp(2.75rem, 4.5vw, 4rem);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  background: var(--gold);
  color: #10131f;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 0.25s var(--ease);
}

.skip-link:focus {
  transform: none;
}

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  line-height: 1.12;
  letter-spacing: -0.022em;
  font-weight: 800;
  text-wrap: balance;
}

.h-display {
  font-size: clamp(2.6rem, 1.5rem + 5.1vw, 5.1rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.h-section {
  font-size: clamp(1.95rem, 1.25rem + 2.9vw, 3.3rem);
}

.h-card {
  font-size: clamp(1.12rem, 1.02rem + 0.42vw, 1.32rem);
  letter-spacing: -0.012em;
}

.lead {
  font-size: clamp(1.03rem, 0.98rem + 0.42vw, 1.24rem);
  color: var(--muted);
  max-width: 62ch;
}

/* A lead paragraph directly under a heading needs air; inside .section-head
   the rule below already handles it, this covers the split/course blocks. */
h1 + .lead,
h2 + .lead {
  margin-top: 1.15rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.05rem;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--green), var(--text) 52%, var(--red));
}

html[lang="bn"] .eyebrow {
  letter-spacing: 0.06em;
}

.section-head {
  max-width: 58rem;
  margin-bottom: clamp(2.4rem, 4vw, 3.6rem);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.section-head--center .lead {
  margin-inline: auto;
}

.section-head p {
  margin-top: 1.1rem;
}

.tri-text {
  background: linear-gradient(100deg, #35d17f 4%, #ffffff 46%, #ff7a84 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gold-text {
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */

.btn {
  --btn-bg: var(--card-hi);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.92rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 0.97rem;
  letter-spacing: -0.005em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease), background-color 0.35s var(--ease);
}

.btn svg {
  flex: none;
}

/* A light sweeps across on hover — a headlight passing. */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 80%
  );
  transform: translateX(-110%);
  transition: transform 0.75s var(--ease);
}

.btn:hover::after,
.btn:focus-visible::after {
  transform: translateX(110%);
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--line-hi);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn--primary {
  --btn-bg: linear-gradient(135deg, #3b78ff, #1b46d6);
  --btn-fg: #fff;
  border-color: transparent;
  box-shadow: 0 12px 34px -12px rgba(47, 107, 255, 0.85);
}

.btn--primary:hover {
  box-shadow: 0 18px 44px -12px rgba(47, 107, 255, 0.95);
}

.btn--gold {
  --btn-bg: linear-gradient(135deg, #ffd869, #f0a800);
  --btn-fg: #241900;
  border-color: transparent;
  box-shadow: 0 12px 34px -12px rgba(255, 197, 61, 0.75);
}

.btn--green {
  --btn-bg: linear-gradient(135deg, #12c96f, #018349);
  --btn-fg: #fff;
  border-color: transparent;
  box-shadow: 0 12px 34px -12px rgba(0, 166, 90, 0.8);
}

.btn--ghost {
  --btn-bg: transparent;
}

.btn--lg {
  padding: 1.08rem 1.9rem;
  font-size: 1.03rem;
}

.btn--sm {
  padding: 0.62rem 1.05rem;
  font-size: 0.87rem;
}

.btn--block {
  width: 100%;
}

/* Store badges ------------------------------------------------------------ */

.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.72rem 1.35rem 0.72rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.11),
    rgba(255, 255, 255, 0.03)
  );
  backdrop-filter: blur(10px);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
    box-shadow 0.4s var(--ease);
}

.store-btn:hover {
  transform: translateY(-3px);
  border-color: var(--line-hi);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
}

.store-btn svg {
  width: 26px;
  height: 26px;
  flex: none;
}

.store-btn__txt {
  display: grid;
  line-height: 1.15;
}

.store-btn__sm {
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.store-btn__lg {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   6. Header
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background-color 0.4s var(--ease), backdrop-filter 0.4s var(--ease),
    box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.is-stuck {
  background: rgba(5, 9, 26, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--line);
  box-shadow: 0 12px 40px -28px #000;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  width: min(100% - (var(--gutter) * 2), var(--wrap));
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-right: auto;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand img {
  /* Doubled from 42px. The header height above grew with it so the logo has
     room to breathe rather than crowding the bar. */
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  transition: transform 0.5s var(--ease);
}

.brand:hover img {
  transform: rotate(-6deg) scale(1.07);
}

.brand__name {
  font-size: 1.06rem;
  line-height: 1.1;
}

.brand__name small {
  display: block;
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted-2);
}

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

.nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.28rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--green), #fff, var(--red));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.nav a:hover,
.nav a.is-active {
  color: var(--text);
}

.nav a:hover::after,
.nav a.is-active::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Language switch --------------------------------------------------------- */

.ap-lang {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.ap-lang button {
  padding: 0.34rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.ap-lang button[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), #d8e2ff);
  color: #0b1020;
}

/* Scroll progress --------------------------------------------------------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 101;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--green), #fff 50%, var(--red));
}

/* Mobile nav -------------------------------------------------------------- */

.burger {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  position: relative;
}

.burger span {
  position: absolute;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transform: translateX(-50%);
  transition: transform 0.4s var(--ease), opacity 0.25s var(--ease);
}

.burger span:nth-child(1) {
  top: 15px;
}
.burger span:nth-child(2) {
  top: 21px;
}
.burger span:nth-child(3) {
  top: 27px;
}

.burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateX(-50%) translateY(6px) rotate(45deg);
}
.burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateX(-50%) translateY(-6px) rotate(-45deg);
}

.mobile-nav {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 99;
  padding: 1.6rem var(--gutter) 2.5rem;
  background: rgba(5, 9, 26, 0.97);
  backdrop-filter: blur(20px);
  display: grid;
  align-content: start;
  gap: 0.3rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease),
    visibility 0.4s;
}

.mobile-nav.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.mobile-nav a {
  padding: 0.95rem 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.15rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(10px);
}

.mobile-nav.is-open a {
  animation: navIn 0.5s var(--ease) forwards;
}

.mobile-nav .store-row {
  margin-top: 1.5rem;
}

@keyframes navIn {
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding-top: calc(var(--header-h) + clamp(2.5rem, 6vw, 5rem));
  padding-bottom: clamp(3rem, 7vw, 6rem);
  overflow: hidden;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero__copy {
  position: relative;
  z-index: 2;
}

.hero h1 {
  margin-bottom: 1.35rem;
}

.hero .lead {
  margin-bottom: 2rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.95rem 0.42rem 0.45rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
}

.pill b {
  color: var(--text);
  font-weight: 700;
}

.pill__dot {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--green), #0b7f4c);
  font-size: 0.7rem;
}

.pill__dot::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #eaffe9;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  animation: pulse 2.4s var(--ease-io) infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
  }
  70% {
    box-shadow: 0 0 0 11px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

.hero__note {
  margin-top: 1.15rem;
  font-size: 0.85rem;
  color: var(--muted-2);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.hero__note svg {
  margin-top: 4px;
  flex: none;
}

/* Hero stage — phone + orbiting sign chips -------------------------------- */

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(26rem, 46vw, 38rem);
}

.stage__glow {
  position: absolute;
  width: 118%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(47, 107, 255, 0.35),
    rgba(47, 107, 255, 0) 62%
  );
  filter: blur(12px);
  animation: breathe 9s var(--ease-io) infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.09);
    opacity: 1;
  }
}

/* Rotating dashed ring — a roundabout behind the phone. */
.stage__ring {
  position: absolute;
  width: min(30rem, 92%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  animation: spin 46s linear infinite;
}

.stage__ring--2 {
  width: min(38rem, 116%);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.06);
  animation-duration: 70s;
  animation-direction: reverse;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Phone ------------------------------------------------------------------- */

.phone {
  position: relative;
  width: min(19rem, 74vw);
  aspect-ratio: 9 / 19.5;
  padding: 11px;
  border-radius: 3rem;
  background: linear-gradient(160deg, #33405f, #0d1223 42%, #313d59);
  box-shadow: 0 50px 90px -40px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.09) inset;
  transform-style: preserve-3d;
  will-change: transform;
}

.phone__screen {
  position: relative;
  height: 100%;
  border-radius: 2.35rem;
  overflow: hidden;
  background: #0b1020;
}

.phone__screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.85s var(--ease), transform 1.4s var(--ease);
}

.phone__screen img.is-live {
  opacity: 1;
  transform: none;
}

/* Floating sign chips ----------------------------------------------------- */

.chip {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.95rem;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(11, 17, 40, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: 0 22px 45px -25px #000;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  will-change: transform;
  animation: float 7s var(--ease-io) infinite;
}

.chip small {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted-2);
}

.chip__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  flex: none;
}

.chip--1 {
  top: 11%;
  left: -4%;
  animation-delay: -0.4s;
}
.chip--2 {
  top: 43%;
  right: -8%;
  animation-delay: -2.6s;
}
.chip--3 {
  bottom: 12%;
  left: -8%;
  animation-delay: -4.7s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-13px);
  }
}

/* --------------------------------------------------------------------------
   8. Marquee (road-sign ticker)
   -------------------------------------------------------------------------- */

.marquee {
  position: relative;
  padding-block: 1.15rem;
  border-block: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 9%,
    #000 91%,
    transparent
  );
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}

.marquee__track {
  display: flex;
  width: max-content;
  gap: 2.6rem;
  animation: slide 42s linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

@keyframes slide {
  to {
    transform: translateX(-50%);
  }
}

.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.marquee__item svg {
  width: 22px;
  height: 22px;
  flex: none;
}

/* --------------------------------------------------------------------------
   9. Stats
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.stat {
  position: relative;
  padding: clamp(1.5rem, 3vw, 2.3rem);
  background: rgba(9, 14, 34, 0.9);
  text-align: center;
  transition: background-color 0.45s var(--ease);
}

.stat:hover {
  background: rgba(18, 26, 58, 0.95);
}

.stat__num {
  font-size: clamp(1.9rem, 1.2rem + 2.3vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(160deg, #fff, #93a7dd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat__label {
  margin-top: 0.5rem;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   10. Cards / features
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: clamp(1rem, 1.8vw, 1.5rem);
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  position: relative;
  padding: clamp(1.5rem, 2.6vw, 2.1rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.062),
    rgba(255, 255, 255, 0.018)
  );
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease),
    box-shadow 0.5s var(--ease);
}

/* Cursor-tracked highlight; --mx/--my are set in JS. It sits above the card
   background but below the content, which is lifted by the rule underneath. */
.card > * {
  position: relative;
  z-index: 1;
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    18rem 18rem at var(--mx, 50%) var(--my, 0%),
    rgba(255, 255, 255, 0.12),
    transparent 68%
  );
  transition: opacity 0.5s var(--ease);
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--line-hi);
  box-shadow: 0 34px 60px -38px rgba(0, 0, 0, 0.95);
}

.card:hover::before {
  opacity: 1;
}

.card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 1.2rem;
  border-radius: 16px;
  background: var(--icon-bg, rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 0.55s var(--ease);
}

.card:hover .card__icon {
  transform: translateY(-3px) rotate(-5deg) scale(1.06);
}

.card__icon svg {
  width: 26px;
  height: 26px;
}

.card h3 {
  margin-bottom: 0.6rem;
}

.card p {
  color: var(--muted);
  font-size: 0.96rem;
}

.card__tag {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd869, #f0a800);
  color: #241900;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Icon tints */
.i-blue {
  --icon-bg: linear-gradient(140deg, rgba(47, 107, 255, 0.4), rgba(47, 107, 255, 0.12));
  color: #a9c2ff;
}
.i-green {
  --icon-bg: linear-gradient(140deg, rgba(0, 166, 90, 0.42), rgba(0, 166, 90, 0.12));
  color: #86eeb9;
}
.i-red {
  --icon-bg: linear-gradient(140deg, rgba(229, 48, 60, 0.42), rgba(229, 48, 60, 0.12));
  color: #ffabb1;
}
.i-gold {
  --icon-bg: linear-gradient(140deg, rgba(255, 197, 61, 0.42), rgba(255, 197, 61, 0.12));
  color: #ffde96;
}
.i-violet {
  --icon-bg: linear-gradient(140deg, rgba(139, 92, 246, 0.42), rgba(139, 92, 246, 0.12));
  color: #cdb8ff;
}

/* --------------------------------------------------------------------------
   11. Screenshot gallery
   -------------------------------------------------------------------------- */

.shots {
  display: flex;
  gap: clamp(1rem, 2vw, 1.6rem);
  padding: 0.5rem calc(50vw - min(50vw, var(--wrap) / 2)) 2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
}

.shots::-webkit-scrollbar {
  display: none;
}

.shots.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.shot {
  position: relative;
  flex: 0 0 auto;
  width: min(17.5rem, 68vw);
  border-radius: 26px;
  border: 1px solid var(--line);
  overflow: hidden;
  scroll-snap-align: center;
  background: #0a0f22;
  transition: transform 0.55s var(--ease), border-color 0.55s var(--ease),
    box-shadow 0.55s var(--ease);
}

.shot img {
  width: 100%;
  aspect-ratio: 1183 / 2560;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.shot:hover {
  transform: translateY(-8px) scale(1.012);
  border-color: var(--line-hi);
  box-shadow: 0 40px 70px -40px #000;
}

.shot__cap {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.85rem;
  padding: 0.7rem 0.95rem;
  border-radius: 15px;
  background: rgba(6, 10, 26, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  font-size: 0.86rem;
  font-weight: 700;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}

.shot:hover .shot__cap,
.shot:focus-within .shot__cap {
  transform: none;
  opacity: 1;
}

.shots-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-size: 0.83rem;
  color: var(--muted-2);
}

.shots-hint svg {
  animation: nudge 2.6s var(--ease-io) infinite;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
}

/* --------------------------------------------------------------------------
   12. Steps (how it works)
   -------------------------------------------------------------------------- */

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.2rem, 3vw, 2.4rem);
}

/* The dashed lane line that threads the three steps together. */
.steps::before {
  content: "";
  position: absolute;
  top: 34px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.28) 0 14px,
    transparent 14px 30px
  );
  animation: lane 1.4s linear infinite;
}

@keyframes lane {
  to {
    background-position-x: 30px;
  }
}

.step {
  position: relative;
  text-align: center;
}

.step__num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 1.35rem;
  border-radius: 50%;
  border: 1px solid var(--line-hi);
  background: linear-gradient(160deg, #141d40, #080d20);
  font-size: 1.45rem;
  font-weight: 800;
  box-shadow: 0 18px 40px -22px #000;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.step:hover .step__num {
  transform: translateY(-5px) scale(1.06);
  box-shadow: 0 24px 46px -20px rgba(47, 107, 255, 0.7);
}

.step h3 {
  margin-bottom: 0.55rem;
}

.step p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 30ch;
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   13. Split feature blocks (AI teacher, accounts)
   -------------------------------------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.split--flip .split__media {
  order: -1;
}

.split__media {
  position: relative;
  display: grid;
  place-items: center;
}

.split__media img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: 0 48px 90px -50px #000;
}

.checks {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.8rem;
}

.checks li {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  color: var(--muted);
  font-size: 0.98rem;
}

.checks svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 3px;
  color: var(--green);
}

/* Chat mock -------------------------------------------------------------- */

.chat {
  width: min(26rem, 100%);
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(170deg, rgba(20, 28, 60, 0.9), rgba(8, 12, 30, 0.9));
  box-shadow: 0 42px 80px -46px #000;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.95rem;
}

.chat__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--violet), #4c1d95);
}

.chat__status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.chat__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  animation: pulse 2.4s infinite;
}

.bubble {
  max-width: 88%;
  margin-bottom: 0.7rem;
  padding: 0.78rem 1rem;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(10px);
}

.bubble.is-in {
  animation: bubbleIn 0.55s var(--ease) forwards;
}

@keyframes bubbleIn {
  to {
    opacity: 1;
    transform: none;
  }
}

.bubble--me {
  margin-left: auto;
  border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, #3b78ff, #1b46d6);
  color: #fff;
}

.bubble--ai {
  border-bottom-left-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  color: var(--text);
}

.bubble--ai b {
  color: var(--gold);
}

.bubble--typing {
  display: inline-flex;
  gap: 5px;
  padding: 1rem;
}

.bubble--typing i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  animation: typing 1.3s var(--ease-io) infinite;
}

.bubble--typing i:nth-child(2) {
  animation-delay: 0.18s;
}
.bubble--typing i:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   14. Books
   -------------------------------------------------------------------------- */

.book {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 3.5vw, 3rem);
  align-items: center;
  padding: clamp(1.5rem, 3vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.015)
  );
  transition: transform 0.55s var(--ease), border-color 0.55s var(--ease),
    box-shadow 0.55s var(--ease);
}

.book:hover {
  transform: translateY(-5px);
  border-color: var(--line-hi);
  box-shadow: 0 40px 80px -46px #000;
}

.book__cover {
  position: relative;
  perspective: 1200px;
}

/* Capped so a tall cover does not stretch the whole card and strand the copy
   in the middle of a lot of empty space. */
.book__cover img {
  width: 100%;
  max-width: 21rem;
  margin-inline: auto;
  border-radius: 12px;
  box-shadow: 0 34px 60px -32px rgba(0, 0, 0, 0.95);
  transition: transform 0.7s var(--ease);
}

.book:hover .book__cover img {
  transform: rotateY(-9deg) rotateX(3deg) translateZ(18px);
}

.book h3 {
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.8rem);
  margin-bottom: 0.7rem;
}

.book p {
  color: var(--muted);
  font-size: 0.97rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.15rem 0 1.5rem;
}

.tag {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   15. Course banner
   -------------------------------------------------------------------------- */

.course {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.8rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(1.6rem, 3.4vw, 3rem);
  border: 1px solid rgba(0, 166, 90, 0.35);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    150deg,
    rgba(0, 166, 90, 0.16),
    rgba(9, 14, 34, 0.5) 55%,
    rgba(229, 48, 60, 0.14)
  );
  overflow: hidden;
}

.course__price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  margin: 0.4rem 0 1.2rem;
  font-size: clamp(2.6rem, 1.8rem + 3vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--gold);
}

.course__price small {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.schedule {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
}

.schedule li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.68rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.93rem;
  font-weight: 600;
}

.schedule b {
  margin-left: auto;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.course__media img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 40px 70px -44px #000;
}

/* --------------------------------------------------------------------------
   15b. Flashcards band
   -------------------------------------------------------------------------- */

.quizband {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(1.8rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(1.6rem, 3.4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    150deg,
    rgba(47, 107, 255, 0.16),
    rgba(9, 14, 34, 0.5) 58%,
    rgba(139, 92, 246, 0.15)
  );
}

.quizband__copy .lead {
  max-width: 46ch;
}

/* The six chapter colours from the flashcard page, so the band previews what
   the reader is about to open. */
.quizband__tags {
  display: grid;
  gap: 0.55rem;
}

.quizband__tags li {
  position: relative;
  padding: 0.62rem 0.95rem 0.62rem 2.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
}

.quizband__tags li::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--t);
}

@media (max-width: 900px) {
  .quizband {
    grid-template-columns: minmax(0, 1fr);
  }

  .quizband__tags {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .quizband__tags {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   16. Partners
   -------------------------------------------------------------------------- */

.partners {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

.partner {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  transition: transform 0.45s var(--ease), border-color 0.45s var(--ease),
    background-color 0.45s var(--ease);
}

.partner:hover {
  transform: translateY(-4px);
  border-color: var(--line-hi);
  background: rgba(255, 255, 255, 0.06);
}

.partner img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: #fff;
  padding: 6px;
  flex: none;
}

.partner strong {
  display: block;
  font-size: 1.02rem;
}

.partner span {
  font-size: 0.87rem;
  color: var(--muted);
}

.partner__go {
  margin-left: auto;
  color: var(--muted-2);
  transition: transform 0.45s var(--ease), color 0.45s var(--ease);
}

.partner:hover .partner__go {
  transform: translateX(4px);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   17. FAQ
   -------------------------------------------------------------------------- */

.faq {
  max-width: 52rem;
  margin-inline: auto;
  display: grid;
  gap: 0.75rem;
}

.qa {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
  transition: border-color 0.4s var(--ease), background-color 0.4s var(--ease);
}

.qa.is-open {
  border-color: var(--line-hi);
  background: rgba(255, 255, 255, 0.06);
}

.qa__q {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border: 0;
  background: none;
  text-align: left;
  font-size: 1.01rem;
  font-weight: 700;
  cursor: pointer;
}

.qa__icon {
  margin-left: auto;
  flex: none;
  position: relative;
  width: 20px;
  height: 20px;
}

.qa__icon::before,
.qa__icon::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.45s var(--ease);
}

.qa__icon::after {
  transform: rotate(90deg);
}

.qa.is-open .qa__icon::after {
  transform: rotate(0);
}

.qa__a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease);
}

.qa.is-open .qa__a {
  grid-template-rows: 1fr;
}

.qa__a > div {
  overflow: hidden;
}

.qa__a p {
  padding: 0 1.35rem 1.3rem;
  color: var(--muted);
  font-size: 0.96rem;
}

/* --------------------------------------------------------------------------
   18. Final CTA
   -------------------------------------------------------------------------- */

.cta {
  position: relative;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 5vw, 4rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(47, 107, 255, 0.22), rgba(6, 10, 26, 0.7) 60%);
  text-align: center;
  overflow: hidden;
}

/* Moving lane markings across the CTA floor. */
.cta__road {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 92px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
  overflow: hidden;
}

.cta__road::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 30px;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.55) 0 42px,
    transparent 42px 92px
  );
  animation: lane2 1.1s linear infinite;
}

@keyframes lane2 {
  to {
    background-position-x: -92px;
  }
}

.cta .store-row {
  justify-content: center;
  margin-top: 2rem;
}

.cta__mini {
  margin-top: 1.4rem;
  font-size: 0.85rem;
  color: var(--muted-2);
}

/* --------------------------------------------------------------------------
   19. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(4, 7, 20, 0.75);
  padding-block: clamp(2.8rem, 5vw, 4.2rem) 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: clamp(1.6rem, 3vw, 2.6rem);
  margin-bottom: 2.6rem;
}

.footer-grid h4 {
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 1rem;
}

.footer-grid li + li {
  margin-top: 0.55rem;
}

.footer-grid a {
  color: var(--muted);
  font-size: 0.94rem;
  transition: color 0.3s var(--ease), padding-left 0.3s var(--ease);
}

.footer-grid a:hover {
  color: var(--text);
  padding-left: 4px;
}

.footer-about p {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.93rem;
  max-width: 38ch;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.8rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted-2);
}

.tricolore {
  display: inline-flex;
  height: 10px;
  width: 42px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}

.tricolore i {
  flex: 1;
}
.tricolore i:nth-child(1) {
  background: var(--green);
}
.tricolore i:nth-child(2) {
  background: #fff;
}
.tricolore i:nth-child(3) {
  background: var(--red);
}

.disclaimer {
  margin-top: 1.4rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.83rem;
  color: var(--muted-2);
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   20. Floating mobile download bar
   -------------------------------------------------------------------------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 95;
  display: none;
  align-items: center;
  gap: 0.7rem;
  width: min(100% - 1.6rem, 30rem);
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  background: rgba(8, 13, 32, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 50px -22px #000;
  transform: translate(-50%, 140%);
  transition: transform 0.6s var(--ease);
}

.dock.is-up {
  transform: translate(-50%, 0);
}

.dock__txt {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}

.dock__txt small {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted-2);
}

.dock .btn {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   20b. Course popup

   Shown once on arrival, after the hero has had a moment to land. Dismissal is
   remembered, so it never becomes the thing people close every visit.
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: clamp(0.9rem, 3vw, 2rem);
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 18, 0.78);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}

.modal__card {
  position: relative;
  width: min(38rem, 100%);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  border: 1px solid var(--line-hi);
  border-radius: var(--radius-lg);
  background: linear-gradient(170deg, #101a3c, #070c1f 62%);
  box-shadow: 0 50px 100px -40px #000;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.modal.is-open .modal__backdrop {
  opacity: 1;
}

.modal.is-open .modal__card {
  opacity: 1;
  transform: none;
}

.modal__x {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 10, 26, 0.72);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.35s var(--ease), background-color 0.35s var(--ease);
}

.modal__x:hover {
  transform: rotate(90deg);
  background: rgba(229, 48, 60, 0.85);
}

.modal__art {
  display: block;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}

.modal__art img {
  width: 100%;
  height: auto;
  transition: transform 0.7s var(--ease);
}

.modal__art:hover img {
  transform: scale(1.02);
}

.modal__body {
  padding: clamp(1.2rem, 3vw, 1.8rem);
}

.modal__body .eyebrow {
  margin-bottom: 0.7rem;
}

.modal__body p {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.3rem;
}

.modal__actions .btn {
  flex: 1 1 12rem;
}

.modal__fine {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--muted-2);
  text-align: center;
}

@media (max-width: 560px) {
  .modal__actions .btn {
    flex: 1 1 100%;
  }
}

/* --------------------------------------------------------------------------
   21. Scroll reveal
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.85s var(--ease), transform 0.85s var(--ease);
  transition-delay: var(--delay, 0ms);
}

[data-reveal="left"] {
  transform: translateX(-30px);
}

[data-reveal="right"] {
  transform: translateX(30px);
}

[data-reveal="zoom"] {
  transform: scale(0.94);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Without JavaScript nothing would ever get .is-in, so the whole page would be
   invisible. The inline script in <head> drops .no-js the moment JS runs. */
.no-js [data-reveal] {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   22. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .nav {
    display: none;
  }

  .burger {
    display: block;
  }

  .header-actions .btn--primary {
    display: none;
  }

  .hero__grid,
  .split,
  .book,
  .course {
    grid-template-columns: minmax(0, 1fr);
  }

  .split--flip .split__media,
  .book__cover {
    order: 0;
  }

  .split__media {
    order: -1;
  }

  .book__cover {
    max-width: 20rem;
    margin-inline: auto;
  }

  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero .lead,
  .section-head .lead {
    max-width: none;
  }
}

@media (max-width: 720px) {
  :root {
    --header-h: 76px;
  }

  /* Still much larger than before, but sized to a phone bar. */
  .brand img {
    width: 58px;
    height: 58px;
  }

  .grid--3,
  .grid--2,
  .partners {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.8rem;
  }

  .steps::before {
    display: none;
  }

  /* On a narrow screen the chips sit on top of the screenshot rather than
     beside it, so the phone reads better alone. The same numbers appear in
     the stats strip directly below. */
  .chip {
    display: none;
  }

  .brand__name {
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .ap-lang button {
    padding: 0.3rem 0.5rem;
    font-size: 0.72rem;
  }

  .dock {
    display: flex;
  }

  .site-footer {
    padding-bottom: 6rem;
  }

  .brand__name small {
    display: none;
  }

  .store-row .store-btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 420px) {
  .chip {
    font-size: 0.74rem;
    padding: 0.5rem 0.7rem;
  }

  .chip__icon {
    width: 28px;
    height: 28px;
  }
}

/* --------------------------------------------------------------------------
   23. Reduced motion — keep the layout, drop the movement.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  /* Only the live frame, not every stacked screenshot — otherwise the last
     one in the DOM paints over the one that is meant to be showing. */
  .phone__screen img.is-live {
    opacity: 1;
    transform: none;
  }

  .bubble {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   24. Print
   -------------------------------------------------------------------------- */

@media print {
  body::before,
  body::after,
  .site-header,
  .dock,
  .progress,
  .marquee {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* --------------------------------------------------------------------------
   25. Document pages — privacy, terms, support

   Long-form reading, so this trades the homepage's density for a comfortable
   measure, a persistent contents rail, and generous vertical rhythm.
   -------------------------------------------------------------------------- */

.doc-hero {
  padding-top: calc(var(--header-h) + clamp(2.5rem, 5vw, 4rem));
  padding-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.doc-hero h1 {
  font-size: clamp(2.1rem, 1.4rem + 2.8vw, 3.4rem);
  margin-bottom: 1rem;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.1rem;
  font-size: 0.87rem;
  color: var(--muted-2);
}

.doc-meta__stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-weight: 600;
  color: var(--muted);
}

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  padding-bottom: clamp(3rem, 6vw, 6rem);
}

/* Contents rail ----------------------------------------------------------- */

.toc {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  padding: 1.2rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.toc h2 {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.85rem;
}

.toc ol {
  list-style: none;
  counter-reset: toc;
  display: grid;
  gap: 0.15rem;
}

.toc a {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 9px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.toc a:hover,
.toc a.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* Prose ------------------------------------------------------------------- */

.prose {
  max-width: 46rem;
}

.prose section + section {
  margin-top: clamp(2.2rem, 4vw, 3.2rem);
}

.prose h2 {
  font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.72rem);
  margin-bottom: 0.9rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.prose h3 {
  font-size: 1.06rem;
  margin: 1.6rem 0 0.6rem;
}

.prose p,
.prose li {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.78;
}

.prose p + p {
  margin-top: 0.95rem;
}

.prose ul {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0 0;
}

.prose ul li {
  position: relative;
  padding-left: 1.4rem;
}

.prose ul li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--gold);
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose a:not(.btn) {
  color: #9dbaff;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.3s var(--ease);
}

.prose a:not(.btn):hover {
  color: #fff;
}

/* A callout for the things people must not miss: not a government service,
   how to actually delete an account. */
.note {
  margin-top: 1.3rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  background: rgba(255, 197, 61, 0.06);
}

.note p {
  color: var(--text);
  font-size: 0.95rem;
}

.note--danger {
  border-left-color: var(--red);
  background: rgba(229, 48, 60, 0.07);
}

.note--ok {
  border-left-color: var(--green);
  background: rgba(0, 166, 90, 0.07);
}

/* Definition-style rows for "what we collect" tables. */
.data-table {
  width: 100%;
  margin-top: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 0.8rem 0.95rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 700;
}

.data-table td {
  color: var(--muted);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
    top: auto;
  }

  .toc ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    display: grid;
  }
}

@media (max-width: 560px) {
  .toc ol {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   26. Sign-in page (/login)
   -------------------------------------------------------------------------- */

.auth-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.auth {
  width: min(27rem, 100%);
}

.auth__card {
  padding: clamp(1.6rem, 4vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(170deg, rgba(20, 28, 60, 0.92), rgba(8, 12, 30, 0.92));
  box-shadow: 0 42px 90px -50px #000;
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.6rem;
}

.auth__brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.auth__sub {
  margin-top: 0.5rem;
  margin-bottom: 1.6rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth__error {
  margin-bottom: 1.2rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(229, 48, 60, 0.45);
  border-left-width: 3px;
  border-radius: 12px;
  background: rgba(229, 48, 60, 0.1);
  font-size: 0.92rem;
  line-height: 1.6;
}

.field {
  display: block;
  margin-bottom: 1.1rem;
}

.field__label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.field__input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.field__input:focus {
  outline: none;
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.08);
}

.field__hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.79rem;
  color: var(--muted-2);
}

.auth__help,
.auth__foot {
  margin-top: 1.4rem;
  font-size: 0.86rem;
  color: var(--muted-2);
  line-height: 1.7;
}

.auth__help a,
.auth__foot a {
  color: #9dbaff;
}

.auth__foot {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* A fold whose summary reads as a button — used for the admin import, which is
   needed once an intake and would otherwise push the daily controls off screen. */
.admin-fold__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.25s var(--ease);
}

.admin-fold__btn::-webkit-details-marker { display: none; }
.admin-fold__btn:hover { background: rgba(255, 255, 255, 0.09); }
.admin-fold[open] > .admin-fold__btn { margin-bottom: 1.2rem; }
.admin-fold__btn svg { transition: transform 0.3s var(--ease); }
.admin-fold[open] > .admin-fold__btn svg { transform: rotate(45deg); }

/* --------------------------------------------------------------------------
   26b. Intro video
   -------------------------------------------------------------------------- */

.vid {
  position: relative;
  max-width: 62rem;
  margin-inline: auto;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line-hi);
  background: #05070f;
  box-shadow: 0 40px 90px -50px #000;
  aspect-ratio: 16 / 9;
}

.vid__el {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The browser's own play button is a small grey lozenge. This is the one that
   sits on the poster; it hides itself once playback starts and hands over to
   the native controls. */
.vid__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(47, 107, 255, 0.94);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 18px 44px -14px rgba(47, 107, 255, 0.9);
  transition: transform 0.3s var(--ease), background-color 0.3s var(--ease);
}

.vid__play svg { width: 34px; height: 34px; margin-left: 3px; }

.vid__play::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 999px;
  border: 2px solid rgba(47, 107, 255, 0.55);
  animation: vid-pulse 2.4s var(--ease) infinite;
}

@keyframes vid-pulse {
  0%   { transform: scale(1);    opacity: 0.85; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

.vid__play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(47, 107, 255, 1);
}

.vid__play:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.vid.is-playing .vid__play { display: none; }

@media (prefers-reduced-motion: reduce) {
  .vid__play::after { animation: none; }
}

@media (max-width: 640px) {
  .vid { border-radius: 16px; }
  .vid__play { width: 64px; height: 64px; }
  .vid__play svg { width: 26px; height: 26px; }
}

/* --------------------------------------------------------------------------
   27. PDF library (/amarpatentepdf)
   -------------------------------------------------------------------------- */

/* A definite height, not a minimum.
   With min-height the flex children have nothing to be constrained against, so
   .lib grows to fit its content instead of filling the viewport — which is why
   the sidebar ran off the bottom of the page rather than scrolling inside
   itself, and why the page was taller than the window after signing in. */
.lib-body {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lib-top {
  /* backdrop-filter makes this element a stacking context, which traps the
     account panel's z-index inside the header. .lib comes later in the DOM, so
     the reader's iframe was painting over the panel however high that z-index
     went. Lifting the whole header above .lib is what actually fixes it. */
  position: relative;
  z-index: 50;
  /* Margin rather than transform: the bar is a flex item, and a transform
     would slide it out of sight while still holding its space. */
  transition: margin-top 0.3s var(--ease);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem clamp(0.9rem, 2.5vw, 1.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 26, 0.9);
  backdrop-filter: blur(14px);
  flex: none;
}

.lib-top .brand img {
  width: 52px;
  height: 52px;
  flex: none;
}

/* Every item in the bar has to be allowed to shrink. Without min-width:0 a
   flex child refuses to go below its content width, so a long name pushed the
   account button past the edge and wrapped onto a second line instead of
   ellipsising — which then made the bar taller than the sidebar expected. */
.lib-top .brand {
  min-width: 0;
  margin-right: 0;   /* the account's margin-left:auto does the pushing */
}

.lib-top .brand__name,
.lib-user__name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lib-user__name {
  max-width: 14ch;
}

.lib-top__toggle {
  display: inline-flex;   /* on a phone it opens the list, on a desktop it folds it away */
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 700;
  font-size: 0.87rem;
  cursor: pointer;
}

.lib-top__user {
  margin-left: auto;
}

/* Reading down a lesson hides the bar and gives the words the room; coming
   back up returns it. The height is measured once and published as a variable,
   because it changes with the breakpoint. */
.lib-body.is-hushed .lib-top {
  margin-top: calc(var(--lib-top-h, 64px) * -1);
}

@media (prefers-reduced-motion: reduce) {
  .lib-top { transition: none; }
}

/* Account menu ------------------------------------------------------------ */

.lib-user {
  position: relative;
}

.lib-user summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem 0.4rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  font-weight: 700;
}

.lib-user summary::-webkit-details-marker {
  display: none;
}

.lib-user__avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b78ff, #1b46d6);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.lib-user__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 40;
  width: min(21rem, 80vw);
  padding: 1.1rem;
  border: 1px solid var(--line-hi);
  border-radius: 18px;
  background: rgba(10, 15, 36, 0.98);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 60px -30px #000;
}

.lib-user__phone {
  font-weight: 700;
  margin-bottom: 1rem;
}

.lib-user__panel h3 {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.6rem;
}

.lib-sessions {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.lib-sessions li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.82rem;
}

.lib-sessions strong {
  font-variant-numeric: tabular-nums;
}

.lib-sessions span {
  color: var(--muted-2);
}

.lib-user__note {
  margin-bottom: 1rem;
  font-size: 0.79rem;
  line-height: 1.6;
  color: var(--muted-2);
}

/* Two-pane layout --------------------------------------------------------- */

.lib {
  position: relative;   /* the phone sidebar is absolute inside this box */
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
  min-height: 0;   /* lets the grid shrink so the panes can scroll */
  overflow: hidden;
}

/* Folding the chapter list away. Only above the breakpoint: below it the
   sidebar is already an overlay and the same button opens and closes it. */
@media (min-width: 901px) {
  .lib {
    transition: grid-template-columns 0.32s var(--ease);
  }

  .lib.is-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .lib.is-collapsed .lib-side {
    border-right: 0;
    overflow: hidden;
  }
}

.lib-side {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  overflow-y: auto;
  overscroll-behavior: contain;   /* scrolling the list must not scroll the page */
  min-height: 0;
  height: 100%;
}

.lib-side__head {
  padding: 1.1rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(8, 12, 30, 0.96);
  backdrop-filter: blur(10px);
  z-index: 2;
}

.lib-side__head h2 {
  font-size: 1rem;
}

.lib-side__head p {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted-2);
}

.lib-side__head .btn {
  margin-top: 0.7rem;
}

.lib-chapters {
  padding: 0.6rem;
}

/* A chapter is a heading, a file is something inside it. They were two rows of
   the same size with the same 30px rounded-square icon, so at a glance the list
   read as one flat list and there was no telling which was which. An open
   chapter now becomes a titled box and its files hang off a rail inside it. */
.lib-ch {
  border: 1px solid transparent;
  border-radius: 12px;
  margin-bottom: 0.25rem;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.lib-ch[open] {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.022);
  margin-bottom: 0.5rem;
}

.lib-ch > summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.25s var(--ease);
}

.lib-ch > summary::-webkit-details-marker {
  display: none;
}

.lib-ch > summary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lib-ch[open] > summary {
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
}

.lib-ch__n {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.lib-ch[open] .lib-ch__n {
  background: linear-gradient(135deg, #3b78ff, #1b46d6);
  border-color: transparent;
  color: #fff;
}

.lib-ch__txt {
  min-width: 0;
  display: grid;
}

.lib-ch__txt strong {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.lib-ch__txt small {
  font-size: 0.76rem;
  color: var(--muted-2);
}

.lib-ch__count {
  margin-left: auto;
  flex: none;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding-inline: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.lib-ch.is-empty > summary {
  opacity: 0.45;
}

.lib-ch__none {
  padding: 0.3rem 0.7rem 0.8rem 3.1rem;
  font-size: 0.8rem;
  color: var(--muted-2);
}

/* The rail. It runs down the left of the file list and stops at the last one,
   so the files are visibly held by the chapter above them. */
.lib-docs {
  position: relative;
  padding: 0.45rem 0.45rem 0.5rem 1.5rem;
  display: grid;
  gap: 0.15rem;
}

.lib-docs::before {
  content: "";
  position: absolute;
  left: 0.92rem;
  top: 0.55rem;
  bottom: 0.65rem;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(rgba(47, 107, 255, 0.55), rgba(47, 107, 255, 0.06));
}

.lib-doc {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.lib-doc:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lib-doc.is-active {
  background: rgba(47, 107, 255, 0.16);
  border-color: rgba(47, 107, 255, 0.5);
}

/* Round and smaller than the chapter's square number badge — shape alone is
   enough to tell the two levels apart without reading anything. */
.lib-doc__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  background: rgba(229, 48, 60, 0.16);
  color: #ff9ba1;
}

.lib-doc__icon svg {
  width: 14px;
  height: 14px;
}

/* HTML lessons read differently from a scanned PDF, so they look different. */
.lib-doc__icon--html {
  background: rgba(47, 107, 255, 0.18);
  color: #a9c2ff;
}

.lib-doc__txt {
  min-width: 0;
  display: grid;
}

.lib-doc__txt strong {
  font-size: 0.83rem;
  font-weight: 500;
  line-height: 1.35;
}

.lib-doc.is-active .lib-doc__txt strong {
  font-weight: 700;
}

.lib-doc__txt small {
  font-size: 0.74rem;
  color: var(--muted-2);
}

/* Reader ------------------------------------------------------------------ */

.lib-main {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.lib-view {
  position: relative;   /* the loading bar and pill are placed against this */
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Opening a lesson --------------------------------------------------------
   A lesson is 2-3 MB and the server watermarks it on the way out, so the wait
   is seconds. The bar says the click was heard; the pill says what is
   happening. Both sit above the reader without covering the title, so you can
   still see which lesson is on its way. */
.lib-loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;   /* never swallows a click meant for the page */
}

.lib-loading__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
}

.lib-loading__bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38%;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, #3b78ff 35%, #8fb0ff 65%, transparent);
  animation: lib-sweep 1.15s var(--ease) infinite;
}

@keyframes lib-sweep {
  from { left: -38%; }
  to   { left: 100%; }
}

.lib-loading__txt {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.2rem;
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  background: rgba(10, 15, 36, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 50px -24px #000;
  font-size: 0.86rem;
  font-weight: 700;
}

.lib-loading__txt::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 2px solid rgba(143, 176, 255, 0.28);
  border-top-color: #8fb0ff;
  animation: lib-spin 0.7s linear infinite;
}

@keyframes lib-spin {
  to { transform: rotate(360deg); }
}

/* The old lesson dims, so it is obvious the pane is between documents rather
   than showing something stale. */
.lib-view.is-loading .lib-frame {
  opacity: 0.3;
}

.lib-frame {
  transition: opacity 0.25s var(--ease);
}

/* The row you clicked spins in place, which answers "did it take my click?"
   without looking away from the sidebar. */
.lib-doc.is-loading .lib-doc__icon {
  position: relative;
  color: transparent;
}

.lib-doc.is-loading .lib-doc__icon::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  border: 2px solid rgba(169, 194, 255, 0.3);
  border-top-color: #a9c2ff;
  animation: lib-spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .lib-loading__bar span,
  .lib-loading__txt::before,
  .lib-doc.is-loading .lib-doc__icon::after {
    animation: none;
  }
  .lib-loading__bar span { left: 0; width: 100%; }
}

.lib-doc-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem clamp(0.9rem, 2vw, 1.4rem);
  border-bottom: 1px solid var(--line);
}

/* The title column, not the button, is what gives when space runs out. */
.lib-doc-head > div {
  min-width: 0;
}

.lib-doc-head .h-card {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lib-doc-head__ch {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.lib-doc-head .btn {
  margin-left: auto;
  flex: none;
}

/* The pen is a desktop tool, hidden everywhere else.
   Two reasons, both practical: drawing wants a pointer that can be placed
   precisely, and while the pen is on the overlay swallows touch events — so on
   a phone turning it on would stop the lesson scrolling. The capability query
   is the honest test; a width alone would arm it on a tablet held in landscape. */
#penToggle,
#penColours,
#penReset {
  display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) {
  #penToggle,
  #penReset {
    display: grid;
  }

  #penColours {
    display: flex;
  }
}

/* Reader tools: pen, colours, clear, open-in-tab. */
.lib-tools {
  margin-left: auto;
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lib-tool {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease),
              border-color 0.25s var(--ease);
}

.lib-tool:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.lib-tool.is-on {
  color: #fff;
  background: rgba(47, 107, 255, 0.22);
  border-color: rgba(47, 107, 255, 0.62);
}

.lib-swatches {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.lib-sw {
  width: 22px;
  height: 22px;
  flex: none;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--sw);
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}

.lib-sw:hover { transform: scale(1.12); }

/* The chosen colour gets a ring, not just a size change — a size change alone
   is invisible to anyone who cannot see the difference between the swatches. */
.lib-sw.is-on {
  border-color: #fff;
  transform: scale(1.12);
}

/* Icon only. The label was the widest thing in the bar and said something the
   arrow says on its own; the words stay as a tooltip and for screen readers. */
.lib-doc-head__open {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease),
              border-color 0.25s var(--ease);
}

.lib-doc-head__open:hover {
  color: var(--text);
  background: rgba(47, 107, 255, 0.16);
  border-color: rgba(47, 107, 255, 0.5);
}

.lib-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #1a1f2e;
  min-height: 0;
}

.lib-empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.lib-empty__art {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-bottom: 1.3rem;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-2);
}

.lib-empty p {
  margin-top: 0.6rem;
  max-width: 34ch;
  font-size: 0.93rem;
}

@media (max-width: 900px) {
  .lib {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Absolute inside .lib, not fixed to the viewport. The old `inset: 64px`
     assumed a bar exactly that tall; a wrapped name or a larger font made the
     bar taller and the sidebar slid up underneath it, hiding the first
     chapter. Anchoring to .lib means it always starts wherever the bar
     actually ends. */
  .lib-side {
    position: absolute;
    inset: 0;
    z-index: 30;
    border-right: 0;
    background: rgba(6, 10, 26, 0.98);
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease);
  }

  .lib-side.is-open {
    transform: none;
  }

  .lib-top {
    gap: 0.65rem;
  }

  .lib-top .brand img {
    width: 42px;
    height: 42px;
  }

  .lib-top .brand__name {
    font-size: 0.95rem;
  }

  /* "PDF লাইব্রেরি" is what makes the wordmark two lines tall. */
  .lib-top .brand__name small {
    display: none;
  }

  .lib-top__toggle {
    padding: 0.5rem 0.85rem;
  }

  .lib-user__name {
    max-width: 9ch;
  }

  .lib-doc-head {
    flex-wrap: wrap;
    padding: 0.7rem 0.95rem;
    gap: 0.7rem;
  }

  .lib-doc-head .h-card {
    font-size: 1rem;
  }
}

/* Phones. The account button becomes just its avatar — the name is one tap
   away in the panel it opens, and dropping it buys back enough width to keep
   the wordmark. */
@media (max-width: 540px) {
  .lib-top {
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
  }

  .lib-top .brand img {
    width: 38px;
    height: 38px;
  }

  .lib-user__name {
    display: none;
  }

  .lib-top .brand__name {
    font-size: 0.9rem;
  }

  .lib-user summary {
    padding: 0.28rem;
  }

  .lib-top__toggle {
    padding: 0.45rem 0.75rem;
    font-size: 0.83rem;
  }

  .lib-doc-head {
    padding: 0.65rem 0.85rem;
  }

  .lib-doc-head .h-card {
    font-size: 0.95rem;
  }

  .lib-tools { gap: 0.3rem; }

  .lib-tool {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .lib-doc-head__open {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .lib-sw { width: 19px; height: 19px; }
}

/* Last resort. Logo, chapter button and avatar are the three things the bar
   cannot do without; the wordmark is the one that goes. */
@media (max-width: 400px) {
  .lib-top .brand__name {
    display: none;
  }
}


/* ===========================================================================
   Copyright notice — sign-in page, and a modal in the reader.
   Bengali first: the people who read this page read Bengali.
   =========================================================================== */
.legal-notice {
  margin-top: 1.75rem;
  padding: 1rem 1.15rem 1.1rem;
  border: 1px solid #e3d9c2;
  border-radius: 14px;
  background: #fffdf6;
  font-size: .86rem;
  line-height: 1.6;
  color: #4a4335;
}

.legal-notice__h {
  margin: 0 0 .5rem;
  font-size: .95rem;
  font-weight: 800;
  color: #7a5f16;
}

.legal-notice p { margin: 0 0 .55rem; }
.legal-notice ul { margin: 0 0 .65rem; padding-left: 1.15rem; }
.legal-notice li { margin: .16rem 0; }

.legal-notice__warn { font-weight: 700; color: #8c3b1e; }

.legal-notice__rule {
  border: none;
  border-top: 1px solid #ece3cd;
  margin: .85rem 0;
}

.legal-notice__law {
  margin: .35rem 0 0;
  font-size: .76rem;
  color: #8b8271;
}
.legal-notice__law a { color: #6f6754; }

@media (max-width: 640px) {
  .legal-notice { font-size: .82rem; padding: .9rem 1rem; }
}

/* In the reader: a ! button in the bar and a modal card, never on screen by
   itself after the first visit. */
.lib-top__legal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  margin-left: auto;
  border: 1px solid rgba(217, 180, 88, 0.45);
  border-radius: 50%;
  background: rgba(217, 180, 88, 0.1);
  color: #e6c56e;
  cursor: pointer;
  transition: background-color 0.25s var(--ease);
}

.lib-top__legal:hover { background: rgba(217, 180, 88, 0.2); }

.lib-top__legal + .lib-top__user { margin-left: 0; }

@media (max-width: 540px) {
  .lib-top__legal { width: 34px; height: 34px; }
}

.lib-legal-dlg {
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #fffdf6;
  color: #4a4335;
  box-shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.7);
  overflow: auto;
  overscroll-behavior: contain;
}

.lib-legal-dlg[open] { animation: lib-legal-in 0.28s var(--ease); }

@keyframes lib-legal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

.lib-legal-dlg::backdrop {
  background: rgba(3, 6, 18, 0.72);
  backdrop-filter: blur(4px);
}

.lib-legal-dlg .legal-notice {
  margin: 0;
  padding: 1.1rem 1.15rem 0.3rem;
  border: 0;
  background: none;
}

.lib-legal-dlg .legal-notice__h { padding-right: 2.2rem; }

.lib-legal-dlg__x {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #7d7462;
  cursor: pointer;
}

.lib-legal-dlg__x:hover { background: rgba(0, 0, 0, 0.05); color: #4a4335; }

.lib-legal-dlg__foot { padding: 0.35rem 1.15rem 1.15rem; }

@media (prefers-reduced-motion: reduce) {
  .lib-legal-dlg[open] { animation: none; }
}
