/* ================================================================
   Tawjihi Platform — Premium Refinement Layer (Stage-19)
   Sits on top of theme-v3.css. Elevates the v3 look from "startup edtech"
   to "premium educational institution". Focus: typography rhythm, depth,
   restraint, hierarchy — no new gimmicks.

   Loaded AFTER theme-v3.css; overrides tokens where needed.
   ================================================================ */


/* ---------- Refined tokens (premium palette) ---------- */
/* Note: theme-v3.css defines tokens on .theme-v3 .nav and .container too, which
   are closer ancestors than the body. We must define our overrides on the SAME
   selectors so cascade + inheritance both resolve to the premium palette. */
.theme-v3.premium,
.theme-v3.premium .nav,
.theme-v3.premium .container {
  --v3-bg:         #FAFAF8;   /* soft ivory — richer than pure gray */
  --v3-surface:    #FFFFFF;
  --v3-surface-2:  #F4F3EE;
  --v3-line:       #E9E7DF;   /* warmer neutral */
  --v3-line-soft:  #F1F0EA;

  --v3-ink-1:      #0E1219;
  --v3-ink-2:      #2E3644;
  --v3-ink-3:      #6E7280;

  /* refined primary — deeper indigo instead of Tailwind default */
  --v3-brand-1:    #4C50A6;   /* premium royal indigo */
  --v3-brand-2:    #7649AB;   /* mulberry purple */
  --v3-brand-ink:  #1E1B4B;   /* deep primary text option */
  --v3-brand-soft: #EDECFA;

  /* refined accent — Palestinian embroidery red made premium */
  --v3-red:        #A02B26;
  --v3-red-soft:   #F3E1DF;

  /* subtle gold underline for numerals */
  --v3-gold:       #B08840;
}

[data-theme="dark"] .theme-v3.premium {
  --v3-bg:         #0E0F15;
  --v3-surface:    #17182A;
  --v3-surface-2:  #1E2038;
  --v3-line:       #262845;
  --v3-line-soft:  #1E2038;
}


/* ---------- Typography rhythm — refined ---------- */
.theme-v3.premium {
  /* Prefer serious display face for major headings */
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  line-height: 1.68;
}
.theme-v3.premium h1, .theme-v3.premium h2, .theme-v3.premium h3,
.theme-v3.premium .sh-title-v3, .theme-v3.premium .hero-h1-v3 {
  font-family: 'Tajawal', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  letter-spacing: -.015em;
}

/* Numerals — display numbers get lining-nums + subtle gold underline */
.theme-v3.premium .num-hero {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.02em;
}


/* ---------- Refined NAV ---------- */
.theme-v3.premium nav.nav {
  background: rgba(250,250,248,.90);
  border-bottom: 1px solid var(--v3-line);
  padding: .1rem 0;
}
.theme-v3.premium .nav-inner { padding: 1.05rem 0; }
.theme-v3.premium .brand-mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 4px 14px rgba(31,24,16,.10);
  overflow: hidden;
}
/* Remove the white filter — the new Palestinian logo has its own colors */
.theme-v3.premium .brand-mark img {
  filter: none !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}
.theme-v3.premium .brand-name strong {
  font-family: 'Tajawal', system-ui, sans-serif !important;
  font-weight: 800 !important;
  letter-spacing: -.015em;
  font-size: 1.08rem !important;
}

/* Teachers area (tp-nav) — same premium treatment for consistency */
.theme-v3.premium .tp-nav-brand-mark {
  width: 44px !important; height: 44px !important;
  border-radius: 12px !important;
  background: transparent !important;
  box-shadow: 0 4px 14px rgba(31,24,16,.10);
  padding: 0 !important;
  overflow: hidden;
}
.theme-v3.premium .tp-nav-brand-mark img {
  width: 100% !important; height: 100% !important;
  object-fit: contain !important;
  filter: none !important;
}
.theme-v3.premium .tp-nav-brand-text strong {
  font-family: 'Tajawal', system-ui, sans-serif !important;
  font-weight: 800 !important;
  font-size: 1.08rem !important;
  letter-spacing: -.015em;
  color: var(--v3-ink-1) !important;
}
.theme-v3.premium .tp-nav-brand-text span {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif !important;
  font-size: .72rem !important;
  color: var(--v3-gold) !important;
  letter-spacing: .14em;
  font-weight: 600 !important;
  text-transform: uppercase;
}
.theme-v3.premium .brand-name span {
  font-size: .72rem;
  color: var(--v3-gold);
  letter-spacing: .14em;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}

.theme-v3.premium .nav-links .nav-link {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 600;
  font-size: .93rem;
  padding: .55rem 1rem;
  color: var(--v3-ink-2);
  border-radius: 8px;
  transition: color .15s, background .12s;
}
.theme-v3.premium .nav-links .nav-link:hover {
  background: var(--v3-brand-soft);
  color: var(--v3-brand-ink);
}
.theme-v3.premium .nav-links .nav-link.is-active {
  background: var(--v3-brand-ink);
  color: #fff;
}


/* ---------- Refined HERO — restrained, refined depth ---------- */
.theme-v3.premium .hero-main-v3 {
  background:
    radial-gradient(circle at 82% 12%, rgba(76,80,166,.05), transparent 55%),
    radial-gradient(circle at 12% 88%, rgba(160,43,38,.045), transparent 55%),
    linear-gradient(180deg, #FFFFFF 0%, #FAFAF8 100%);
  border: 1px solid var(--v3-line);
  border-radius: 20px;
  padding: 3rem 2.4rem;
  min-height: 380px;
  box-shadow: 0 1px 2px rgba(14,18,25,.03), 0 12px 40px rgba(14,18,25,.04);
  position: relative;
  overflow: hidden;
}
.theme-v3.premium .hero-main-v3::before,
.theme-v3.premium .hero-main-v3::after { display: none !important; }

.theme-v3.premium .hero-pill {
  background: transparent;
  border: 1px solid var(--v3-line-2, #D6D2C4);
  color: var(--v3-ink-3);
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: .45rem 1rem;
}
.theme-v3.premium .hero-pill .dot { background: var(--v3-brand-1); box-shadow: 0 0 0 4px rgba(76,80,166,.15); }

.theme-v3.premium .hero-h1-v3 {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(2.1rem, 4vw, 3.3rem);
  line-height: 1.15;
  letter-spacing: -.03em;
  color: var(--v3-brand-ink);
  margin-top: 1.4rem;
}
.theme-v3.premium .hero-h1-v3 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--v3-brand-1), var(--v3-brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  position: relative;
}

.theme-v3.premium .hero-sub-v3 {
  color: var(--v3-ink-2);
  font-size: 1.06rem;
  line-height: 1.85;
  max-width: 52ch;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-weight: 400;
}

.theme-v3.premium .hero-main-v3 .btn-v3-primary {
  background: linear-gradient(135deg, var(--v3-brand-1), var(--v3-brand-2));
  color: #fff;
  padding: .95rem 1.6rem;
  border-radius: 12px;
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  border: 0;
  box-shadow: 0 8px 24px rgba(76,80,166,.34), inset 0 1px 0 rgba(255,255,255,.15);
  transition: transform .15s, box-shadow .15s;
}
.theme-v3.premium .hero-main-v3 .btn-v3-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(76,80,166,.42), inset 0 1px 0 rgba(255,255,255,.15);
}

.theme-v3.premium .hero-main-v3 .btn-v3-glass {
  background: rgba(76,80,166,.06);
  color: var(--v3-brand-ink);
  border: 1px solid var(--v3-line);
  padding: .95rem 1.6rem;
  border-radius: 12px;
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  transition: background .15s, border-color .15s;
}
.theme-v3.premium .hero-main-v3 .btn-v3-glass:hover {
  background: var(--v3-brand-soft);
  border-color: var(--v3-brand-1);
}


/* ---------- Refined COUNTDOWN + STREAK ---------- */
.theme-v3.premium .countdown-v3 {
  background: linear-gradient(160deg, #FFF9E8, #FEF3D1);
  border: 1px solid #F3E5A8;
  box-shadow: 0 1px 2px rgba(146,64,14,.03), 0 8px 24px rgba(146,64,14,.06);
  padding: 1.5rem;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}
.theme-v3.premium .countdown-v3::before { display: none; }
.theme-v3.premium .cd-label { font-family: 'Tajawal', system-ui, sans-serif; font-size: .78rem; font-weight: 700; color: #7A4A0A; letter-spacing: .04em; }
.theme-v3.premium .cd-big {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-weight: 800;
  font-size: 3.4rem;
  color: #6D3906;
  line-height: 1;
  margin: .4rem 0;
  letter-spacing: -.045em;
  font-variant-numeric: lining-nums tabular-nums;
}
.theme-v3.premium .cd-sub { font-size: .82rem; color: #7A4A0A; font-weight: 600; font-family: 'Tajawal', system-ui, sans-serif; }

.theme-v3.premium .streak-v3 {
  background: var(--v3-surface);
  border: 1px solid var(--v3-line);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(14,18,25,.03), 0 8px 24px rgba(14,18,25,.05);
}
.theme-v3.premium .streak-label-v3 {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 600;
  color: var(--v3-ink-3);
  letter-spacing: .02em;
  font-size: .85rem;
}
.theme-v3.premium .streak-flame-v3 {
  background: linear-gradient(135deg, #DC2626, #EA580C);
  box-shadow: 0 4px 12px rgba(220,38,38,.35);
}
.theme-v3.premium .streak-big-v3 {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: -.02em;
  font-variant-numeric: lining-nums tabular-nums;
}
.theme-v3.premium .streak-fill-v3 { background: linear-gradient(90deg, #DC2626, #EA580C); }


/* ---------- Refined SECTION HEADS ---------- */
.theme-v3.premium .section-head-v3 {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--v3-line);
  margin: 4rem 0 2rem;
}
.theme-v3.premium .sh-title-v3 {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.55rem, 2.6vw, 1.95rem);
  letter-spacing: -.025em;
  color: var(--v3-ink-1);
}
.theme-v3.premium .sh-sub-v3 {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: .95rem;
  color: var(--v3-ink-3);
  margin-top: .35rem;
  line-height: 1.7;
  max-width: 60ch;
}
.theme-v3.premium .sh-link-v3 {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--v3-brand-ink);
  background: var(--v3-brand-soft);
  padding: .55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--v3-brand-soft);
  transition: border-color .15s, background .15s;
}
.theme-v3.premium .sh-link-v3:hover { border-color: var(--v3-brand-1); background: #fff; }


/* ---------- Refined SEGMENT TABS ---------- */
.theme-v3.premium .seg-v3 {
  background: var(--v3-surface-2);
  border: 1px solid var(--v3-line);
  padding: .35rem;
  border-radius: 12px;
}
.theme-v3.premium .seg-v3 button {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  color: var(--v3-ink-3);
  padding: .6rem 1.3rem;
  border-radius: 9px;
}
.theme-v3.premium .seg-v3 button.is-active {
  background: var(--v3-brand-ink);
  color: #fff;
  box-shadow: 0 4px 12px rgba(30,27,75,.20);
}


/* ---------- Refined SUBJECT CARDS ---------- */
.theme-v3.premium .subj-card-v3 {
  background: var(--v3-surface);
  border: 1px solid var(--v3-line);
  border-radius: 16px;
  padding: 1.6rem 1.5rem;
  transition: border-color .18s, box-shadow .2s, transform .18s;
  box-shadow: 0 1px 2px rgba(14,18,25,.02);
  position: relative;
  overflow: hidden;
}
.theme-v3.premium .subj-card-v3:hover {
  transform: translateY(-4px);
  border-color: var(--s-solid, var(--v3-brand-1));
  box-shadow: 0 24px 44px rgba(14,18,25,.10), 0 4px 12px rgba(14,18,25,.06);
}
.theme-v3.premium .subj-card-v3 .icon-v3 {
  width: 56px; height: 56px;
  border-radius: 14px;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -.02em;
  box-shadow: 0 8px 18px var(--s-shadow), inset 0 1px 0 rgba(255,255,255,.18);
}
.theme-v3.premium .subj-card-v3 .name-v3 {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.015em;
  margin-bottom: .3rem;
}
.theme-v3.premium .subj-card-v3 .meta-v3 {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: .82rem;
  color: var(--v3-ink-3);
}
.theme-v3.premium .subj-card-v3 .meta-v3 b {
  color: var(--v3-ink-2);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
}


/* ---------- Refined BOOKS SHOWCASE ---------- */
.theme-v3.premium .books-showcase {
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 2rem 1.4rem;
}
.theme-v3.premium .bs-cover {
  border-radius: 6px;
  border: 1px solid var(--v3-line);
  box-shadow: 0 1px 2px rgba(14,18,25,.05),
              0 4px 8px rgba(14,18,25,.04),
              inset 0 0 0 1px rgba(255,255,255,.4);
  transition: transform .22s ease, box-shadow .22s ease;
  position: relative;
}
.theme-v3.premium .bs-cover::after {
  /* spine highlight — like a real book */
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 4px;
  background: linear-gradient(90deg, rgba(0,0,0,.10), transparent);
  pointer-events: none;
  border-radius: 0 6px 6px 0;
}
.theme-v3.premium .bs-book:hover .bs-cover {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow: 0 20px 40px rgba(14,18,25,.15),
              0 6px 12px rgba(14,18,25,.08);
}
.theme-v3.premium .bs-name {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.005em;
  line-height: 1.4;
  color: var(--v3-ink-1);
  margin-top: .7rem;
}
.theme-v3.premium .bs-branch {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: .76rem;
  font-weight: 500;
  color: var(--v3-gold);
  letter-spacing: .04em;
  margin-top: .2rem;
}


/* ---------- Refined FEATURES ---------- */
.theme-v3.premium .feat-v3 {
  background: var(--v3-surface);
  border: 1px solid var(--v3-line);
  border-radius: 16px;
  padding: 1.5rem;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(14,18,25,.02);
}
.theme-v3.premium .feat-v3:hover {
  transform: translateY(-3px);
  border-color: var(--v3-brand-1);
  box-shadow: 0 16px 32px rgba(14,18,25,.08), 0 4px 8px rgba(14,18,25,.05);
}
.theme-v3.premium .feat-icon-v3 {
  width: 46px; height: 46px;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.theme-v3.premium .feat-i-1 { background: linear-gradient(135deg, #4C50A6, #7649AB); }
.theme-v3.premium .feat-i-2 { background: linear-gradient(135deg, #0F766E, #059669); }
.theme-v3.premium .feat-i-3 { background: linear-gradient(135deg, #92400E, #D97706); }
.theme-v3.premium .feat-i-4 { background: linear-gradient(135deg, #9F1239, #DB2777); }
.theme-v3.premium .feat-title-v3 {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -.015em;
  color: var(--v3-ink-1);
}
.theme-v3.premium .feat-desc-v3 {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color: var(--v3-ink-3);
  font-size: .87rem;
  line-height: 1.65;
}


/* ---------- Premium Mission Strip (new — replaces plain features feel) ---------- */
.theme-v3.premium .mission-strip {
  background: linear-gradient(135deg, var(--v3-brand-ink) 0%, #2A1F5B 100%);
  color: #fff;
  border-radius: 20px;
  padding: 2.5rem 2.2rem;
  margin: 3rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(30,27,75,.24);
}
.theme-v3.premium .mission-strip::before {
  content: ""; position: absolute; top: -50%; right: -20%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,.06), transparent 70%);
  border-radius: 50%;
}
.theme-v3.premium .mission-strip::after {
  content: ""; position: absolute; bottom: -50%; left: -20%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(176,136,64,.10), transparent 70%);
  border-radius: 50%;
}
.theme-v3.premium .mission-strip > * { position: relative; z-index: 1; }
.theme-v3.premium .mission-strip .grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}
@media (max-width: 720px) {
  .theme-v3.premium .mission-strip .grid { grid-template-columns: repeat(2, 1fr); gap: 2rem 1rem; }
}
.theme-v3.premium .mission-strip .stat-n {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2.2rem, 4vw, 3rem);
  line-height: 1;
  color: #F0E1BC;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.03em;
  margin-bottom: .5rem;
}
.theme-v3.premium .mission-strip .stat-l {
  font-family: 'Tajawal', system-ui, sans-serif;
  font-size: .82rem;
  letter-spacing: .12em;
  color: rgba(255,255,255,.65);
  text-transform: uppercase;
  font-weight: 600;
}


/* ---------- Refined footer ---------- */
.theme-v3.premium footer.footer {
  padding-top: 3rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--v3-line);
  background: transparent;
  color: var(--v3-ink-3);
}
.theme-v3.premium footer.footer a { color: var(--v3-brand-ink); font-weight: 700; }


/* ---------- Subtle scroll animations ---------- */
@keyframes premium-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.theme-v3.premium .section-head-v3,
.theme-v3.premium .subj-card-v3,
.theme-v3.premium .bs-book,
.theme-v3.premium .feat-v3 {
  animation: premium-rise .5s ease-out both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
@media (prefers-reduced-motion: reduce) {
  .theme-v3.premium * { animation: none !important; }
}


/* ---------- Mobile refinements ---------- */
@media (max-width: 768px) {
  .theme-v3.premium .hero-main-v3 { padding: 2rem 1.5rem; border-radius: 16px; }
  .theme-v3.premium .hero-h1-v3 { font-size: clamp(1.7rem, 6vw, 2.2rem); }
  .theme-v3.premium .countdown-v3 { padding: 1.2rem; }
  .theme-v3.premium .cd-big { font-size: 2.6rem; }
  .theme-v3.premium .section-head-v3 { margin-top: 2.5rem; }
  .theme-v3.premium .mission-strip { padding: 1.8rem 1.4rem; border-radius: 16px; }
}
