/* Shared stage for the four Academy subject journeys. The app cards come from the Academy catalog.
   This file is the STATIC layout (it is all a no-JS or reduced-motion visitor gets, and it is already the
   journey: pinned art, a route, a finish line). The scroll-driven layer lives in subject-scene.css + .js. */
body.subjectPage {
  --deep: #070c1d;
  overflow-x: clip;
  background: radial-gradient(circle at 72% 14%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 32%),
    radial-gradient(circle at 20% 35%, color-mix(in srgb, var(--secondary) 11%, transparent), transparent 35%), var(--deep);
}
body.subjectPage::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(#ffffff66 .6px, transparent .8px);
  background-size: 35px 35px;
  opacity: .16;
  mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent);
}
nav.subjectNav {
  min-height: 64px;
  padding: 8px max(20px, env(safe-area-inset-right, 0px)) 8px calc(70px + env(safe-area-inset-left, 0px));
  background: #060b19e8;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  backdrop-filter: blur(16px);
  justify-content: space-between;
}
nav.subjectNav .brand { min-height: 44px; }
.subjectNav .links { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.subjectNav .links a { min-height: 44px; display: inline-flex; align-items: center; color: #b9c5df; font-size: 13px; }
.subjectNav .links a:hover { color: var(--accent); }
.subjectPage a:focus-visible { outline: 3px solid #fff1b7; outline-offset: 5px; border-radius: 6px; }
.subjectProgress {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  width: 4px;
  height: 100vh;
  transform: scaleY(0);
  transform-origin: top;
  background: linear-gradient(var(--accent), var(--secondary));
  box-shadow: 0 0 18px var(--accent);
  pointer-events: none;
}
.subjectIntro {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr);
  align-items: center;
  gap: clamp(20px, 5vw, 90px);
  max-width: none;
  min-height: calc(100svh - 64px);
  padding: 110px max(7vw, 24px) 80px;
  overflow: hidden;
}
.subjectIntro::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at 75% 50%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 34%),
    linear-gradient(125deg, #060b19 2%, transparent 45%, color-mix(in srgb, var(--secondary) 7%, transparent));
}
.subjectIntro::after {
  content: "";
  position: absolute;
  inset: auto -12% -130px;
  height: 220px;
  z-index: -1;
  pointer-events: none;
  border-top: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 50% 50% 0 0;
  box-shadow: 0 -34px 80px -75px var(--accent);
}
.subjectCopy {
  position: relative;
  z-index: 2;
  max-width: 690px;
}
.subjectIntro .crumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 42px; color: #aebcd8; font-size: 12px; letter-spacing: .08em; }
.subjectIntro .crumbs a { color: #c7d2e9; }
.subjectIntro .crumbs a:hover { color: var(--accent); text-decoration: underline; }
.subjectIntro .kicker { color: var(--accent); font: 700 11px/1.5 'Space Grotesk', sans-serif; letter-spacing: .32em; text-transform: uppercase; animation: none; opacity: 1; }
.subjectIntro h1 { max-width: 12ch; margin: 22px 0 28px; color: #f7f8ff; font: 400 clamp(45px, 7vw, 112px)/.95 Michroma, sans-serif; letter-spacing: -.055em; text-wrap: balance; }
.subjectIntro h1 a { color: inherit; text-decoration: none; }
.subjectIntro h1 a:hover { color: var(--accent); }
.subject-math .subjectIntro h1 { font-size: clamp(43px, 5.35vw, 83px); }
.subject-social-studies .subjectIntro h1 { font-size: clamp(43px, 5.6vw, 86px); }
.subjectIntro p { max-width: 31ch; margin: 0; color: #becbe6; font-size: clamp(18px, 2vw, 25px); line-height: 1.48; }
.subjectMotto { display: block; margin: 36px 0 0; color: var(--secondary); font: 700 12px/1.4 'Space Grotesk', sans-serif; letter-spacing: .22em; }
.subjectPortal {
  display: block;
  position: relative;
  width: 100%;
  max-width: min(44vw, 570px);
  aspect-ratio: 1;
  margin: auto;
  filter: drop-shadow(0 30px 50px #0009);
  outline-offset: 12px;
}
.subjectPortal::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 17%, transparent), transparent 70%);
  filter: blur(25px);
  pointer-events: none;
}
.subjectPortal::after {
  content: "EXPLORE THE WORLDS ↘";
  position: absolute;
  right: -1%;
  bottom: 2%;
  padding: 11px 17px;
  color: #e9eeff;
  background: #111a32e6;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 999px;
  box-shadow: 0 12px 30px #0007;
  font: 700 10px/1.2 'Space Grotesk', sans-serif;
  letter-spacing: .14em;
  transition: transform .3s, background .3s;
}
.subjectPortal:hover::after, .subjectPortal:focus-visible::after { transform: translate(3px, -4px); background: #202a47; }
.subjectPortal svg { display: block; width: 100%; height: 100%; overflow: hidden; transition: transform .7s cubic-bezier(.2, 1, .2, 1); }
.subjectPortal:hover svg { transform: scale(1.045) rotate(2deg); }
.scene-rotate { transform-origin: 260px 260px; animation: sceneOrbit 42s linear infinite; }
@keyframes sceneOrbit { to { transform: rotate(360deg); } }
.subjectScroll {
  position: absolute;
  left: max(7vw, 24px);
  bottom: 38px;
  display: inline-flex;
  gap: 14px;
  align-items: center;
  padding: 8px 0;
  color: var(--accent);
  font: 700 11px/1 'Space Grotesk', sans-serif;
  letter-spacing: .2em;
  text-decoration: none;
}
.subjectScroll span { display: grid; place-items: center; width: 30px; height: 44px; border: 1px solid currentColor; border-radius: 18px; animation: scrollPulse 2.3s ease-in-out infinite; }
.subjectScroll span::after { content: "↓"; font-size: 17px; letter-spacing: 0; }
@keyframes scrollPulse { 50% { transform: translateY(7px); box-shadow: 0 0 23px color-mix(in srgb, var(--accent) 35%, transparent); } }
.subjectPrelude {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(25px, 5vw, 70px);
  align-items: end;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(150px, 30vh, 290px) clamp(22px, 6vw, 70px) 35px;
  scroll-margin-top: 80px;
}
.subjectPrelude .count { color: color-mix(in srgb, var(--accent) 30%, transparent); font: 400 clamp(90px, 18vw, 230px)/.75 Michroma, sans-serif; letter-spacing: -.12em; text-shadow: 0 0 60px color-mix(in srgb, var(--accent) 10%, transparent); }
.subjectPrelude .eyebrow { color: var(--accent); font: 700 11px/1 'Space Grotesk', sans-serif; letter-spacing: .28em; }
.subjectPrelude h2 { max-width: 14ch; margin: 14px 0 0; font: 400 clamp(25px, 4vw, 50px)/1.1 Michroma, sans-serif; letter-spacing: -.04em; }
nav.worldRail {
  position: fixed;
  z-index: 60;
  top: 50%;
  left: auto;
  right: 19px;
  display: grid;
  width: auto;
  min-height: 0;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 9px;
  row-gap: 9px !important;
  padding: 10px 7px;
  transform: translateY(-50%);
  background: #0a1124c9;
  border: 1px solid #ffffff25;
  border-radius: 30px;
  backdrop-filter: blur(14px);
}
.worldRail a { display: grid; place-items: center; width: 44px; height: 44px; color: #a9bbd6; border: 1px solid transparent; border-radius: 50%; text-decoration: none; font: 700 12px/1 Michroma, sans-serif; transition: background .25s, color .25s, transform .25s; }
.worldRail a:hover, .worldRail a:focus-visible, .worldRail a.is-current { color: #11172a; background: var(--accent); transform: scale(1.08); }
section.apps { position: relative; max-width: 1220px; padding: 20px clamp(32px, 6vw, 90px) 75px; counter-reset: world; }
section.apps::before { content: ""; position: absolute; top: 0; bottom: 70px; left: clamp(20px, 4vw, 60px); width: 1px; background: linear-gradient(transparent, var(--accent) 8%, var(--secondary) 80%, transparent); opacity: .4; pointer-events: none; }
.app { counter-increment: world; position: relative; min-height: 0; margin-bottom: 20px; padding: 60px 0; scroll-margin-top: 70px; gap: clamp(36px, 5vw, 92px); }
.app::before { content: counter(world, decimal-leading-zero); position: absolute; top: 95px; left: calc(-1 * clamp(25px, 4.6vw, 70px)); display: grid; place-items: center; width: 42px; height: 42px; color: var(--accent); background: #10192f; border: 1px solid color-mix(in srgb, var(--accent) 56%, transparent); border-radius: 50%; box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 20%, transparent); font: 700 11px/1 Michroma, sans-serif; }
.app .art { position: relative; }
.app .app-art { display: block; transition: transform .55s cubic-bezier(.2, 1, .2, 1), box-shadow .55s, border-color .55s; }
.app .app-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--accent) 25%, transparent) 50%, transparent 70%); transform: translateX(-140%); }
.app .app-art:hover, .app .app-art:focus-visible, .app.is-current .app-art { box-shadow: 0 36px 95px #0009, 0 0 68px -28px var(--accent); }
/* THE PIN (pure CSS, so it is the same with scripts off): the art column stretches to the row and the card
   sticks inside it while the copy scrolls past. Phones get a short runway instead (spec: <= 40 % of the row). */
@media (min-width: 761px) {
  section.apps > article.app { align-items: stretch; min-height: clamp(700px, 122vh, 1180px); margin-bottom: 0; padding: 4vh 0; }
  section.apps > article.app > .art { align-self: stretch; }
  section.apps > article.app > .app-copy { align-self: center; }
  .app .app-art { position: sticky; top: max(12vh, 84px); }
}
@media (max-width: 760px) {
  .app .art::after { content: ""; display: block; height: 10vh; }
  .app .app-art { position: sticky; top: 76px; }
}
.app .app-copy { position: relative; padding: 28px 0; }
.app .app-copy .num { display: none; }
.app .app-copy::before { content: ""; position: absolute; top: 0; left: 0; width: 100px; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); }
.app .app-copy h3 { font-size: clamp(28px, 3.4vw, 46px); letter-spacing: -.035em; line-height: 1.12; }
.app .app-copy p { color: #b8c5e0; font-size: clamp(15px, 1.2vw, 18px); line-height: 1.65; }
.app .app-copy h3 a { color: #f6f8ff; text-decoration: none; }
.app .app-copy h3 a:hover, .app .app-copy h3 a:focus-visible { color: var(--accent); }
.subjectEnd { max-width: 1080px; margin: 30px auto 120px; padding-top: 38px; border-top: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); text-align: center; }
.subjectEnd a { display: inline-flex; min-height: 44px; align-items: center; color: var(--accent); font-size: 15px; text-decoration: none; }
@media (max-width: 900px) {
  .subjectIntro { grid-template-columns: 1fr; gap: 10px; padding: 115px max(6vw, 24px) 110px; }
  .subjectCopy { max-width: 760px; }
  .subjectIntro h1 { font-size: clamp(46px, 10vw, 86px); }
  .subjectPortal { max-width: min(74vw, 520px); }
  .subjectPrelude { padding-top: clamp(120px, 22vh, 220px); }
  nav.worldRail { right: 8px; }
  .app { min-height: 0; padding: 65px 0; }
  .app::before { top: 76px; }
}
@media (max-width: 650px) {
  nav.subjectNav .links { display: none; }
  .subjectIntro { min-height: auto; padding: 105px 22px 100px; }
  .subjectIntro .crumbs { margin-bottom: 35px; }
  .subjectIntro h1 { margin: 18px 0 20px; font-size: clamp(40px, 10.8vw, 66px); }
  .subjectIntro p { font-size: 18px; }
  .subjectMotto { margin-top: 25px; font-size: 10px; }
  .subjectPortal { max-width: min(95vw, 420px); margin: 10px auto 0; }
  .subjectPortal::after { right: 1%; bottom: 3%; padding: 9px 12px; font-size: 8px; }
  .subjectScroll { left: 24px; bottom: 25px; }
  .subjectPrelude { display: block; padding: 150px 26px 20px; }
  .subjectPrelude .count { font-size: 96px; }
  .subjectPrelude h2 { font-size: 31px; }
  nav.worldRail { display: none; }
  section.apps { padding: 10px 26px 60px 38px; }
  section.apps::before { left: 18px; }
  .app { gap: 20px; margin-bottom: 24px; padding: 54px 0 30px; }
  .app::before { top: 75px; left: -39px; width: 34px; height: 34px; font-size: 9px; }
  .app .app-copy { padding: 20px 0; }
  .app .app-copy h3 { font-size: 29px; }
  .app .app-copy p { font-size: 16px; }
  .subjectEnd { margin: 0 26px 70px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scene-rotate, .subjectScroll span { animation: none !important; }
  .app .app-art::after { display: none; }
  .app .app-art, .subjectPortal svg { transition: none !important; }
}
/* §17 corner mark placeholder: parent-nav.js inserts #aeParentNav before its own stylesheet has loaded, and an unstyled
   inline SVG is full-width for a frame (CLS 1.0 on a cold load). Same box as parent-nav.css; that file still wins once loaded. */
#aeParentNav { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(8px + env(safe-area-inset-left, 0px)); width: 44px; height: 44px; overflow: hidden; z-index: 2147483000; }
#aeParentNav svg { width: 30px; height: 30px; }
