/* خريطة مذاكرة JEPA — layout على Plasma One tokens */

/* Inter has no Arabic glyphs, so Arabic falls through to Plex Arabic glyph by glyph. */
:root {
  --font: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --container: 1200px;
  --gutter: 32px;
  --nav-h: 64px;
  color-scheme: light dark;
}
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--p1-background-neutral);
  color: var(--p1-label-primary);
  font: 500 17px/28px var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--p1-dur-themeFade) linear, color var(--p1-dur-themeFade) linear;
}
/* Plasma One tracks every size at −4 %, but tracking breaks joined Arabic script, so it only applies to Latin runs. */
:lang(en) { letter-spacing: -0.04em; }
bdi { unicode-bidi: isolate; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

.icon {
  font-family: "Material Symbols Rounded";
  font-weight: 400; font-style: normal; font-size: 20px; line-height: 1;
  display: inline-block; direction: ltr; user-select: none; letter-spacing: 0;
  font-variation-settings: "FILL" 0, "wght" 400, "opsz" 20;
}
.icon.fill { font-variation-settings: "FILL" 1, "wght" 500, "opsz" 20; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border: 0; border-radius: var(--p1-radius-full);
  font: 500 15px/20px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform var(--p1-spring-smooth-duration) var(--p1-spring-smooth), filter 120ms linear, background-color 120ms linear;
}
.btn:active { transform: scale(0.964); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.accent {
  background: var(--p1-glass-accent); color: var(--p1-label-alwaysWhite);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 8px rgba(1,78,145,0.2);
}
.btn.accent:hover { filter: brightness(1.08); }
.btn.secondary {
  background: var(--p1-glass-default); color: var(--p1-label-primary);
  box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral), inset 0 1px 0 rgba(255,255,255,0.1), 0 4px 8px rgba(0,0,0,0.065);
}
.btn.secondary:hover { filter: brightness(1.04); }
.btn.ghost { background: transparent; color: var(--p1-label-secondary); }
.btn.ghost:hover { background: var(--p1-surface-ghost); color: var(--p1-label-primary); }
:is(.btn, a, button):focus-visible { outline: 2px solid var(--p1-border-accent); outline-offset: 2px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--p1-label-accent); cursor: pointer; }
.linklike:hover { text-decoration: underline; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20; height: var(--nav-h);
  background: color-mix(in srgb, var(--p1-background-neutral) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  box-shadow: 0 0.5px 0 var(--p1-border-neutral);
}
.nav-in { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 16px/24px var(--font); text-decoration: none; white-space: nowrap; }
.mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--p1-glass-accent); color: var(--p1-label-alwaysWhite);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.mark .icon { font-size: 18px; }
.nav-links { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--p1-radius-full);
  font: 500 14px/20px var(--font); color: var(--p1-label-secondary); text-decoration: none;
  transition: background-color 120ms linear, color 120ms linear;
}
.nav-links a:hover { background: var(--p1-surface-ghost); color: var(--p1-label-primary); }
.nav-links a.active { background: var(--p1-surface-default); color: var(--p1-label-primary); box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral), var(--p1-elevation-1); }
.nav-links .icon { font-size: 18px; }
.nav-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 48px; }
.eyebrow { font: 500 14px/20px var(--font); color: var(--p1-label-accent); margin: 0 0 16px; }
.hero h1 { font: 600 56px/72px var(--font); margin-bottom: 20px; }
.lede { margin: 0; color: var(--p1-label-secondary); font-size: 19px; line-height: 34px; max-width: 620px; }
.lede b { color: var(--p1-label-primary); font-weight: 600; }
.paper-card {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; padding: 14px 16px; max-width: 620px;
  border-radius: var(--p1-radius-lg); text-decoration: none;
  background: var(--p1-surface-ghost); box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral);
  transition: background-color 120ms linear;
}
.paper-card:hover { background: var(--p1-surface-default); }
.paper-card .icon { color: var(--p1-label-accent); margin-top: 2px; }
/* English title inside RTL page: right-aligned so it lines up with the Arabic above it */
.paper-name { flex: 1; text-align: right; font: 600 16px/24px var(--font); color: var(--p1-label-primary); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.hero-panel {
  padding: 8px; border-radius: 32px;
  background: var(--p1-glass-emphasis);
  box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral), var(--p1-elevation-4);
}
.tier-row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 16px; border-radius: var(--p1-radius-xl); text-decoration: none;
  transition: background-color 120ms linear, transform var(--p1-spring-smooth-duration) var(--p1-spring-smooth);
}
.tier-row:hover { background: var(--p1-surface-ghost); }
.tier-row:active { transform: scale(0.98); }
.tier-row + .tier-row { box-shadow: 0 -0.5px 0 var(--p1-border-neutral); }
.tier-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.tier-row .name { font: 600 17px/24px var(--font); }
.tier-row .desc { font: 500 14px/20px var(--font); color: var(--p1-label-secondary); }
.tier-row .nums { text-align: start; font: 600 15px/20px var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tier-row .nums small { display: block; font: 500 13px/18px var(--font); color: var(--p1-label-tertiary); }
.tier-row .bar { grid-column: 2 / -1; }

.bar { height: 4px; border-radius: 2px; background: var(--p1-surface-ghost); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: currentColor;
  transition: width var(--p1-dur-viewTransition) var(--p1-ease-viewTransition); }

/* per-tier colour */
.t-core { --tc: var(--p1-label-accent); --tbg: var(--p1-surface-accentSubdued); }
.t-short { --tc: var(--p1-label-success); --tbg: var(--p1-surface-successSubdued); }
.t-long { --tc: var(--p1-label-warning); --tbg: var(--p1-surface-warningSubdued); }
.tier-ico { background: var(--tbg); color: var(--tc); }
.t-core .bar, .t-short .bar, .t-long .bar { color: var(--tc); }

/* ---------- How ---------- */
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 64px; }
.how-step {
  display: flex; gap: 14px; padding: 20px; border-radius: var(--p1-radius-xl);
  background: var(--p1-surface-default); box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral);
}
.how-n {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font: 600 15px/1 var(--font); background: var(--p1-glass-inverse); color: var(--p1-label-inverse);
}
.how h3 { font: 600 17px/26px var(--font); margin-bottom: 4px; }
.how p { margin: 0; font-size: 15px; line-height: 25px; color: var(--p1-label-secondary); }

/* ---------- Layout: TOC + content ---------- */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px; align-items: start; padding-bottom: 96px; }
.toc { position: sticky; top: calc(var(--nav-h) + 24px); max-height: calc(100vh - var(--nav-h) - 48px); overflow: auto; }
.toc-tier { margin-bottom: 20px; }
.toc-tier > a {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--p1-radius-md);
  font: 600 15px/22px var(--font); text-decoration: none;
}
.toc-tier > a .icon { color: var(--tc); font-size: 18px; }
.toc-tier > a .count { margin-inline-start: auto; font: 500 13px/18px var(--font); color: var(--p1-label-tertiary); font-variant-numeric: tabular-nums; }
.toc-tier .bar { margin: 6px 10px 8px; }
.toc-tier ul { list-style: none; margin: 0; padding: 0 10px 0 0; border-inline-start: 0.5px solid var(--p1-border-neutral); margin-inline-start: 18px; }
.toc-tier li a {
  display: block; padding: 5px 12px; margin-inline-start: -0.5px; border-inline-start: 2px solid transparent;
  font: 500 14px/20px var(--font); color: var(--p1-label-secondary); text-decoration: none;
  transition: color 120ms linear, border-color 120ms linear;
}
.toc-tier li a:hover { color: var(--p1-label-primary); }
.toc-tier li a.active { color: var(--p1-label-primary); border-inline-start-color: var(--tc); }

/* ---------- Tier sections ---------- */
.tier { margin-bottom: 96px; }
.tier-head {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start;
  padding: 28px; border-radius: 32px; margin-bottom: 40px;
  background: var(--tbg);
}
.tier-head .tier-ico { width: 56px; height: 56px; border-radius: 18px; background: var(--p1-surface-default); box-shadow: var(--p1-elevation-2); }
.tier-head .tier-ico .icon { font-size: 28px; }
.tier-head .kicker { font: 600 14px/20px var(--font); color: var(--tc); margin-bottom: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.tier-head .kicker span + span::before { content: "•"; margin-inline-end: 12px; color: var(--p1-label-tertiary); }
.tier-head h2 { font: 600 32px/44px var(--font); margin-bottom: 10px; }
.tier-head p { margin: 0; color: var(--p1-label-secondary); font-size: 17px; line-height: 30px; max-width: 760px; }

.phase { margin-bottom: 56px; }
.phase-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.phase-head h3 { font: 600 24px/34px var(--font); }
.phase-head .time { font: 500 14px/20px var(--font); color: var(--p1-label-tertiary); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.phase-head .time .icon { font-size: 16px; }
.phase > .why { margin: 0 0 20px; color: var(--p1-label-secondary); font-size: 16px; line-height: 28px; max-width: 760px; }

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

/* ---------- Cards ---------- */
.card {
  display: flex; flex-direction: column; padding: 20px; border-radius: var(--p1-radius-xl);
  background: var(--p1-surface-default);
  box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral), var(--p1-elevation-1);
  transition: box-shadow 200ms var(--p1-ease-cubicOut), opacity var(--p1-dur-themeFade) linear, transform 200ms var(--p1-ease-cubicOut);
}
.card:hover { box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral), var(--p1-elevation-4); transform: translateY(-2px); }
.card.done { opacity: 0.6; }
.card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.idx {
  flex: none; min-width: 28px; height: 28px; padding: 0 6px; border-radius: var(--p1-radius-full); display: grid; place-items: center;
  font: 600 13px/1 var(--font); font-variant-numeric: tabular-nums; background: var(--tbg); color: var(--tc);
}
.card h4 { flex: 1; font: 600 18px/28px var(--font); }
.check {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  cursor: pointer;
  background: var(--p1-surface-ghost); color: var(--p1-label-secondary); box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral);
  transition: transform var(--p1-spring-smooth-duration) var(--p1-spring-smooth), background-color 120ms linear, color 120ms linear;
}
.check:hover { color: var(--p1-label-primary); }
.check:active { transform: scale(0.964); }
.check .icon { font-size: 18px; }
.check[aria-pressed="true"] { background: var(--p1-surface-success); color: var(--p1-label-alwaysWhite); box-shadow: none; }

.facts { display: grid; gap: 8px; margin: 0 0 14px; }
.fact { display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: 15px; line-height: 25px; }
.fact dt { color: var(--p1-label-tertiary); font-weight: 500; }
.fact dd { margin: 0; color: var(--p1-label-secondary); }
.note { display: flex; gap: 6px; margin: -4px 0 14px; padding: 8px 12px; border-radius: var(--p1-radius-md); background: var(--p1-surface-ghost);
  font-size: 14px; line-height: 22px; color: var(--p1-label-secondary); }
.note .icon { font-size: 16px; margin-top: 3px; color: var(--p1-label-tertiary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: var(--p1-radius-full);
  font: 500 13px/18px var(--font); background: var(--p1-surface-ghost); color: var(--p1-label-secondary); }
.chip .icon { font-size: 15px; }

.links { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; box-shadow: 0 -0.5px 0 var(--p1-border-neutral); }
.link {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) 16px; gap: 10px; align-items: start;
  padding: 8px 10px; margin: 0 -10px; border-radius: var(--p1-radius-md); text-decoration: none;
  font-size: 15px; line-height: 22px; transition: background-color 120ms linear;
}
.link:hover { background: var(--p1-surface-ghost); }
.link .icon { color: var(--p1-label-accent); font-size: 20px; }
.link.ar .icon { color: var(--p1-label-tertiary); }
.link > .icon { margin-top: 1px; }
.link .t { min-width: 0; display: grid; gap: 2px; }
.link .name { overflow-wrap: anywhere; }
/* source · language · duration on one muted line, so the title keeps the full width on any screen */
.link .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font: 500 13px/18px var(--font); color: var(--p1-label-tertiary); }
.link .lang { font: 600 11px/14px var(--font); padding: 1px 6px; border-radius: var(--p1-radius-xs); background: var(--p1-surface-ghost); }
.link .mins { white-space: nowrap; font-variant-numeric: tabular-nums; }
.link .ext { font-size: 16px; color: var(--p1-label-tertiary); opacity: 0; margin-top: 3px; transition: opacity 120ms linear; }
.link:hover .ext { opacity: 1; }
.link:hover .name { color: var(--p1-label-accent); }

/* checkpoint banner */
.checkpoint {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; margin-top: 16px; padding: 18px 22px; border-radius: var(--p1-radius-xl);
  background: var(--p1-glass-inverse); color: var(--p1-label-inverse); text-decoration: none; box-shadow: var(--p1-elevation-3);
  transition: transform var(--p1-spring-smooth-duration) var(--p1-spring-smooth), box-shadow 200ms linear;
}
.checkpoint:hover { box-shadow: var(--p1-elevation-5); }
.checkpoint:active { transform: scale(0.98); }
.checkpoint > .icon { font-size: 26px; }
.checkpoint .k { font: 600 13px/18px var(--font); opacity: 0.6; }
.checkpoint .v { font-size: 16px; line-height: 26px; }
.checkpoint .go { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; font: 600 14px/20px var(--font); white-space: nowrap; }

.gaps { display: flex; gap: 12px; padding: 20px; border-radius: var(--p1-radius-xl); background: var(--p1-surface-ghost);
  box-shadow: inset 0 0 0 0.5px var(--p1-border-neutral); color: var(--p1-label-secondary); font-size: 15px; line-height: 26px; }
.gaps h4 { font: 600 16px/24px var(--font); color: var(--p1-label-primary); margin-bottom: 4px; }
.gaps > .icon { color: var(--p1-label-tertiary); margin-top: 2px; }

/* ---------- Footer ---------- */
.footer { box-shadow: 0 -0.5px 0 var(--p1-border-neutral); padding: 48px 0 56px; background: var(--p1-surface-ghost); }
.footer-in { display: grid; grid-template-columns: 1.2fr 1fr 1fr 0.9fr; gap: 32px; }
.footer h4 { font: 600 14px/20px var(--font); margin-bottom: 8px; }
.footer p { margin: 8px 0 0; font-size: 14px; line-height: 24px; color: var(--p1-label-secondary); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; line-height: 22px; }
.footer a { color: var(--p1-label-accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------- Mobile menu (sheet under the nav) ---------- */
.menu-btn { display: none; }
.mobile-menu {
  position: absolute; inset-inline: 0; top: 100%;
  background: var(--p1-background-neutral); box-shadow: 0 0.5px 0 var(--p1-border-neutral), var(--p1-elevation-4);
  border-radius: 0 0 28px 28px; max-height: calc(100vh - var(--nav-h)); overflow: auto;
  animation: menu-in var(--p1-dur-sheetIn) var(--p1-ease-viewTransition) both;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu-in { padding: 16px 0 24px; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.scrim { position: fixed; inset: 0; z-index: 15; background: var(--p1-surface-scrim); animation: fade-in var(--p1-dur-sheetIn) linear both; }
.scrim[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Enter motion ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; }
.reveal.in { animation: enter 450ms var(--p1-ease-viewTransition) both; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .nav-links a .label-long { display: none; }
}
@media (max-width: 1080px) {
  .menu-btn { display: inline-flex; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 40px; }
  .how { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-bottom: 48px; }
  .footer-in { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  .nav-actions { margin-inline-start: auto; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; --nav-h: 56px; }
  body { font-size: 16px; line-height: 27px; }
  .brand { font-size: 15px; }
  .nav-actions { gap: 4px; }
  .nav-actions .btn.accent { width: 36px; padding: 0; }
  .nav-actions .btn.accent .txt { display: none; }

  .hero { padding-top: 28px; padding-bottom: 32px; }
  .eyebrow { margin-bottom: 10px; }
  .hero h1 { font-size: 36px; line-height: 48px; margin-bottom: 14px; }
  .lede { font-size: 17px; line-height: 30px; }
  .paper-name { font-size: 15px; line-height: 22px; }
  .hero-cta { flex-direction: column; margin-top: 24px; }
  .hero-cta .btn { width: 100%; }
  .hero-panel { border-radius: var(--p1-radius-xl); padding: 4px; }
  .tier-row { grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; padding: 14px 12px; }
  .tier-ico { width: 40px; height: 40px; border-radius: 12px; }
  .tier-row .nums { grid-column: 2; display: flex; gap: 8px; align-items: baseline; }
  .tier-row .nums small { display: inline; }
  .tier-row .bar { grid-column: 2; margin-top: 6px; }

  .how-step { padding: 16px; }

  .layout { padding-bottom: 48px; }
  .tier { margin-bottom: 64px; }
  .tier-head { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 20px; border-radius: var(--p1-radius-xl); margin-bottom: 28px; }
  .tier-head .tier-ico { width: 44px; height: 44px; border-radius: 14px; }
  .tier-head .tier-ico .icon { font-size: 22px; }
  .tier-head .kicker { gap: 6px; margin-bottom: 8px; }
  .tier-head .kicker span { padding: 2px 10px; border-radius: var(--p1-radius-full); background: var(--p1-surface-default); }
  .tier-head .kicker span + span::before { content: none; }
  .tier-head h2 { font-size: 24px; line-height: 34px; }
  .tier-head p { font-size: 16px; line-height: 28px; }

  .phase { margin-bottom: 40px; }
  .phase-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .phase-head h3 { font-size: 21px; line-height: 30px; }
  .phase > .why { font-size: 15px; line-height: 26px; margin-bottom: 16px; }

  .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 16px; }
  .card:hover { transform: none; }
  .card h4 { font-size: 17px; line-height: 26px; }
  .fact { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .link { margin: 0 -8px; padding: 8px; }
  .link .ext { display: none; }

  .checkpoint { flex-wrap: wrap; padding: 16px; gap: 10px 14px; }
  .checkpoint > span:nth-child(2) { flex: 1; min-width: 0; }
  .checkpoint .go { flex-basis: 100%; margin-inline-start: 0; }
  .gaps { padding: 16px; }

  .footer { padding: 32px 0 40px; }
  .footer-in { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 180ms !important; transition-duration: 1ms !important; }
  .card:hover { transform: none; }
  .reveal { opacity: 1; }
}
