/* =========================================================
   Masar Academy — theme

   Palette (from the brand board): navy #000E26, burgundy #8C2336,
   blush #F2DCD8, silver #BFBFBF, plum #26121F. Dark mode sits on the
   navy with blush-white type and silver secondaries; light mode is
   blush paper with navy ink. Burgundy is the action colour in both;
   rose (a lighter burgundy) does the warm-highlight work, and plum is
   the second gradient stop and the alternate surface. The background is
   a slow route map (js/backdrop.js), never a blurred spotlight.
   ========================================================= */
:root {
  --bg: #000e26;
  --bg-soft: #061a36;
  --bg-raise: #0b1f3f;
  --bg-alt: #26121f;
  --card: rgba(242, 220, 216, 0.03);
  --card-solid: #0a1a38;
  --border: rgba(191, 191, 191, 0.14);
  --border-strong: rgba(191, 191, 191, 0.24);
  --border-hover: rgba(191, 191, 191, 0.42);
  --text: #f6eeec;
  --text-dim: #bfbfbf;
  --text-dimmer: #8b8a93;

  --surface: rgba(242, 220, 216, 0.05);
  --nav-bg: rgba(0, 14, 38, 0.78);
  --menu-bg: rgba(0, 14, 38, 0.94);
  --sheen: rgba(242, 220, 216, 0.3);
  --sheen-soft: rgba(242, 220, 216, 0.05);
  --shadow-color: 0, 6, 20;
  --shadow-1: 0 1px 2px rgba(0, 6, 20, 0.35), 0 12px 32px -20px rgba(0, 6, 20, 0.9);
  --shadow-2: 0 2px 4px rgba(0, 6, 20, 0.35), 0 26px 54px -24px rgba(0, 6, 20, 0.95);

  --navy: #000e26;
  --blue: #c4405a;          /* action colour on dark: burgundy lifted for contrast */
  --blue-soft: #e6a9b3;     /* rose-blush for icons and small accent text */
  --blue-ink: #8c2336;
  --purple: #c98b9c;        /* dusty rose: second stop, dots, chips */
  --purple-ink: #5c2a3e;
  --amber: #e0627a;         /* rose: streaks, stars, warm highlights */
  --amber-soft: #f0a6b4;
  --brand: var(--blue);
  --accent-rgb: 196, 64, 90;
  --warm-rgb: 224, 98, 122;
  --accent-tint: rgba(var(--accent-rgb), 0.16);

  --grad-primary: linear-gradient(135deg, #a92c43 0%, #8c2336 55%, #5a1a2c 100%);
  --grad-amber: linear-gradient(135deg, #c94a63 0%, #8c2336 100%);

  --grid-ink: rgba(191, 191, 191, 0.13);
  --route-ink: rgba(191, 191, 191, 0.13);
  --route-light: #f2dcd8;

  --radius-lg: 1.5rem;
  --radius-md: 1.1rem;
  --radius-sm: 0.75rem;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.2, 0.9, 0.3, 1);

  --font-ar: "Tajawal", "Segoe UI", sans-serif;
  --font-en: "Plus Jakarta Sans", "Segoe UI", sans-serif;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7ece9;
  --bg-soft: #f2dcd8;
  --bg-raise: #ffffff;
  --bg-alt: #26121f;
  --card: rgba(0, 14, 38, 0.03);
  --card-solid: #fffaf9;
  --border: rgba(0, 14, 38, 0.1);
  --border-strong: rgba(0, 14, 38, 0.17);
  --border-hover: rgba(0, 14, 38, 0.32);
  --text: #000e26;
  --text-dim: #4a3f48;
  --text-dimmer: #6f6570;

  --surface: rgba(0, 14, 38, 0.045);
  --nav-bg: rgba(247, 236, 233, 0.84);
  --menu-bg: rgba(247, 236, 233, 0.96);
  --sheen: rgba(255, 255, 255, 0.95);
  --sheen-soft: rgba(0, 14, 38, 0.04);
  --shadow-color: 38, 18, 31;
  --shadow-1: 0 1px 2px rgba(38, 18, 31, 0.07), 0 12px 32px -20px rgba(38, 18, 31, 0.4);
  --shadow-2: 0 2px 4px rgba(38, 18, 31, 0.07), 0 26px 54px -24px rgba(38, 18, 31, 0.45);

  --blue: #8c2336;
  --blue-soft: #8c2336;
  --blue-ink: #6d1a2a;
  --purple: #26121f;
  --purple-ink: #26121f;
  --amber: #a52b42;
  --amber-soft: #b5455a;
  --accent-rgb: 140, 35, 54;
  --warm-rgb: 165, 43, 66;

  --grad-primary: linear-gradient(135deg, #8c2336 0%, #5a1a2c 60%, #26121f 100%);
  --grad-amber: linear-gradient(135deg, #b5455a 0%, #8c2336 100%);

  --grid-ink: rgba(0, 14, 38, 0.1);
  --route-ink: rgba(140, 35, 54, 0.16);
  --route-light: #8c2336;

  color-scheme: light;
}

/* When the theme flips, every colour on the page cross-fades together. */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: background-color 0.7s var(--ease), border-color 0.7s var(--ease), color 0.7s var(--ease),
    fill 0.7s var(--ease), stroke 0.7s var(--ease), box-shadow 0.7s var(--ease) !important;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  line-height: 1.6;
  /* clip, not hidden: nothing becomes a scroll container, so sticky
     bars keep working, and phones never zoom out to fit a stray
     transform or an oversized canvas */
  overflow-x: clip;
  min-height: 100dvh;
}

html[dir="ltr"] body,
html[dir="ltr"] { font-family: var(--font-en); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.3s var(--ease); }

::selection { background: var(--blue); color: #fff; }

/* ---------- Backdrop: the route map ----------
   A vertical wash that breathes very slowly, a dot grid that drifts, and
   three thin routes with a light running along each. Everything is
   position:fixed, behind the page, and costs almost nothing to paint. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 45%, var(--bg) 100%);
  background-size: 100% 300%;
  animation: bg-breathe 26s ease-in-out infinite;
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: -64px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='1.5' cy='1.5' r='1.2' fill='%23bfbfbf'/%3E%3C/svg%3E");
  background-size: 32px 32px;
  opacity: 0.16;
  animation: grid-drift 70s linear infinite;
}
:root[data-theme="light"] .backdrop::after {
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='1.5' cy='1.5' r='1.2' fill='%23000e26'/%3E%3C/svg%3E");
}
.backdrop .routes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translate3d(0, calc(var(--sy, 0) * -0.05px), 0);
  will-change: transform;
}
.routes .route { fill: none; stroke: var(--route-ink); stroke-width: 1.3; stroke-linecap: round; }
.routes .trail {
  fill: none;
  stroke: var(--route-light);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 46 954;
  stroke-dashoffset: 1000;
  opacity: 0.75;
  animation: route-run 18s linear infinite;
}
.routes .t2 { animation-duration: 24s; animation-delay: -9s; }
.routes .t3 { animation-duration: 15s; animation-delay: -4s; }
.routes .node { fill: var(--route-light); opacity: 0.28; transform-box: fill-box; transform-origin: center; animation: node-pulse 4.5s ease-in-out infinite; }
.routes .n2 { animation-delay: -1.2s; }
.routes .n3 { animation-delay: -2.4s; }
.routes .n4 { animation-delay: -3.1s; }
.routes .n5 { animation-delay: -0.6s; }
@keyframes bg-breathe { 0%, 100% { background-position: 50% 0%; } 50% { background-position: 50% 100%; } }
@keyframes grid-drift { to { transform: translate(32px, 32px); } }
@keyframes route-run { to { stroke-dashoffset: 0; } }
@keyframes node-pulse { 0%, 100% { transform: scale(1); opacity: 0.22; } 50% { transform: scale(1.9); opacity: 0.5; } }

/* Thin progress line across the top, driven by --scroll */
.scroll-progress {
  position: fixed; top: 0; inset-inline: 0; height: 2px; z-index: 70;
  background: var(--grad-primary);
  transform: scaleX(var(--scroll, 0));
  transform-origin: 0 50%;
  pointer-events: none;
}
html[dir="rtl"] .scroll-progress { transform-origin: 100% 50%; }

/* Page and nav ease in on load */
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes nav-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
.wrap, .tshell { animation: page-in 0.7s var(--ease-soft) both; }
.nav-wrap { animation: nav-in 0.8s var(--ease-soft) 0.1s both; }

@media (prefers-reduced-motion: reduce) {
  .backdrop::before, .backdrop::after, .routes .trail, .routes .node { animation: none; }
  .routes .trail { stroke-dashoffset: 500; }
  .wrap, .tshell, .nav-wrap { animation: none; }
}

.wrap, footer, .tshell { position: relative; z-index: 2; }   /* everything that is not the route map sits above it */

.container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (min-width: 768px) {
  .container { padding-inline: 2.5rem; }
}

section { padding-block: 5rem; }
@media (min-width: 768px) { section { padding-block: 7.5rem; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.95rem 0.38rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card-solid);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-soft);
  font-weight: 700;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-1);
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber);
  animation: eyebrow-pulse 2.6s ease-in-out infinite;
}
@keyframes eyebrow-pulse { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.5); opacity: 1; } }
html[dir="rtl"] .eyebrow { letter-spacing: 0; padding: 0.38rem 0.8rem 0.38rem 0.95rem; }

.section-head { max-width: 640px; margin-bottom: 3rem; }
.section-head.center { margin-inline: auto; text-align: center; }
/* a short route under every section heading, drawn in when it reveals */
.section-head h2 { position: relative; padding-bottom: 0.9rem; }
.section-head h2::after {
  content: "";
  position: absolute; bottom: 0; inset-inline-start: 0;
  width: 64px; height: 3px; border-radius: 3px;
  background: var(--grad-amber);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.9s var(--ease-soft) 0.25s;
}
html[dir="rtl"] .section-head h2::after { transform-origin: 100% 50%; }
.section-head.center h2::after { inset-inline: 0; margin-inline: auto; transform-origin: 50% 50%; }
.reveal.in h2::after, .section-head.in h2::after { transform: scaleX(1); }

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4 { letter-spacing: 0; }

h2 { font-size: clamp(1.9rem, 3.4vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); }

.lede { color: var(--text-dim); font-size: 1.05rem; max-width: 54ch; }

.grad-text {
  background: linear-gradient(120deg, var(--blue) 0%, var(--purple) 45%, var(--blue) 90%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: grad-shift 9s ease-in-out infinite;
}
@keyframes grad-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
/* the hand-drawn stroke js/backdrop.js places under the hero's highlight */
.grad-text.has-stroke { position: relative; display: inline-block; }
.u-stroke { position: absolute; inset-inline: 0; bottom: -0.16em; width: 100%; height: 0.34em; overflow: visible; }
.u-stroke path {
  fill: none; stroke: var(--amber); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: draw-under 1.1s var(--ease-soft) 0.9s forwards;
}
@keyframes draw-under { to { stroke-dashoffset: 0; } }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0.85rem 0.85rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), background-color 0.45s var(--ease),
    border-color 0.45s var(--ease), color 0.3s var(--ease), background-position 0.7s var(--ease);
}
html[dir="rtl"] .btn { padding: 0.85rem 1.5rem 0.85rem 0.85rem; }
.btn > * { position: relative; z-index: 1; }
/* a light sweeps across on hover */
.btn::after {
  content: "";
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.26) 50%, transparent 62%);
  transform: translateX(-140%);
  transition: transform 0.9s var(--ease);
  pointer-events: none;
}
.btn:hover::after { transform: translateX(140%); }
.btn:active { transform: scale(0.97) !important; }

.btn-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.45s var(--ease), background-color 0.45s var(--ease);
}
.btn-icon svg { width: 16px; height: 16px; }
html[dir="rtl"] .btn-icon svg { transform: scaleX(-1); }

.btn-primary {
  background: var(--grad-primary);
  background-size: 160% 100%;
  background-position: 0% 50%;
  color: #fff;
  box-shadow: 0 8px 22px -12px rgba(var(--accent-rgb), 0.6);
}
.btn-primary .btn-icon { background: rgba(255, 255, 255, 0.18); }
.btn-primary:hover { transform: translateY(-2px); background-position: 100% 50%; box-shadow: 0 14px 30px -12px rgba(var(--accent-rgb), 0.6); }
.btn-primary:hover .btn-icon { transform: translate(3px, -2px) scale(1.06); }
html[dir="rtl"] .btn-primary:hover .btn-icon { transform: translate(-3px, -2px) scale(1.06); }

.btn-ghost {
  background: var(--card-solid);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.btn-ghost .btn-icon { background: var(--surface); }
.btn-ghost:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.btn-ghost:hover .btn-icon { transform: translateX(3px); }
html[dir="rtl"] .btn-ghost:hover .btn-icon { transform: translateX(-3px); }

.btn-sm { padding: 0.6rem 0.6rem 0.6rem 1.1rem; font-size: 0.85rem; }
html[dir="rtl"] .btn-sm { padding: 0.6rem 1.1rem 0.6rem 0.6rem; }
.btn-sm .btn-icon { width: 1.7rem; height: 1.7rem; }
.btn-sm .btn-icon svg { width: 13px; height: 13px; }

/* ---------- Nav ---------- */
.nav-wrap {
  position: fixed;
  top: 1.1rem;
  inset-inline: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding-inline: 1rem;
  pointer-events: none;
}
.nav {
  pointer-events: auto;
  width: min(100%, 1080px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.6rem 0.55rem 1.2rem;
  border-radius: 999px;
  background: var(--nav-bg);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(22px);
  box-shadow: 0 20px 40px -24px rgba(var(--shadow-color), 0.6);
  transition: padding 0.4s var(--ease), background 0.4s var(--ease), border-color 0.4s var(--ease);
}
html[dir="rtl"] .nav { padding: 0.55rem 1.2rem 0.55rem 0.6rem; }

.logo { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.05rem; }
.logo-mark {
  width: 2.15rem; height: 2.15rem; border-radius: 0.8rem;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem; font-weight: 800;
  box-shadow: inset 0 1px 1px var(--sheen);
}

.nav-links { display: none; align-items: center; gap: 1.9rem; font-size: 0.9rem; color: var(--text-dim); }
.nav-links a { transition: color 0.3s var(--ease); }
.nav-links a:hover { color: var(--text); }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.lang-switch, .theme-toggle {
  display: flex; align-items: center; gap: 0.15rem;
  padding: 0.3rem; border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 800;
}
.theme-toggle { padding: 0.3rem; }
.theme-toggle button {
  width: 1.9rem; height: 1.9rem; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dimmer);
  transition: all 0.35s var(--ease);
}
.theme-toggle button.active { background: var(--card-solid); color: var(--amber-soft); box-shadow: 0 4px 10px -4px rgba(var(--shadow-color), 0.5); }
.theme-toggle button:last-child.active { color: var(--blue-soft); }
.theme-toggle svg { width: 15px; height: 15px; }
.lang-switch button {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  color: var(--text-dimmer);
  transition: all 0.35s var(--ease);
}
.lang-switch button.active { background: var(--card-solid); color: var(--text); box-shadow: 0 4px 10px -4px rgba(var(--shadow-color), 0.5); }

.burger {
  width: 2.4rem; height: 2.4rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
}
.burger-lines { position: relative; width: 15px; height: 10px; }
.burger-lines span {
  position: absolute; inset-inline: 0; height: 1.5px; background: var(--text);
  border-radius: 2px; transition: transform 0.5s var(--ease), opacity 0.3s var(--ease), top 0.4s var(--ease);
}
.burger-lines span:nth-child(1) { top: 0; }
.burger-lines span:nth-child(2) { top: 4.5px; }
.burger-lines span:nth-child(3) { top: 9px; }
.nav.open .burger-lines span:nth-child(1) { top: 4.5px; transform: rotate(45deg); }
.nav.open .burger-lines span:nth-child(2) { opacity: 0; }
.nav.open .burger-lines span:nth-child(3) { top: 4.5px; transform: rotate(-45deg); }

@media (min-width: 960px) {
  .nav-links { display: flex; }
  .burger { display: none; }
}

.mobile-menu {
  position: fixed; inset: 0; z-index: 45;
  background: var(--menu-bg);
  backdrop-filter: blur(28px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.6rem;
  opacity: 0; visibility: hidden; transition: opacity 0.5s var(--ease);
}
.mobile-menu.open { opacity: 1; visibility: visible; }
.mobile-menu a {
  font-size: 1.6rem; font-weight: 800;
  opacity: 0; transform: translateY(3rem);
  transition: transform 0.6s var(--ease-soft), opacity 0.6s var(--ease-soft);
}
.mobile-menu.open a { opacity: 1; transform: translateY(0); }
.mobile-menu.open a:nth-child(1) { transition-delay: 0.08s; }
.mobile-menu.open a:nth-child(2) { transition-delay: 0.14s; }
.mobile-menu.open a:nth-child(3) { transition-delay: 0.2s; }
.mobile-menu.open a:nth-child(4) { transition-delay: 0.26s; }
.mobile-menu.open a:nth-child(5) { transition-delay: 0.32s; }
.mobile-menu.open a:nth-child(6) { transition-delay: 0.38s; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(1.6rem); transition: opacity 0.8s var(--ease-soft), transform 0.8s var(--ease-soft); }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-1 { transition-delay: 0.05s; }
.reveal-2 { transition-delay: 0.14s; }
.reveal-3 { transition-delay: 0.23s; }
.reveal-4 { transition-delay: 0.32s; }

/* ---------- Cards ----------
   One surface with a real shadow and a hairline of light along the top
   edge. The outer .bezel is kept in the markup for layout but no longer
   draws a second ring. */
.bezel {
  padding: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  border: 0;
}
.bezel-inner {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--card-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  height: 100%;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), border-color 0.5s var(--ease);
}
.bezel-inner::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent 8%, var(--sheen) 50%, transparent 92%);
  opacity: 0.55;
  pointer-events: none;
}
.bezel:hover > .bezel-inner { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--border-strong); }

/* ---------- Hero ---------- */
.hero {
  /* just clear the floating nav, then let the content set the height */
  padding-top: 8rem;
  padding-bottom: 3.25rem;
  min-height: 0;
  display: flex;
  align-items: center;
}
/* the section right after the hero should not add a second tall gap */
.hero + section { padding-top: 3.5rem; }
@media (max-width: 640px) { .hero { padding-top: 6.5rem; padding-bottom: 2.5rem; } }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}
@media (min-width: 1024px) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; gap: 2rem; }
}

.hero h1 { font-size: clamp(2.4rem, 5.6vw, 3.9rem); margin-bottom: 1.4rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.2rem; }

.trust-row { display: flex; align-items: center; gap: 1rem; margin-top: 2.6rem; flex-wrap: wrap; }
.avatars { display: flex; }
.avatars span {
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 2px solid var(--bg);
  margin-inline-start: -0.6rem;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; color: #fff;
}
.avatars span:first-child { margin-inline-start: 0; }
.trust-row .stars { color: var(--amber); font-size: 0.85rem; letter-spacing: 0.1em; }
.trust-row small { display: block; color: var(--text-dimmer); font-size: 0.78rem; }

/* Hero dashboard mock */
.dash {
  position: relative;
}
.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.9rem;
}
.dash-card { padding: 1.15rem 1.3rem; }
.dash-card .label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dimmer); font-weight: 700; margin-bottom: 0.6rem; }
html[dir="rtl"] .dash-card .label { letter-spacing: 0; }
.dash-span2 { grid-column: 1 / -1; }

.progress-track { height: 8px; border-radius: 999px; background: var(--border-strong); overflow: hidden; margin-top: 0.7rem; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--grad-primary); width: 0%; transition: width 1.4s var(--ease-soft); }

.streak-num { font-size: 1.9rem; font-weight: 800; }
.streak-num span { font-size: 1.1rem; }

.tasks-list { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.85rem; color: var(--text-dim); }
.tasks-list li { display: flex; align-items: center; gap: 0.5rem; }
.tasks-list i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-soft); flex-shrink: 0; }

.badge-count { font-size: 1.9rem; font-weight: 800; color: var(--amber); }

.dash-float {
  position: absolute; bottom: -1.2rem; inset-inline-start: -1.2rem;
  padding: 0.7rem 1rem;
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.78rem; font-weight: 700;
  animation: floaty 5s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,0.18); }

/* ---------- Stat bar ---------- */
.stats { padding-block: 3rem 0; }
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
}
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--bg-soft); padding: 1.6rem 1rem; text-align: center; }
.stat .num { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; }
.stat .num span { background: var(--grad-amber); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .cap { font-size: 0.78rem; color: var(--text-dimmer); margin-top: 0.35rem; }

/* ---------- Problem cards: a pile you swipe through ----------
   All cards sit in one spot; the top one is fully visible and the next
   few peek out beneath it, offset and slightly turned, like a photo
   stack. Drag the top card aside (or tap it) and it slides to the back. */
.stack-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.stack {
  position: relative; width: min(100%, 440px); height: 250px; outline: none;
  touch-action: pan-y; user-select: none;
}
.stack:focus-visible { outline: 2px solid var(--blue); outline-offset: 10px; border-radius: var(--radius-md); }
.stack-card {
  position: absolute; inset: 0; margin: 0;
  padding: 1.5rem 1.5rem 1.4rem; border-radius: var(--radius-md);
  background: var(--card-solid); border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; gap: 0.7rem;
  transform: translate(var(--x, 0px), var(--y, 0px)) rotate(var(--r, 0deg)) scale(var(--s, 1));
  opacity: var(--o, 1);
  transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.4s ease, box-shadow 0.3s ease;
  will-change: transform;
  cursor: grab;
}
.stack-card.dragging { transition: none; cursor: grabbing; }
.stack-card.leaving { transition: transform 0.45s cubic-bezier(0.4, 0, 0.8, 0.4), opacity 0.35s ease; }
.stack-card[data-depth="0"] { z-index: 6; }
.stack-card[data-depth="1"] { z-index: 5; }
.stack-card[data-depth="2"] { z-index: 4; }
.stack-card[data-depth="3"] { z-index: 3; }
.stack-card[data-depth="4"] { z-index: 2; }
.stack-card[data-depth="5"] { z-index: 1; }
.stack-card h3 { font-size: 1.1rem; font-weight: 800; line-height: 1.4; }
.stack-card p { font-size: 0.9rem; color: var(--text-dim); line-height: 1.7; margin: 0; }
.stack-nav { display: flex; align-items: center; gap: 0.9rem; }
.stack-count { font-size: 0.82rem; color: var(--text-dimmer); font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: center; }
.stack-count b { color: var(--text); font-weight: 800; }
.stack-hint { margin: 0; }
.deck-ico {
  width: 2.6rem; height: 2.6rem; border-radius: 0.9rem; display: flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb), 0.14); color: var(--purple);
}
.deck-ico svg { width: 20px; height: 20px; }
.deck-btn {
  flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.deck-btn:hover { border-color: var(--border-strong); background: var(--card-solid); }
.deck-btn svg { width: 16px; height: 16px; }
@media (max-width: 520px) { .stack { height: 280px; } }
@media (prefers-reduced-motion: reduce) { .stack-card { transition: none; } }

.solution-line {
  margin-top: 2.6rem; padding: 1.6rem 1.8rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.12), rgba(var(--accent-rgb),0.1));
  border: 1px solid var(--border-strong);
  font-size: 1.05rem; font-weight: 700;
}

/* ---------- Bento features ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
}
@media (min-width: 700px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1080px) {
  .bento { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; }
  .bento .bezel.big { grid-column: span 2; grid-row: span 2; }
}
.feature-card { padding: 1.6rem; display: flex; flex-direction: column; gap: 0.9rem; min-height: 100%; }
.big .feature-card { padding: 2rem; justify-content: space-between; }
.f-icon {
  width: 2.9rem; height: 2.9rem; border-radius: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb),0.14); color: var(--blue-soft);
}
.f-icon svg { width: 20px; height: 20px; }
.feature-card h3 { font-size: 1.05rem; }
.feature-card p { color: var(--text-dim); font-size: 0.88rem; }

/* ---------- Spotlight (editorial split) ---------- */
.spotlight { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
@media (min-width: 960px) { .spotlight { grid-template-columns: 1fr 1fr; gap: 3.5rem; } }
.spotlight-before {
  padding: 1.4rem; border-radius: var(--radius-md);
  background: var(--card); border: 1px dashed var(--border-strong);
  color: var(--text-dimmer); font-size: 0.95rem; text-decoration: line-through; text-decoration-color: var(--border-strong);
}
.spotlight-after {
  margin-top: 1rem; padding: 1.6rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(var(--warm-rgb),0.14), rgba(var(--accent-rgb),0.08));
  border: 1px solid rgba(var(--warm-rgb),0.3);
  font-size: 1.15rem; font-weight: 700;
}
.subject-pills { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; }
.subject-pills span {
  display: inline-block;
  padding: 0.5rem 1rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--card); border: 1px solid var(--border); color: var(--text-dim);
  transition: all 0.4s var(--ease);
}
.subject-pills a:hover span { border-color: var(--blue); color: var(--text); transform: translateY(-2px); }

/* ---------- Journey ---------- */
.journey { display: grid; grid-template-columns: repeat(1,1fr); gap: 1rem; counter-reset: step; }
@media (min-width: 700px) { .journey { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 1080px) { .journey { grid-template-columns: repeat(5,1fr); } }
.step { padding: 1.3rem; }
.step-num {
  counter-increment: step;
  width: 2.4rem; height: 2.4rem; border-radius: 0.8rem;
  background: var(--grad-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 0.9rem;
}
.step h4 { font-size: 0.92rem; margin-bottom: 0.3rem; }
.step p { font-size: 0.78rem; color: var(--text-dimmer); }

/* ---------- AI Chat mock ---------- */
.ai-layout { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
@media (min-width: 960px) { .ai-layout { grid-template-columns: 0.9fr 1.1fr; gap: 3.5rem; } }
.prompt-chip-list { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.6rem; }
.prompt-chip { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem 1.1rem; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); font-size: 0.88rem; color: var(--text-dim); }
.prompt-chip svg { width: 15px; height: 15px; color: var(--blue-soft); flex-shrink: 0; }

.chat-mock { padding: 1.4rem; display: flex; flex-direction: column; gap: 0.9rem; min-height: 360px; }
.chat-head { display: flex; align-items: center; gap: 0.7rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--border); }
.chat-avatar { width: 2.3rem; height: 2.3rem; border-radius: 0.8rem; background: var(--grad-primary); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 0.85rem; }
.chat-head strong { font-size: 0.9rem; display: block; }
.chat-head small { color: var(--text-dimmer); font-size: 0.72rem; display: flex; align-items: center; gap: 0.35rem; }
.chat-body {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.7rem;
  flex: 1; height: 300px; overflow: hidden;
  /* older bubbles slip out of the top, the way a real thread scrolls */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%);
  mask-image: linear-gradient(to bottom, transparent, #000 14%);
}
@keyframes bubble-in {
  0%   { opacity: 0; transform: translateY(12px) scale(0.94); }
  70%  { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-body .bubble { animation: bubble-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1) both; transform-origin: 50% 100%; }
.chat-body.fading .bubble { animation: none; transition: opacity 0.35s ease; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .chat-body .bubble { animation: none; } }
.bubble { max-width: 82%; padding: 0.75rem 1rem; border-radius: 1.1rem; font-size: 0.86rem; line-height: 1.5; }
.bubble.user { align-self: flex-end; background: var(--grad-primary); color: #fff; border-bottom-right-radius: 0.3rem; }
html[dir="rtl"] .bubble.user { border-bottom-right-radius: 1.1rem; border-bottom-left-radius: 0.3rem; }
.bubble.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 0.3rem; }
html[dir="rtl"] .bubble.ai { border-bottom-left-radius: 1.1rem; border-bottom-right-radius: 0.3rem; }
.typing { display: inline-flex; gap: 3px; align-items: center; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-dimmer); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* ---------- Live / Community / Gamification icon rows ---------- */
.icon-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }
.icon-pill { display: flex; align-items: center; gap: 0.55rem; padding: 0.65rem 1.05rem; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.icon-pill svg { width: 15px; height: 15px; color: var(--amber-soft); }

.two-col { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
@media (min-width: 960px) { .two-col { grid-template-columns: 1fr 1fr; gap: 3.5rem; } }
.two-col.reverse .col-visual { order: -1; }
@media (min-width: 960px) { .two-col.reverse .col-visual { order: 2; } }

.gami-card { padding: 1.5rem; display: flex; align-items: center; gap: 1rem; }
.gami-avatar { width: 3.1rem; height: 3.1rem; border-radius: 0.9rem; background: var(--grad-amber); flex-shrink: 0; }
.gami-name { font-weight: 800; font-size: 1rem; }
.gami-meta { color: var(--text-dimmer); font-size: 0.8rem; margin-top: 0.2rem; }
.xp-bar { height: 6px; border-radius: 999px; background: var(--border-strong); margin-top: 0.7rem; overflow: hidden; }
.xp-fill { height: 100%; width: 68%; border-radius: 999px; background: var(--grad-amber); }

.badge-row { display: flex; gap: 0.6rem; margin-top: 1.2rem; }
.badge-row .b { width: 2.6rem; height: 2.6rem; border-radius: 0.7rem; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: var(--surface); border: 1px solid var(--border); }

/* ---------- Certificate ---------- */
.cert { padding: 1.6rem; position: relative; overflow: hidden; }
.cert-inner { border: 1px dashed var(--border-strong); border-radius: 1rem; padding: 1.8rem; text-align: center; position: relative; }
.cert-seal { width: 3.4rem; height: 3.4rem; margin-inline: auto 0; border-radius: 50%; background: var(--grad-amber); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; margin-bottom: 1rem; }
.cert-name { font-size: 1.25rem; font-weight: 800; margin: 0.4rem 0; }
.cert-meta { color: var(--text-dimmer); font-size: 0.78rem; display: flex; justify-content: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.cert-qr { width: 2.6rem; height: 2.6rem; border-radius: 0.4rem; background:
  repeating-conic-gradient(#e5e9f2 0% 25%, var(--navy) 0% 50%) 0 0 / 6px 6px;
  margin-inline: auto; margin-top: 1rem; }

/* ---------- Teacher side ---------- */
.trend-up { font-size: 0.78rem; font-weight: 800; color: #34d399; background: rgba(52,211,153,0.12); padding: 0.2rem 0.5rem; border-radius: 999px; }
.mini-bars { display: flex; align-items: flex-end; gap: 0.35rem; height: 44px; margin-top: 0.9rem; }
.mini-bars span { flex: 1; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--blue-soft), rgba(var(--accent-rgb),0.15)); }
.mini-bars span:last-child { background: linear-gradient(180deg, var(--amber-soft), rgba(var(--warm-rgb),0.2)); }

.compare-wrap { max-width: 900px; margin-inline: auto; }
.compare-row { display: grid; grid-template-columns: 1fr; gap: 0.9rem; align-items: center; }
@media (min-width: 760px) { .compare-row { grid-template-columns: 1fr auto 1fr; } }
.compare-card { padding: 1.4rem 1.6rem; border-radius: var(--radius-md); background: var(--card); border: 1px solid var(--border); }
.compare-card.highlight { background: linear-gradient(135deg, rgba(var(--accent-rgb),0.14), rgba(var(--accent-rgb),0.12)); border-color: rgba(96,165,250,0.35); }
.compare-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dimmer); font-weight: 800; margin-bottom: 0.5rem; }
html[dir="rtl"] .compare-label { letter-spacing: 0; }
.compare-value { font-size: 0.98rem; font-weight: 700; }
.compare-arrow { display: flex; align-items: center; justify-content: center; color: var(--blue-soft); }
.compare-arrow svg { width: 22px; height: 22px; transform: rotate(90deg); }
@media (min-width: 760px) { .compare-arrow svg { transform: none; } html[dir="rtl"] .compare-arrow svg { transform: scaleX(-1); } }
.compare-result { text-align: center; margin-top: 1.6rem; font-weight: 800; font-size: 1.05rem; color: var(--amber-soft); }

.split-cols { display: grid; grid-template-columns: 1fr; gap: 1.6rem; }
@media (min-width: 560px) { .split-cols { grid-template-columns: 1fr 1fr; } }
.split-head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dimmer); font-weight: 800; margin-bottom: 0.9rem; }
html[dir="rtl"] .split-head { letter-spacing: 0; }

/* ---------- Admin panel ---------- */
.status-badge { display: inline-block; padding: 0.28rem 0.7rem; border-radius: 999px; font-size: 0.68rem; font-weight: 800; white-space: nowrap; flex-shrink: 0; }
.status-badge.ok { background: rgba(52,211,153,0.14); color: #34d399; }
.status-badge.pending { background: rgba(var(--warm-rgb),0.14); color: var(--amber-soft); }
.status-badge.flag { background: rgba(251,113,133,0.14); color: #fb7185; }

.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: none; padding-bottom: 0.2rem; }
.admin-row .meta { color: var(--text-dimmer); font-size: 0.76rem; margin-top: 0.25rem; }

/* ---------- Instructor ---------- */
.instructor { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
@media (min-width: 960px) { .instructor { grid-template-columns: 0.8fr 1.2fr; gap: 3.5rem; } }
.instructor-photo { aspect-ratio: 4/5; border-radius: var(--radius-lg); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.instructor-photo svg { width: 46%; opacity: 0.9; }

.cred-list { display: grid; gap: 0.9rem; margin-top: 1.6rem; }
.cred-list li { display: flex; gap: 0.8rem; align-items: flex-start; font-size: 0.92rem; color: var(--text-dim); }
.cred-list svg { width: 18px; height: 18px; color: var(--blue-soft); flex-shrink: 0; margin-top: 0.15rem; }

/* ---------- Testimonials ---------- */
.testi-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
@media (min-width: 800px) { .testi-grid { grid-template-columns: repeat(3, 1fr); } }
.testi-card { padding: 1.6rem; display: flex; flex-direction: column; gap: 1rem; }
.testi-stars { color: var(--amber); font-size: 0.8rem; letter-spacing: 0.15em; }
.testi-card p { font-size: 0.92rem; color: var(--text-dim); }
.testi-person { display: flex; align-items: center; gap: 0.7rem; margin-top: auto; }
.testi-avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--grad-primary); flex-shrink: 0; }
.testi-person strong { font-size: 0.85rem; display: block; }
.testi-person small { color: var(--text-dimmer); font-size: 0.75rem; }

/* ---------- Pricing ---------- */
.price-toggle { display: flex; align-items: center; justify-content: center; gap: 0.9rem; margin-bottom: 2.6rem; }
.switch { width: 3.1rem; height: 1.7rem; border-radius: 999px; background: var(--card-solid); border: 1px solid var(--border-strong); position: relative; padding: 0.15rem; cursor: pointer; }
.switch .knob { display: block; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--grad-primary); transition: transform 0.4s var(--ease); }
.switch:disabled { cursor: not-allowed; opacity: 0.6; }
.switch.on .knob { transform: translateX(1.4rem); }
html[dir="rtl"] .switch.on .knob { transform: translateX(-1.4rem); }
.save-tag { font-size: 0.7rem; font-weight: 800; color: var(--amber-soft); background: rgba(var(--warm-rgb),0.12); padding: 0.2rem 0.55rem; border-radius: 999px; }

.price-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
@media (min-width: 860px) { .price-grid { grid-template-columns: repeat(3, 1fr); align-items: stretch; } }
.price-card { padding: 2rem; display: flex; flex-direction: column; height: 100%; }
.price-card.featured .bezel-inner, .price-card.featured { position: relative; }
.price-card.featured { transform: translateY(-0.5rem); }
.price-card.featured .bezel-inner { border-color: rgba(var(--accent-rgb),0.5); box-shadow: 0 0 0 1px rgba(var(--accent-rgb),0.25), inset 0 1px 1px var(--sheen-soft); }
.price-badge { position: absolute; top: -0.9rem; inset-inline-start: 50%; transform: translateX(-50%); background: var(--grad-primary); padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.7rem; font-weight: 800; white-space: nowrap; }
html[dir="rtl"] .price-badge { transform: translateX(50%); }
.price-amount { font-size: 2.4rem; font-weight: 800; margin: 0.8rem 0 0.2rem; }
.price-amount span { font-size: 0.95rem; color: var(--text-dimmer); font-weight: 600; }
.price-list { display: grid; gap: 0.65rem; margin: 1.6rem 0 2rem; flex: 1; }
.price-list li { display: flex; gap: 0.6rem; align-items: center; font-size: 0.86rem; color: var(--text-dim); }
.price-list svg { width: 15px; height: 15px; color: #34d399; flex-shrink: 0; }
.price-card .btn { width: 100%; justify-content: center; }

/* ---------- FAQ ---------- */
.faq-list { display: flex; flex-direction: column; gap: 0.8rem; max-width: 800px; margin-inline: auto; }
.faq-item { border-radius: var(--radius-md); overflow: hidden; }
.faq-q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.5rem; text-align: start; font-weight: 700; font-size: 0.98rem; }
.faq-q .plus { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface); flex-shrink: 0; position: relative; transition: transform 0.4s var(--ease), background 0.4s var(--ease); }
.faq-q .plus::before, .faq-q .plus::after { content: ""; position: absolute; background: var(--text); top: 50%; left: 50%; }
.faq-q .plus::before { width: 8px; height: 1.5px; transform: translate(-50%,-50%); }
.faq-q .plus::after { width: 1.5px; height: 8px; transform: translate(-50%,-50%); transition: opacity 0.3s var(--ease); }
.faq-item.open .plus { transform: rotate(180deg); background: var(--blue); }
.faq-item.open .plus::after { opacity: 0; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.5s var(--ease-soft); }
.faq-a p { padding: 0 1.5rem 1.3rem; color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Final CTA ---------- */
.cta-band { text-align: center; padding: 3.5rem 2rem; border-radius: var(--radius-lg); background: linear-gradient(135deg, rgba(var(--accent-rgb),0.16), rgba(var(--accent-rgb),0.14)); border: 1px solid var(--border-strong); position: relative; overflow: hidden; }
.cta-band h2 { max-width: 30ch; margin-inline: auto 1.2rem; }
.cta-band .lede { margin-inline: auto; margin-bottom: 2rem; }

/* ---------- Footer ---------- */
footer { padding-block: 4rem 2.5rem; border-top: 1px solid var(--border); }
.foot-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; }
@media (min-width: 800px) { .foot-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.foot-brand p { color: var(--text-dimmer); font-size: 0.88rem; margin-top: 0.8rem; max-width: 30ch; }
.foot-col h5 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dimmer); margin-bottom: 1rem; }
html[dir="rtl"] .foot-col h5 { letter-spacing: 0; }
.foot-col ul { display: grid; gap: 0.6rem; }
.foot-col a { color: var(--text-dim); font-size: 0.9rem; transition: color 0.3s var(--ease); }
.foot-col a:hover { color: var(--text); }
.foot-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--border); color: var(--text-dimmer); font-size: 0.8rem; }
.social-row { display: flex; gap: 0.6rem; }
.social-row a { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--border); }
.social-row svg { width: 14px; height: 14px; }

/* ---------- Misc ---------- */
.skip-link { position: absolute; top: -100px; left: 1rem; background: var(--blue); color: #fff; padding: 0.6rem 1rem; border-radius: 0.5rem; z-index: 100; }
.skip-link:focus { top: 1rem; }

/* Hero card, signed-out: feature tiles instead of invented numbers */
.hero-tile { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 0.9rem; color: var(--text); }
.hero-tile svg { color: var(--blue-soft); flex-shrink: 0; }
.hero-signin { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; font-size: 0.86rem; color: var(--text-dim); }
.tasks-list a { color: var(--text-dim); text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tasks-list a:hover { color: var(--text); }
.t-kind { font-size: 0.66rem; font-weight: 700; color: var(--text-dimmer); flex-shrink: 0; }
a.dash-float { text-decoration: none; color: inherit; }

/* ---------- Hero cards: a single soft drop, then a slow float ----------
   Fall from above with a spring landing (one small overshoot), a faint
   squash on impact, staggered per card. After landing the cards drift
   very slightly so the panel feels alive without looping the fall. */
@keyframes hero-drop {
  0%   { transform: translateY(-120px); opacity: 0; }
  55%  { transform: translateY(7px);    opacity: 1; }
  78%  { transform: translateY(-4px); }
  100% { transform: translateY(0);      opacity: 1; }
}
@keyframes hero-land {
  0%, 50% { transform: scale(1); }
  60%     { transform: scale(1.025, 0.965); }
  76%     { transform: scale(0.992, 1.008); }
  100%    { transform: scale(1); }
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
#heroPanel .bezel {
  opacity: 0;
  animation: hero-drop 0.95s cubic-bezier(0.2, 0.9, 0.3, 1) both,
             hero-float 7s ease-in-out 1.4s infinite;
  will-change: transform, opacity;
}
#heroPanel .bezel > .bezel-inner {
  animation: hero-land 0.95s ease-out both;
  transform-origin: 50% 100%;
}
#heroPanel .dash-grid > .bezel:nth-child(1) { animation-delay: 0.05s, 2.9s; }
#heroPanel .dash-grid > .bezel:nth-child(2) { animation-delay: 0.5s, 3.4s; }
#heroPanel .dash-grid > .bezel:nth-child(3) { animation-delay: 0.95s, 3.9s; }
#heroPanel .dash-grid > .bezel:nth-child(4) { animation-delay: 1.4s, 4.4s; }
#heroPanel .dash-grid > .bezel:nth-child(5) { animation-delay: 1.85s, 4.9s; }
#heroPanel .dash-float { animation-delay: 2.3s, 5.4s; }
#heroPanel .dash-grid > .bezel:nth-child(1) > .bezel-inner { animation-delay: 0.05s; }
#heroPanel .dash-grid > .bezel:nth-child(2) > .bezel-inner { animation-delay: 0.5s; }
#heroPanel .dash-grid > .bezel:nth-child(3) > .bezel-inner { animation-delay: 0.95s; }
#heroPanel .dash-grid > .bezel:nth-child(4) > .bezel-inner { animation-delay: 1.4s; }
#heroPanel .dash-grid > .bezel:nth-child(5) > .bezel-inner { animation-delay: 1.85s; }
#heroPanel .dash-float > .bezel-inner { animation-delay: 2.3s; }
.hero { overflow: visible; }
@media (prefers-reduced-motion: reduce) {
  #heroPanel .bezel, #heroPanel .bezel > .bezel-inner { animation: none; opacity: 1; }
}

/* ---------- Pop-up cards: scale in with a spring when scrolled into view ---------- */
@keyframes pop-up {
  0%   { opacity: 0; transform: scale(0.55) translateY(28px); }
  60%  { opacity: 1; transform: scale(1.05) translateY(-4px); }
  80%  { transform: scale(0.985) translateY(1px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
[data-pop] > .bezel { opacity: 0; transform: scale(0.55) translateY(28px); will-change: transform, opacity; }
[data-pop].pop-in > .bezel { animation: pop-up 0.75s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
[data-pop].pop-in > .bezel:nth-child(1) { animation-delay: 0s; }
[data-pop].pop-in > .bezel:nth-child(2) { animation-delay: 0.09s; }
[data-pop].pop-in > .bezel:nth-child(3) { animation-delay: 0.18s; }
[data-pop].pop-in > .bezel:nth-child(4) { animation-delay: 0.27s; }
[data-pop].pop-in > .bezel:nth-child(5) { animation-delay: 0.36s; }
[data-pop].pop-in > .bezel:nth-child(6) { animation-delay: 0.45s; }
[data-pop].pop-in > .bezel:nth-child(7) { animation-delay: 0.54s; }
[data-pop].pop-in > .bezel:nth-child(8) { animation-delay: 0.63s; }
[data-pop] > .bezel { transition: transform 0.25s ease, box-shadow 0.25s ease; }
[data-pop].pop-in > .bezel:hover { transform: translateY(-4px) scale(1.01); }
@media (prefers-reduced-motion: reduce) {
  [data-pop] > .bezel { opacity: 1; transform: none; animation: none !important; }
}

/* ---------- Community card: the streak plays out ----------
   The bar fills, the day count ticks up by one, and the flame pops. */
.xp-fill { transition: width 1.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.xp-fill.drain { transition: width 0.45s ease-in; }
.gami-fire { display: inline-flex; vertical-align: middle; transform-origin: 50% 80%; }
@keyframes fire-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.7) rotate(-10deg); color: var(--amber); filter: drop-shadow(0 0 10px rgba(var(--warm-rgb), 0.9)); }
  60%  { transform: scale(0.9) rotate(4deg); }
  80%  { transform: scale(1.15); color: var(--amber); }
  100% { transform: scale(1); }
}
.gami-fire.pop { animation: fire-pop 0.8s cubic-bezier(0.2, 0.9, 0.3, 1) both; color: var(--amber); }
.gami-fire.lit { color: var(--amber); filter: drop-shadow(0 0 6px rgba(var(--warm-rgb), 0.6)); }
@keyframes num-pop {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-7px) scale(1.35); }
  100% { transform: translateY(0) scale(1); }
}
.gami-streak {
  width: 4.4rem; height: 4.4rem; border-radius: 1.1rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.05rem;
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); box-shadow: 0 10px 26px -12px rgba(var(--warm-rgb), 0.7);
}
.gami-streak [data-gami-n] { font-size: 1.7rem; font-weight: 900; line-height: 1; display: inline-block; }
.gami-streak small { font-size: 0.58rem; font-weight: 800; letter-spacing: 0.02em; opacity: 0.95; white-space: nowrap; }
.gami-streak [data-gami-n].pop { animation: num-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes square-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12) rotate(-3deg); } 100% { transform: scale(1); } }
.gami-streak.pop { animation: square-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1); }
.gami-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
.gami-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
[data-gami-n].pop { animation: num-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.gami-spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); pointer-events: none; animation: spark 0.7s ease-out forwards; }
@keyframes spark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } }
.gami-name { position: relative; }
@media (prefers-reduced-motion: reduce) { .xp-fill { transition: none; } .gami-fire.pop, [data-gami-n].pop, .gami-spark { animation: none; } }

/* ---------- Certificate: a celebration bursts out of it ---------- */
.cert-stage { position: relative; }
#certificates { overflow-x: clip; }   /* the confetti canvas reaches past the column on purpose */
.cert-confetti {
  position: absolute; left: -35%; right: -35%; top: -60%; bottom: -30%;
  width: 170%; height: 190%; pointer-events: none; z-index: 3;
}
@keyframes cert-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.035) rotate(-0.6deg); }
  60%  { transform: scale(0.99) rotate(0.3deg); }
  100% { transform: scale(1); }
}
.cert-stage.celebrating .bezel.cert { animation: cert-pop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1); }
.cert-stage .bezel.cert { transition: box-shadow 0.6s ease; }
.cert-stage.celebrating .bezel.cert { box-shadow: 0 0 0 6px rgba(var(--warm-rgb), 0.12), 0 24px 60px rgba(var(--warm-rgb), 0.18); }
@media (prefers-reduced-motion: reduce) { .cert-stage.celebrating .bezel.cert { animation: none; } }



/* ---------- Instructor dashboard mock: plays when it scrolls into view ---------- */
.teach-anim .mini-bars span { transition: height 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.teach-anim .progress-fill { transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.teach-anim .icon-pill, .teach-anim .tasks-list li, .teach-anim .cred-list li { opacity: 0; }
.teach-anim.play .icon-pill { animation: pop-up 0.55s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.teach-anim.play .icon-pill:nth-child(1) { animation-delay: 0.1s; }
.teach-anim.play .icon-pill:nth-child(2) { animation-delay: 0.2s; }
.teach-anim.play .icon-pill:nth-child(3) { animation-delay: 0.3s; }
.teach-anim.play .icon-pill:nth-child(4) { animation-delay: 0.4s; }
.teach-anim.play .icon-pill:nth-child(5) { animation-delay: 0.5s; }
.teach-anim.play .icon-pill:nth-child(6) { animation-delay: 0.6s; }
@keyframes slide-in-x {
  0%   { opacity: 0; transform: translateX(var(--from, 18px)); }
  100% { opacity: 1; transform: translateX(0); }
}
html[dir="rtl"] .teach-anim { --from: 18px; }
html[dir="ltr"] .teach-anim { --from: -18px; }
.teach-anim.play .tasks-list li { animation: slide-in-x 0.5s ease-out both; }
.teach-anim.play .tasks-list li:nth-child(1) { animation-delay: 1.5s; }
.teach-anim.play .tasks-list li:nth-child(2) { animation-delay: 1.7s; }
.teach-anim.play .cred-list li { animation: slide-in-x 0.5s ease-out both; }
.teach-anim.play .cred-list li:nth-child(1) { animation-delay: 0.7s; }
.teach-anim.play .cred-list li:nth-child(2) { animation-delay: 0.85s; }
.teach-anim.play .cred-list li:nth-child(3) { animation-delay: 1s; }
.teach-anim .trend-up { opacity: 0; transform: scale(0.6); transition: opacity 0.3s ease, transform 0.3s ease; }
.teach-anim .trend-up.pop { opacity: 1; transform: scale(1); animation: num-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1); }
.teach-anim .streak-num svg { transition: transform 0.4s ease, color 0.4s ease; }
.teach-anim .streak-num svg.pulse { animation: fire-pop 0.7s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .teach-anim .icon-pill, .teach-anim .tasks-list li, .teach-anim .cred-list li, .teach-anim .trend-up { opacity: 1; transform: none; animation: none !important; }
}

/* ---------- Admin queue: rows arrive, badges pop, decisions get made ---------- */
.admin-anim .admin-row, .admin-anim .icon-pill { opacity: 0; }
.admin-anim.play .admin-row { animation: slide-in-x 0.5s ease-out both; }
.admin-anim.play .admin-row:nth-of-type(1) { animation-delay: 0.15s; }
.admin-anim.play .admin-row:nth-of-type(2) { animation-delay: 0.3s; }
.admin-anim.play .admin-row:nth-of-type(3) { animation-delay: 0.45s; }
.admin-anim.play .admin-row:nth-of-type(4) { animation-delay: 0.6s; }
.admin-anim .status-badge { transform: scale(0.6); opacity: 0; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.3s ease, background 0.4s ease, color 0.4s ease; }
.admin-anim.play .status-badge { transform: scale(1); opacity: 1; }
.admin-anim.play .admin-row:nth-of-type(1) .status-badge { transition-delay: 0.5s; }
.admin-anim.play .admin-row:nth-of-type(2) .status-badge { transition-delay: 0.65s; }
.admin-anim.play .admin-row:nth-of-type(3) .status-badge { transition-delay: 0.8s; }
.admin-anim.play .admin-row:nth-of-type(4) .status-badge { transition-delay: 0.95s; }
.admin-anim .status-badge.decide { animation: num-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1); transition-delay: 0s !important; }
.admin-anim .admin-row { transition: background 0.5s ease; border-radius: 0.6rem; }
.admin-anim .admin-row.decided { background: rgba(52, 211, 153, 0.08); }
.admin-anim.play .icon-pill { animation: pop-up 0.55s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.admin-anim.play .icon-pill:nth-child(1) { animation-delay: 0.2s; }
.admin-anim.play .icon-pill:nth-child(2) { animation-delay: 0.3s; }
.admin-anim.play .icon-pill:nth-child(3) { animation-delay: 0.4s; }
.admin-anim.play .icon-pill:nth-child(4) { animation-delay: 0.5s; }
.admin-anim.play .icon-pill:nth-child(5) { animation-delay: 0.6s; }
@keyframes cta-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.55); }
  100% { box-shadow: 0 0 0 18px rgba(96, 165, 250, 0); }
}
.admin-anim.play .btn-primary { animation: cta-pulse 1.1s ease-out 1.1s 2; }
@media (prefers-reduced-motion: reduce) {
  .admin-anim .admin-row, .admin-anim .icon-pill, .admin-anim .status-badge { opacity: 1; transform: none; animation: none !important; transition: none; }
}

/* ---------- Rise-in groups: children come up from below, staggered ---------- */
@keyframes rise-up {
  0%   { opacity: 0; transform: translateY(34px); }
  70%  { opacity: 1; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}
[data-rise] > * { opacity: 0; transform: translateY(34px); will-change: transform, opacity; }
[data-rise].rise-in > * { animation: rise-up 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
[data-rise].rise-in > *:nth-child(1) { animation-delay: 0.05s; }
[data-rise].rise-in > *:nth-child(2) { animation-delay: 0.17s; }
[data-rise].rise-in > *:nth-child(3) { animation-delay: 0.29s; }
[data-rise].rise-in > *:nth-child(4) { animation-delay: 0.41s; }
[data-rise].rise-in > *:nth-child(5) { animation-delay: 0.53s; }
[data-rise].rise-in > *:nth-child(6) { animation-delay: 0.65s; }
@media (prefers-reduced-motion: reduce) { [data-rise] > * { opacity: 1; transform: none; animation: none !important; } }

/* ---------- Live class mock: sheen across the screen, breathing camera, running clock ---------- */
.live-screen { overflow: hidden; }
.live-screen::after {
  content: ""; position: absolute; inset: -20% -60%; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(96, 165, 250, 0.10) 50%, transparent 60%);
  transform: translateX(-120%); opacity: 0;
}
.live-screen.play::after { animation: live-sheen 3.4s ease-in-out 0.6s infinite; opacity: 1; }
@keyframes live-sheen { 0% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.live-cam { transform-origin: 50% 50%; opacity: 0.9; }
.live-screen.play .live-cam { animation: cam-breathe 2.8s ease-in-out infinite; }
@keyframes cam-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(96, 165, 250, 0)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 0 14px rgba(96, 165, 250, 0.55)); }
}
.live-screen.play .dot-live { animation: live-blink 1.2s ease-in-out infinite; }
@keyframes live-blink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
.live-clock { margin-inline-start: 0.35rem; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.75); font-weight: 600; }
.live-viewers {
  position: absolute; bottom: 0.9rem; inset-inline-start: 0.9rem; display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.7rem; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.45); padding: 0.28rem 0.6rem; border-radius: 999px;
  opacity: 0; transform: translateY(8px); transition: opacity 0.4s ease, transform 0.4s ease;
}
.live-screen.play .live-viewers { opacity: 1; transform: translateY(0); }
.live-viewers b { font-variant-numeric: tabular-nums; }

/* ---------- Ask-the-instructor steps: each lights up in turn ---------- */
.ask-steps .prompt-chip { transition: border-color 0.45s ease, background 0.45s ease, transform 0.45s ease, box-shadow 0.45s ease; }
.ask-steps .prompt-chip svg { transition: color 0.45s ease, transform 0.45s ease; }
.ask-steps .prompt-chip.active { border-color: var(--blue); background: rgba(var(--accent-rgb), 0.10); transform: translateX(var(--from, 0)) scale(1.015); box-shadow: 0 10px 30px -18px rgba(var(--accent-rgb), 0.8); }
html[dir="rtl"] .ask-steps { --from: -4px; }
html[dir="ltr"] .ask-steps { --from: 4px; }
.ask-steps .prompt-chip.active svg { color: var(--blue-soft); transform: scale(1.15); }
.ask-steps .prompt-chip .ask-tick {
  margin-inline-start: auto; width: 1.15rem; height: 1.15rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(52, 211, 153, 0.18); color: #34d399; opacity: 0; transform: scale(0.4); transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.ask-steps .prompt-chip.done .ask-tick { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) {
  .live-screen.play::after, .live-screen.play .live-cam, .live-screen.play .dot-live { animation: none; }
}

/* The top card sways very slightly while the pile idles */
@keyframes stack-idle {
  0%, 100% { rotate: 0deg; }
  50%      { rotate: 0.9deg; }
}
.stack-card[data-depth="0"]:not(.dragging):not(.leaving) { animation: stack-idle 4.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .stack-card[data-depth="0"] { animation: none; } }

/* Hero cards: between drops they lift away briefly, then drop again */
@keyframes hero-out {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-70px); }
}
#heroPanel.hero-out .bezel { animation: hero-out 0.4s ease-in both !important; }
#heroPanel.hero-out .dash-grid > .bezel:nth-child(2) { animation-delay: 0.05s !important; }
#heroPanel.hero-out .dash-grid > .bezel:nth-child(3) { animation-delay: 0.1s !important; }
#heroPanel.hero-out .dash-grid > .bezel:nth-child(4) { animation-delay: 0.15s !important; }
#heroPanel.hero-out .dash-grid > .bezel:nth-child(5) { animation-delay: 0.2s !important; }
#heroPanel.hero-reset .bezel, #heroPanel.hero-reset .bezel > .bezel-inner { animation: none !important; }

/* ---------- Instructor portrait: the outline draws itself, then glows ---------- */
.instructor-photo svg circle, .instructor-photo svg path {
  stroke-dasharray: 600; stroke-dashoffset: 600;
}
.instructor-photo.draw svg circle { animation: draw-stroke 1.3s ease-out forwards; }
.instructor-photo.draw svg path { animation: draw-stroke 1.4s ease-out 0.5s forwards; }
@keyframes draw-stroke { to { stroke-dashoffset: 0; } }
.instructor-photo.draw::after { animation: portrait-glow 4s ease-in-out 1.6s infinite; }
@keyframes portrait-glow {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.06); }
}
.instructor-photo.draw svg { animation: portrait-breathe 4s ease-in-out 1.6s infinite; }
@keyframes portrait-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ---------- Testimonials: stars light up one by one after the cards pop ---------- */
.testi-grid[data-pop] .testi-stars svg { color: var(--border-strong); transition: color 0.25s ease, transform 0.25s ease; }
.testi-grid[data-pop] .testi-stars { color: var(--border-strong); }
.testi-grid[data-pop].pop-in .testi-stars svg { color: var(--amber); }
[data-pop].pop-in .testi-stars svg:nth-child(1) { transition-delay: 0.7s; }
[data-pop].pop-in .testi-stars svg:nth-child(2) { transition-delay: 0.82s; }
[data-pop].pop-in .testi-stars svg:nth-child(3) { transition-delay: 0.94s; }
[data-pop].pop-in .testi-stars svg:nth-child(4) { transition-delay: 1.06s; }
[data-pop].pop-in .testi-stars svg:nth-child(5) { transition-delay: 1.18s; }
[data-pop].pop-in .testi-avatar { animation: pop-up 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) 0.9s both; }

/* ---------- Final call to action: the band settles in, the button pulses ---------- */
[data-cta-anim].rise-in .btn-primary { animation: rise-up 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) 0.41s both, cta-pulse 1.2s ease-out 1.4s 3; }
@media (prefers-reduced-motion: reduce) {
  .instructor-photo svg circle, .instructor-photo svg path { stroke-dashoffset: 0; animation: none !important; }
  .instructor-photo.draw::after, .instructor-photo.draw svg, [data-pop].pop-in .testi-avatar { animation: none !important; }
}

/* the number and a flame side by side inside the streak square */
.gami-sq-top { display: inline-flex; align-items: center; gap: 0.25rem; }
.gami-sq-fire { flex-shrink: 0; transform-origin: 50% 80%; }
.gami-streak.pop .gami-sq-fire { animation: fire-pop 0.8s cubic-bezier(0.2, 0.9, 0.3, 1); }


/* =========================================================
   Motion and finish — applied on top of the components above
   ========================================================= */

/* nav: an underline that slides in, and follows the section in view */
.nav-links a { position: relative; padding: 0.25rem 0; }
.nav-links a::after {
  content: "";
  position: absolute; inset-inline: 0; bottom: -3px; height: 2px; border-radius: 2px;
  background: var(--grad-primary);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.45s var(--ease);
}
html[dir="rtl"] .nav-links a::after { transform-origin: 100% 50%; }
.nav-links a:hover::after, .nav-links a.is-active::after, .nav-links a.current::after { transform: scaleX(1); }
.nav-links a.current, .nav-links a.is-active { color: var(--text); }
.logo-mark { transition: transform 0.6s var(--ease-spring), box-shadow 0.4s var(--ease); }
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }
.theme-toggle button svg, .lang-switch button { transition: transform 0.6s var(--ease-spring), color 0.35s var(--ease), background-color 0.35s var(--ease); }
.theme-toggle button.active svg { transform: rotate(360deg); }
.theme-toggle button:not(.active):hover svg { transform: rotate(20deg); }

/* icon tiles tilt a little when their card is hovered */
.f-icon, .deck-ico, .chat-avatar, .cert-seal, .gami-avatar { transition: transform 0.55s var(--ease-spring), background-color 0.4s var(--ease); }
.bezel:hover .f-icon, .stack-card:hover .deck-ico { transform: rotate(-6deg) scale(1.06); }
.icon-pill, .prompt-chip, .social-row a, .badge-row .b {
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), background-color 0.4s var(--ease), color 0.4s var(--ease);
}
.icon-pill:hover, .prompt-chip:hover { transform: translateY(-2px); border-color: var(--border-hover); color: var(--text); }
.social-row a:hover, .badge-row .b:hover { transform: translateY(-2px) rotate(-4deg); border-color: var(--border-hover); }

/* footer links slide toward the reader */
.foot-col a { display: inline-block; transition: color 0.3s var(--ease), transform 0.3s var(--ease); }
.foot-col a:hover { transform: translateX(-3px); }
html[dir="ltr"] .foot-col a:hover { transform: translateX(3px); }

/* text links get a drawn underline */
.lede a, p a:not(.btn), .foot-bottom a {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.4s var(--ease);
}
.lede a:hover, p a:not(.btn):hover, .foot-bottom a:hover { background-size: 100% 1px; }

/* the instructor portrait: navy panel with the same dot grid, no spotlight */
.instructor-photo { background: linear-gradient(160deg, var(--bg-raise), var(--bg)); border: 1px solid var(--border); box-shadow: var(--shadow-1); }
.instructor-photo::after {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='1.5' cy='1.5' r='1.1' fill='%23bfbfbf'/%3E%3C/svg%3E");
  background-size: 24px 24px; opacity: 0.18;
}
:root[data-theme="light"] .instructor-photo::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='1.5' cy='1.5' r='1.1' fill='%23000e26'/%3E%3C/svg%3E");
  opacity: 0.14;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
  mask-image: linear-gradient(180deg, #000, transparent 85%);
}

/* the final band: a soft two-tone wash and a route running across it */
.cta-band { background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.14), rgba(139, 108, 240, 0.12)); }
.cta-band::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  background-size: 50% 100%;
  animation: band-sweep 7s ease-in-out infinite;
  opacity: 0.6;
}
@keyframes band-sweep { 0% { background-position: -100% 0; } 100% { background-position: 200% 0; } }
.cta-band > * { position: relative; }

/* shadows on lifted cards follow the theme */
[data-pop].pop-in > .bezel:hover { transform: translateY(-4px) scale(1.01); box-shadow: none; }
.stack-card { box-shadow: var(--shadow-2); }
.dot-live { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18); }

/* the mobile menu's links rise in with the same spring as everything else */
.mobile-menu a { transition-timing-function: var(--ease-spring); }

@media (prefers-reduced-motion: reduce) {
  .grad-text, .eyebrow::before, .cta-band::before, .u-stroke path { animation: none; }
  .u-stroke path { stroke-dashoffset: 0; }
  .btn::after { display: none; }
}


/* =========================================================
   Touch and small screens
   ========================================================= */

/* Fingers, not pointers: comfortable hit areas without changing the layout */
@media (pointer: coarse) {
  a, button, [role="button"], label, summary { touch-action: manipulation; }
  .theme-toggle button { width: 2.2rem; height: 2.2rem; }
  .lang-switch button { min-height: 2.2rem; }
  .iconbtn { width: 2.5rem; height: 2.5rem; }
  .pc-btn { width: 2.5rem; height: 2.5rem; }
  .social-row a { width: 2.6rem; height: 2.6rem; }
  .foot-col a { padding-block: 0.45rem; margin-block: -0.25rem; }
  .crumbs a, .tcard-head a, .section-title a, .side-head a, .link-more { display: inline-block; padding-block: 0.5rem; margin-block: -0.5rem; }
  .tab { padding-block: 0.95rem; }
  .side-lesson { padding-block: 0.85rem; }
}

/* Phones */
@media (max-width: 640px) {
  .nav-wrap { top: 0.75rem; padding-inline: 0.75rem; }
  .nav { gap: 0.5rem; padding: 0.4rem 0.5rem 0.4rem 0.9rem; }
  html[dir="rtl"] .nav { padding: 0.4rem 0.9rem 0.4rem 0.5rem; }
  .logo { font-size: 1rem; gap: 0.45rem; }
  .nav-actions { gap: 0.4rem; }

  /* One round button per control. It shows the option you would switch
     to, the same way the burger shows the menu you can open. */
  .theme-toggle, .lang-switch { padding: 0; border: 0; background: transparent; gap: 0; }
  .theme-toggle button, .lang-switch button {
    width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    font-size: 0.72rem; box-shadow: none;
  }
  .theme-toggle button.active, .lang-switch button.active { display: none; }
  .theme-toggle button:not(.active) svg { transform: none; }
  #navLogout { display: none; }

  /* iOS zooms into any field smaller than 16px; keep fields readable instead */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  select, textarea { font-size: 16px; }

  .foot-bottom { flex-direction: column; gap: 0.4rem; text-align: center; }
}

/* Anything with a scrolling strip: no visible bar, the cut-off item is the hint */
.tabs, .course-tabs, .chip-row, .ttable-wrap { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar, .course-tabs::-webkit-scrollbar, .chip-row::-webkit-scrollbar, .ttable-wrap::-webkit-scrollbar { display: none; }


/* ---------- Features on phones: a rail you swipe, one card at a time ----------
   Seven stacked cards are a long scroll on a phone. Below the two-column
   breakpoint the bento becomes a snap rail that bleeds to the screen
   edges, with the next card peeking in, dots under it, and a slow
   auto-advance that yields the moment a finger touches it. */
@media (max-width: 699px) {
  .bento {
    display: flex; gap: 0.85rem;
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-inline: calc(1.5rem * -1);
    padding: 0.5rem 1.5rem 1rem;
    scroll-padding-inline: 1.5rem;
  }
  .bento::-webkit-scrollbar { display: none; }
  .bento > .bezel { flex: 0 0 min(78%, 300px); scroll-snap-align: center; }
  .bento .bezel-inner { height: 100%; }
  .big .feature-card { padding: 1.6rem; justify-content: flex-start; }
  .feature-card p { font-size: 0.9rem; line-height: 1.7; }
  .rail-nav { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; margin-top: 0.3rem; }
  .rail-dots { display: flex; gap: 0.4rem; padding: 0.4rem; }
  .rail-dots button {
    width: 0.5rem; height: 0.5rem; border-radius: 999px;
    background: var(--border-strong);
    transition: width 0.4s var(--ease), background-color 0.4s var(--ease);
  }
  .rail-dots button.on { width: 1.5rem; background: var(--blue); }
  @media (pointer: coarse) { .rail-dots button { min-width: 0.5rem; min-height: 0.5rem; padding: 0; } }
}
@media (min-width: 700px) { .rail-nav { display: none; } }
