/**
 * Inglizi reading hub (index.html) — illustrated hero, live background, bar chart.
 * Loads after css/lesson.css (uses the same :root tokens).
 */

html:has(body.page--hub) {
  scroll-padding-top: 3.75rem;
}

/* ——— Full PDF download (hero) ——— */
body.page--hub .hub-hero__pdf-intro {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #3d4a5c;
  text-align: center;
  line-height: 1.45;
  max-width: 36rem;
  margin-inline: auto;
}

body.page--hub .hub-hero__pdf-parts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.5rem;
  margin: 0 0 0.35rem;
}

body.page--hub .hub-cta--pdf-part {
  min-width: 4.25rem;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  border-color: rgba(201, 162, 39, 0.5);
  background: rgba(255, 251, 235, 0.9);
}

body.page--hub .hub-hero__pdf-credit {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  text-align: center;
  letter-spacing: 0.02em;
}

body.page--hub .hub-hero__pdf-credit-line {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(15, 118, 110, 0.35);
}

/* ——— Aurora (stronger, clearly visible) ——— */
body.page--hub .hub-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

body.page--hub .hub-aurora__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.72;
  will-change: transform;
  animation: hubBlobDrift 18s ease-in-out infinite alternate;
}

body.page--hub .hub-aurora__blob--1 {
  width: min(48vw, 420px);
  height: min(48vw, 420px);
  top: -10%;
  inset-inline-end: -8%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.55) 0%, transparent 68%);
  animation-duration: 22s;
}

body.page--hub .hub-aurora__blob--2 {
  width: min(60vw, 520px);
  height: min(60vw, 520px);
  bottom: -15%;
  inset-inline-start: -18%;
  background: radial-gradient(circle, rgba(224, 122, 95, 0.5) 0%, transparent 65%);
  animation-duration: 28s;
  animation-delay: -5s;
}

body.page--hub .hub-aurora__blob--3 {
  width: min(45vw, 380px);
  height: min(45vw, 380px);
  top: 38%;
  inset-inline-start: 22%;
  background: radial-gradient(circle, rgba(107, 76, 122, 0.42) 0%, transparent 68%);
  animation-duration: 16s;
  animation-delay: -6s;
}

@keyframes hubBlobDrift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-6%, 8%) scale(1.12);
  }
}

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

@keyframes hubGlowPulse {
  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes hubCtaPulse {
  0%,
  100% {
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35);
  }
  50% {
    box-shadow: 0 6px 28px rgba(15, 118, 110, 0.5);
  }
}

@keyframes hubSheen {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

/* ——— Hero: always visible (no opacity:0 flash) ——— */
body.page--hub .hub-hero__visual-wrap {
  position: relative;
  max-width: min(100%, 420px);
  margin-inline: auto;
}

body.page--hub .hub-hero__glow {
  position: absolute;
  inset: -14% -10% auto;
  height: 85%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.28) 0%, transparent 62%);
  animation: hubGlowPulse 4.5s ease-in-out infinite;
  pointer-events: none;
}

body.page--hub .hub-hero__visual {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 20px 40px rgba(13, 45, 107, 0.2));
  animation: hubFloatSoft 6s ease-in-out infinite;
}

body.page--hub .hub-hero__svg--scene {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 28px;
  background: linear-gradient(165deg, #fffefb 0%, #f0fdfa 45%, #fff7ed 100%);
  border: 2px solid rgba(201, 162, 39, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 12px 40px rgba(15, 23, 42, 0.08);
}

body.page--hub .hub-hero__title-ar {
  background: linear-gradient(120deg, #0d2d6b 0%, #0f766e 45%, #1e4a9e 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hubSheen 8s ease-in-out infinite alternate;
}

body.page--hub .hub-cta--primary {
  animation: hubCtaPulse 2.8s ease-in-out infinite;
}

body.page--hub .hub-wave__svg {
  display: block;
  width: 100%;
  height: clamp(40px, 9vw, 56px);
}

body.page--hub .hub-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 0.75rem 1rem;
  margin: 0 0 clamp(1rem, 2.5vw, 1.5rem);
}

body.page--hub .hub-stat {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  border-radius: 20px;
  border: 1px solid rgba(13, 45, 107, 0.1);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.08);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}

body.page--hub .hub-stat:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

body.page--hub .hub-stat--teal .hub-stat__icon {
  color: var(--accent-teal);
  background: rgba(15, 118, 110, 0.14);
}

body.page--hub .hub-stat--gold .hub-stat__icon {
  color: var(--gold-dark);
  background: rgba(201, 162, 39, 0.18);
}

body.page--hub .hub-stat--plum .hub-stat__icon {
  color: var(--accent-plum);
  background: rgba(107, 76, 122, 0.14);
}

body.page--hub .hub-stat--grammar101 .hub-stat__icon {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.16);
}

body.page--hub .hub-stat__icon {
  flex-shrink: 0;
  width: 3.25rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}

body.page--hub .hub-stat__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: right;
  direction: rtl;
}

body.page--hub .hub-stat__num {
  font-family: var(--font-en-ui);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--royal-blue);
}

body.page--hub .hub-stat__label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.35;
}

/* ——— Content bar chart ——— */
body.page--hub .hub-chart-panel {
  margin: 0 0 clamp(1.1rem, 2.5vw, 1.75rem);
  padding: clamp(1.1rem, 2.5vw, 1.5rem);
  border-radius: 22px;
  border: 1px solid rgba(13, 45, 107, 0.1);
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 50%, #fffbeb 100%);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
}

body.page--hub .hub-chart-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  direction: rtl;
}

body.page--hub .hub-chart-panel__title {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  font-weight: 800;
  color: var(--royal-blue);
}

body.page--hub .hub-chart-panel__sub {
  margin: 0;
  font-family: var(--font-en-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  direction: ltr;
}

body.page--hub .hub-chart {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

body.page--hub .hub-chart__row {
  display: grid;
  grid-template-columns: minmax(0, 7.5rem) 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  direction: rtl;
}

@media (max-width: 520px) {
  body.page--hub .hub-chart__row {
    grid-template-columns: 1fr;
    text-align: right;
  }

  body.page--hub .hub-chart__val {
    justify-self: end;
  }
}

body.page--hub .hub-chart__label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.25;
}

body.page--hub .hub-chart__track {
  height: 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

@keyframes hubBar82 {
  from {
    width: 0;
  }
  to {
    width: 82%;
  }
}

@keyframes hubBar100 {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes hubBar73 {
  from {
    width: 0;
  }
  to {
    width: 73%;
  }
}

/* Chart bars: pure CSS (no JS) so motion always runs when this file loads */
body.page--hub .hub-chart__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  animation-duration: 1.15s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  animation-fill-mode: forwards;
}

body.page--hub .hub-chart__row:nth-child(1) .hub-chart__fill {
  animation-delay: 0.05s;
}
body.page--hub .hub-chart__row:nth-child(2) .hub-chart__fill {
  animation-delay: 0.14s;
}
body.page--hub .hub-chart__row:nth-child(3) .hub-chart__fill {
  animation-delay: 0.23s;
}
body.page--hub .hub-chart__row:nth-child(4) .hub-chart__fill {
  animation-delay: 0.32s;
}
body.page--hub .hub-chart__row:nth-child(5) .hub-chart__fill {
  animation-delay: 0.41s;
}

body.page--hub .hub-chart__row:nth-child(6) .hub-chart__fill {
  animation-delay: 0.5s;
}

body.page--hub .hub-chart__fill--teal {
  animation-name: hubBar82;
  background: linear-gradient(90deg, #0d9488, #5eead4);
}
body.page--hub .hub-chart__fill--coral {
  animation-name: hubBar100;
  background: linear-gradient(90deg, #e07a5f, #fdba74);
}
body.page--hub .hub-chart__fill--gold {
  animation-name: hubBar73;
  background: linear-gradient(90deg, #b45309, #fbbf24);
}
body.page--hub .hub-chart__fill--plum {
  animation-name: hubBar73;
  background: linear-gradient(90deg, #6b4c7a, #c084fc);
}
body.page--hub .hub-chart__fill--sky {
  animation-name: hubBar100;
  background: linear-gradient(90deg, #0369a1, #38bdf8);
}

body.page--hub .hub-chart__fill--teal-deep {
  animation-name: hubBar100;
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
}

body.page--hub .hub-chart__val {
  font-family: var(--font-en-ui);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--royal-blue);
  min-width: 2.75rem;
  text-align: center;
  direction: ltr;
}

/* ——— Section polish ——— */
body.page--hub .hub-lessons--deck .hub-lessons__head h2 {
  position: relative;
  display: inline-block;
}

body.page--hub .hub-lessons--deck .hub-lessons__head h2::after {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  bottom: -0.2em;
  width: min(100%, 6rem);
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-teal), var(--gold-light), var(--accent-plum));
}

body.page--hub .hub-unit.hub-reveal {
  position: relative;
  padding: clamp(0.85rem, 2vw, 1.15rem);
  margin-inline: -0.35rem;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.35) 100%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 28px rgba(15, 23, 42, 0.06);
}

body.page--hub .hub-unit.hub-reveal::before {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  top: 0.85rem;
  bottom: 0.85rem;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-teal), var(--gold-light), var(--accent-coral));
  opacity: 0.65;
  pointer-events: none;
}

body.page--hub .lesson-card {
  border-radius: 1.35rem 1.55rem 1.15rem 1.45rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(252, 252, 253, 0.94) 100%);
}

body.page--hub .lesson-card::after {
  content: "";
  position: absolute;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.11) 0%, transparent 72%);
  top: -2.75rem;
  inset-inline-start: -2.25rem;
  pointer-events: none;
  z-index: 0;
}

body.page--hub .lesson-card > * {
  position: relative;
  z-index: 1;
}

body.page--hub .lesson-card:hover .lesson-card__cta {
  transform: translateX(-4px);
}

body.page--hub .lesson-card__cta {
  transition: transform 0.2s var(--ease-out), color 0.15s ease;
}

body.page--hub .hub-site-nav__list a {
  position: relative;
  overflow: hidden;
}

body.page--hub .hub-site-nav__list a::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.55s ease, opacity 0.25s ease;
}

body.page--hub .hub-site-nav__list a:hover::after {
  transform: translateX(-100%);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  body.page--hub .hub-aurora__blob,
  body.page--hub .hub-hero__visual,
  body.page--hub .hub-hero__glow {
    animation: none !important;
  }

  body.page--hub .hub-hero__title-ar {
    animation: none;
    background: none;
    color: var(--royal-blue);
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: var(--royal-blue);
  }

  body.page--hub .hub-cta--primary {
    animation: none;
  }

  body.page--hub .hub-chart__fill {
    animation: none;
  }

  body.page--hub .hub-chart__fill--teal {
    width: 82%;
  }
  body.page--hub .hub-chart__fill--coral {
    width: 100%;
  }
  body.page--hub .hub-chart__fill--gold {
    width: 73%;
  }
  body.page--hub .hub-chart__fill--plum {
    width: 73%;
  }
  body.page--hub .hub-chart__fill--sky {
    width: 100%;
  }
}
