/* ==========================================================================
   IST 5930 — Embodied AI Systems · class site stylesheet
   Theme: dark technical navy + glowing module colors
   Depth/gloss/motion recipes from the Ultra-PC design vault:
   glass-layered · layered-shadows · sheen-sweep · spotlight-hover · tilt-3d
   aurora-blur · animated-gradient-border · scroll/staggered-reveal
   typewriter · gradient-text-shift · card-flip-3d · grain-overlay
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --bg: #0d1b2a;
  --bg-deep: #081221;
  --surface: #13253a;
  --surface-2: #1a3050;
  --line: rgba(148, 197, 255, .14);
  --text: #e2ecf7;
  --muted: #8fa8c4;
  --accent: #05d9e8;

  --m1: #4da3ff;   /* Foundations */
  --m2: #b967ff;   /* Conversation AI */
  --m3: #05ffa1;   /* Motion Retargeting */
  --m4: #ff9f43;   /* Security & Integration */

  --radius: 16px;
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;

  /* layered-shadows (vault: depth) */
  --depth:
    0 1px 1px rgba(2, 8, 20, .25), 0 2px 2px rgba(2, 8, 20, .2),
    0 4px 4px rgba(2, 8, 20, .18), 0 8px 8px rgba(2, 8, 20, .15),
    0 16px 16px rgba(2, 8, 20, .12), 0 32px 32px rgba(2, 8, 20, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

/* module color helpers */
.mc-1 { --mc: var(--m1); }
.mc-2 { --mc: var(--m2); }
.mc-3 { --mc: var(--m3); }
.mc-4 { --mc: var(--m4); }

/* ---------- grain overlay (static — the animated variant repaints a
   2x-viewport layer 7x/sec and causes visible jank; texture reads the same) */
.grain::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- scroll progress bar (vault: scroll-progress-bar) ---------- */
.progressbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 70;
  transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--m1), var(--m2), var(--m3), var(--m4));
}
@supports (animation-timeline: scroll(root)) {
  .progressbar { animation: growbar linear; animation-timeline: scroll(root); }
}
@keyframes growbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-deep) 78%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 1.5rem; padding: .8rem 1.25rem; max-width: 1100px; margin: 0 auto; }
.nav-logo { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: .02em; }
.nav-logo b { color: var(--accent); }
.nav-links { display: flex; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-size: .9rem; transition: color .2s; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ---------- hero (vault: aurora-blur + typewriter + gradient-text-shift) ---------- */
.hero {
  position: relative; overflow: hidden; background: var(--bg-deep);
  padding: 6.5rem 0 5.5rem; text-align: center;
}
.hero::before {
  content: ""; position: absolute; inset: -40%; z-index: 0;
  background:
    radial-gradient(closest-side, rgba(77, 163, 255, .55), transparent) 0% 0% / 55% 55%,
    radial-gradient(closest-side, rgba(5, 217, 232, .4), transparent) 100% 0% / 50% 50%,
    radial-gradient(closest-side, rgba(185, 103, 255, .45), transparent) 50% 100% / 60% 60%;
  background-repeat: no-repeat; filter: blur(70px);
  /* transform drift composites on the GPU; animating background-position
     repaints the whole blurred layer every frame */
  will-change: transform;
  animation: aurora-drift 14s ease-in-out infinite alternate;
}
.hero::after { /* faint grid floor */
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: .16;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 42px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 42px 100%;
  mask-image: linear-gradient(to bottom, transparent 30%, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 30%, black 100%);
}
.hero > .wrap { position: relative; z-index: 1; }
@keyframes aurora-drift { to { transform: translate(7%, 9%) rotate(3deg) scale(1.12); } }

.hero-code {
  font-family: var(--font-mono); font-size: .85rem; color: var(--accent);
  letter-spacing: .25em; text-transform: uppercase; margin-bottom: 1rem;
}
.typewriter { /* set --steps + width in ch via inline style */
  display: inline-block; overflow: hidden; white-space: nowrap;
  border-right: 2px solid var(--accent); vertical-align: bottom; width: 0;
  animation: type 2s steps(var(--steps, 24)) .3s forwards, caret .8s step-end infinite;
}
@keyframes type { to { width: var(--tw, 24ch); } }
@keyframes caret { 50% { border-color: transparent; } }

.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); margin: .3rem 0 .6rem; }
.grad-shift {
  background: linear-gradient(90deg, #4da3ff, #05d9e8, #b967ff, #05ffa1, #4da3ff);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: grad-move 7s linear infinite;
}
@keyframes grad-move { to { background-position: 300% 0; } }
.hero-sub { max-width: 620px; margin: 0 auto 2rem; color: var(--muted); font-size: 1.1rem; }
.hero-cta { display: inline-flex; gap: .9rem; flex-wrap: wrap; justify-content: center; }

.btn { /* cut-corner button (vault: cut-corner-button) — no pills */
  display: inline-block; padding: .75rem 1.7rem; border: none; border-radius: 0;
  font-family: var(--font-display); font-weight: 600; font-size: .88rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text);
  background: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.04));
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow: inset 0 0 0 1px rgba(148,197,255,.3), inset 0 1px 0 rgba(255,255,255,.2);
  filter: drop-shadow(0 6px 14px rgba(2,8,20,.35));
  transition: transform .2s, filter .2s; cursor: pointer;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; filter: drop-shadow(0 10px 20px rgba(2,8,20,.4)); }
.btn-accent { background: linear-gradient(135deg, #2b8fd6, #05d9e8); color: #06121f; box-shadow: inset 0 1px 0 rgba(255,255,255,.45); }

/* sheen-sweep (vault) — glossy hover swipe */
.sheen { position: relative; overflow: hidden; }
.sheen::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-130%);
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.35) 50%, transparent 60%);
  transition: transform .6s; pointer-events: none;
}
.sheen:hover::after { transform: translateX(130%); }

/* hero robot stats ticker */
.ticker { display: flex; gap: 2.4rem; justify-content: center; margin-top: 3rem; flex-wrap: wrap; }
.ticker div { text-align: center; }
.ticker .num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--accent); }
.ticker .lbl { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- sections ---------- */
section { padding: 4.5rem 0; }
.section-head { text-align: center; max-width: 700px; margin: 0 auto 3rem; }
.kicker {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .3em;
  text-transform: uppercase; color: var(--mc, var(--accent)); display: block; margin-bottom: .6rem;
}
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0 0 .8rem; }

/* ---------- HUD plate (vault: hud-plate) — the anti-bubble container ----------
   Cut corners (top-right + bottom-left) via clip-path, a module-colored notch
   strip along the cut, hairline inset edge, drop-shadow depth that follows the
   shape, and a corner-cut morph on hover. No border-radius anywhere. */
@property --cut { syntax: "<length>"; initial-value: 18px; inherits: false; }
.glass {
  --cut: 18px;
  position: relative;
  background:
    linear-gradient(to bottom left, color-mix(in srgb, var(--mc, var(--accent)) 75%, transparent) calc(var(--cut) + 1px), transparent calc(var(--cut) + 1px)) top right / calc(var(--cut) * 2.2) calc(var(--cut) * 2.2) no-repeat,
    linear-gradient(rgba(148, 197, 255, .09), rgba(148, 197, 255, .02)),
    linear-gradient(rgba(19, 37, 58, .45), rgba(19, 37, 58, .45));
  /* no backdrop-filter: the page bg behind plates is nearly flat, so the
     frosted blur was invisible but cost a live blur pass per plate (~25 on
     the homepage). A translucent surface tint reads identically. */
  border: none;
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  box-shadow: inset 0 0 0 1px rgba(148, 197, 255, .17), inset 0 1px 0 rgba(255, 255, 255, .12);
  filter: drop-shadow(0 12px 24px rgba(2, 8, 20, .35));
  transition: --cut .35s cubic-bezier(.22, 1, .36, 1);
}
.glass:hover { --cut: 30px; }

/* ---------- narrative (vault: editorial-float) — boxless floating text ---------- */
.narrative { background: linear-gradient(180deg, var(--bg-deep), var(--bg)); overflow: hidden; }
.narrative-flow { position: relative; max-width: 760px; margin: 0 auto; padding: 1.5rem 0 1.5rem 2.2rem; }
.narrative-flow::before { /* glowing spine instead of a box */
  content: ""; position: absolute; left: 0; top: .4rem; bottom: .4rem; width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--m2) 55%, transparent);
  box-shadow: 0 0 14px var(--accent);
}
.narrative-flow::after { /* ghost stroke word floating behind */
  content: "MINDSET"; position: absolute; z-index: -1; right: -14rem; top: -3.2rem;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(6rem, 16vw, 11rem);
  letter-spacing: .04em; color: transparent;
  -webkit-text-stroke: 1px rgba(148, 197, 255, .13);
  pointer-events: none; user-select: none;
}
.narrative-flow h2 { margin-top: .4rem; font-size: clamp(2rem, 4.5vw, 3rem); }
.narrative-flow p { color: var(--muted); font-size: 1.05rem; max-width: 62ch; }
.narrative-flow p:first-of-type { color: var(--text); font-size: 1.28rem; line-height: 1.55; font-weight: 500; }
.narrative-flow p + p { margin-top: 1.15rem; }

/* ---------- journey arc ---------- */
.journey svg { width: 100%; height: auto; display: block; }
.journey .node-label { font-family: var(--font-display); font-weight: 600; fill: var(--text); }
.journey .node-sub { fill: var(--muted); font-size: 11px; }
.pulse { animation: pulse 2.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { 50% { opacity: .35; } }
.dash-flow { stroke-dasharray: 6 8; animation: dashmove 1.6s linear infinite; }
@keyframes dashmove { to { stroke-dashoffset: -28; } }

/* ---------- Z-pattern module rows (vault: z-pattern) ---------- */
.l-z { display: grid; gap: 4.5rem; max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 0; }
.l-z .row { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.l-z .row:nth-child(even) .media { order: 2; }
.l-z .media { aspect-ratio: 4 / 3; border-radius: 0; position: relative; }
@media (max-width: 760px) {
  .l-z .row { grid-template-columns: 1fr; }
  .l-z .media { order: 0 !important; }
}
.module-num {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .3em;
  text-transform: uppercase; color: var(--mc);
}
.row h3 { font-size: clamp(1.5rem, 3vw, 2rem); margin: .4rem 0 .2rem; }
.row .question { color: var(--mc); font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin: 0 0 .8rem; }
.row .arcnote {
  margin-top: 1.1rem; padding: .8rem 1rem; border-left: 3px solid var(--mc);
  background: color-mix(in srgb, var(--mc) 8%, transparent);
  border-radius: 0; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  font-size: .92rem; color: var(--muted);
}
.row .arcnote b { color: var(--text); }

/* animated-gradient-border (vault) around module media */
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.grad-border {
  --mcut: 26px;
  position: relative; border-radius: 0; padding: 2px; isolation: isolate;
  background: conic-gradient(from var(--angle),
    var(--mc), transparent 30%, var(--mc) 50%, transparent 80%, var(--mc));
  animation: gb-spin 6s linear infinite;
  clip-path: polygon(0 0, calc(100% - var(--mcut)) 0, 100% var(--mcut), 100% 100%, var(--mcut) 100%, 0 calc(100% - var(--mcut)));
  transition: rotate .4s cubic-bezier(.22, 1, .36, 1);
}
.l-z .row:nth-child(odd) .grad-border { rotate: -1.4deg; }
.l-z .row:nth-child(even) .grad-border { rotate: 1.4deg; }
.l-z .row:hover .grad-border { rotate: 0deg; }
.grad-border > .media-inner {
  border-radius: 0; background: var(--bg-deep);
  clip-path: polygon(0 0, calc(100% - var(--mcut)) 0, 100% var(--mcut), 100% 100%, var(--mcut) 100%, 0 calc(100% - var(--mcut)));
  width: 100%; height: 100%; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
@keyframes gb-spin { to { --angle: 360deg; } }
.media-inner svg { width: 86%; height: 86%; }
.mfloat { animation: mfloat 5s ease-in-out infinite; }
@keyframes mfloat { 50% { transform: translateY(-9px); } }

/* ---------- week cards grid ---------- */
.weeks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }
.week-card {
  position: relative; overflow: hidden; padding: 1.3rem 1.3rem 1.1rem;
  border-top: 3px solid var(--mc);
  transform-style: preserve-3d;
  transition: transform .25s cubic-bezier(.22, 1, .36, 1), filter .25s, --cut .35s cubic-bezier(.22, 1, .36, 1);
  color: var(--text); display: block;
}
.week-card:hover {
  text-decoration: none;
  transform: perspective(900px) rotateX(4deg) rotateY(-5deg) translateY(-4px);
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--mc) 40%, transparent));
}
.week-card .ghostnum { /* oversized stroke numeral floating behind content */
  position: absolute; right: .4rem; bottom: -1.6rem; z-index: 0; pointer-events: none;
  font-family: var(--font-display); font-weight: 700; font-size: 5.2rem; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--mc) 38%, transparent);
  opacity: .55; transition: opacity .3s, transform .3s;
}
.week-card:hover .ghostnum { opacity: 1; transform: translateY(-8px); }
/* spotlight-hover (vault) — cursor-tracking glow */
.spot::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .3s; pointer-events: none;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
      color-mix(in srgb, var(--mc) 22%, transparent), transparent 65%);
}
.spot:hover::before { opacity: 1; }
.week-card .wk { font-family: var(--font-mono); font-size: .75rem; color: var(--mc); letter-spacing: .18em; text-transform: uppercase; }
.week-card .icon { font-size: 1.6rem; float: right; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--mc) 60%, transparent)); }
.week-card h4 { margin: .45rem 0 .4rem; font-size: 1.06rem; }
.week-card p { margin: 0; font-size: .85rem; color: var(--muted); }
.week-card .go { margin-top: .7rem; font-size: .8rem; color: var(--mc); font-weight: 600; }

/* ---------- current events ---------- */
.events-list { display: grid; gap: 1rem; }
.event-item { padding: 1.2rem 1.4rem; display: grid; gap: .25rem; }
.event-item .date { font-family: var(--font-mono); font-size: .75rem; color: var(--accent); }
.event-item h4 { margin: 0; font-size: 1.05rem; }
.event-item p { margin: 0; color: var(--muted); font-size: .92rem; }
.event-item a { font-size: .85rem; }

/* ---------- tables (tracks / grading) ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.info-card { padding: 1.6rem; }
.info-card h3 { margin-top: 0; font-size: 1.15rem; }
.info-card table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.info-card td, .info-card th { padding: .5rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.info-card th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.track-badge {
  display: inline-flex; width: 1.7rem; height: 1.7rem; border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  align-items: center; justify-content: center; font-family: var(--font-display);
  font-weight: 700; font-size: .9rem; margin-right: .5rem;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent);
}

/* ---------- scroll reveals (vault: scroll-reveal / staggered-reveal) ---------- */
.reveal, .stagger > * { opacity: 0; transform: translateY(34px); }
.reveal.in, .stagger > .in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.22, 1, .36, 1); }
@supports (animation-timeline: view()) {
  .reveal, .stagger > * { opacity: 1; transform: none; transition: none; }
  .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% cover 38%; }
  .stagger > * { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% cover 28%; }
}
@keyframes rise { from { opacity: 0; transform: translateY(34px); } to { opacity: 1; transform: none; } }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; color: var(--muted); font-size: .88rem; background: var(--bg-deep); }
.foot-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }

/* ==========================================================================
   WEEK PAGE
   ========================================================================== */
.week-hero { position: relative; overflow: hidden; background: var(--bg-deep); padding: 4.5rem 0 3rem; }
.week-hero::before {
  content: ""; position: absolute; inset: -30%; filter: blur(80px); opacity: .35;
  background: radial-gradient(closest-side, var(--mc), transparent) 20% 30% / 60% 60% no-repeat;
  will-change: transform;
  animation: aurora-drift 12s ease-in-out infinite alternate;
}
.week-hero > .wrap { position: relative; }
.week-hero .crumbs { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }
.week-hero .crumbs a { color: var(--muted); }
.week-hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: .5rem 0 .4rem; }
.week-hero .tag {
  display: inline-block; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--mc); border: 1px solid color-mix(in srgb, var(--mc) 45%, transparent);
  border-radius: 0; padding: .25rem .8rem; background: color-mix(in srgb, var(--mc) 10%, transparent);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.week-hero .bigicon { font-size: 3.2rem; filter: drop-shadow(0 0 18px color-mix(in srgb, var(--mc) 70%, transparent)); }

/* journey strip — where this week sits in the arc */
.journey-strip { display: flex; align-items: center; gap: 0; margin: 2.2rem 0 0; }
.jdot {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  background: var(--surface-2); border: 2px solid var(--line); position: relative;
  transition: transform .2s;
}
.jdot.done { background: color-mix(in srgb, var(--jc, var(--accent)) 55%, var(--surface-2)); border-color: transparent; }
.jdot.now {
  background: var(--mc); border-color: var(--mc);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--mc) 25%, transparent), 0 0 18px var(--mc);
  transform: scale(1.25);
}
.jdot:hover { transform: scale(1.4); }
.jbar { height: 2px; flex: 1; background: var(--line); }
.jbar.done { background: color-mix(in srgb, var(--jc, var(--accent)) 55%, var(--line)); }
.journey-legend { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .68rem; color: var(--muted); margin-top: .5rem; letter-spacing: .1em; text-transform: uppercase; }

.week-body { padding: 3.5rem 0; display: grid; gap: 2.2rem; }
.panel { padding: 1.9rem 2.1rem; }
.panel > h2 { margin-top: 0; font-size: 1.3rem; display: flex; align-items: center; gap: .6rem; }
.panel > h2 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mc); box-shadow: 0 0 10px var(--mc); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

/* key-term flip cards (vault: card-flip-3d) */
.terms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 1rem; }
.flip { perspective: 1000px; min-height: 165px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; min-height: 165px; transition: transform .6s; transform-style: preserve-3d; }
.flip:hover .flip-inner, .flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 0; padding: 1.1rem; display: flex; flex-direction: column; justify-content: center;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.flip-front {
  border: 1px solid color-mix(in srgb, var(--mc) 35%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--mc) 14%, var(--surface)), var(--surface));
  align-items: center; text-align: center; gap: .4rem;
}
.flip-front .term { font-family: var(--font-display); font-weight: 700; font-size: 1.06rem; }
.flip-front .hint { font-size: .72rem; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.flip-back { transform: rotateY(180deg); background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; color: var(--text); }

/* fun facts */
.facts { display: grid; gap: .9rem; }
.fact {
  display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.2rem;
  border: 1px dashed color-mix(in srgb, var(--mc) 40%, transparent); border-radius: 0;
  background: color-mix(in srgb, var(--mc) 6%, transparent); font-size: .93rem;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.fact .fi { font-size: 1.2rem; flex: none; }

/* videos */
.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; }
.video-card { overflow: hidden; display: block; color: var(--text); border: 1px solid var(--line); border-radius: 0; background: var(--surface); clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%); transition: transform .2s, filter .2s; }
.video-card:hover { transform: translateY(-4px); filter: drop-shadow(0 10px 20px rgba(2, 8, 20, .4)); text-decoration: none; }
.video-thumb { aspect-ratio: 16 / 9; background: var(--bg-deep) center / cover no-repeat; position: relative; }
.video-thumb::after {
  content: "▶"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 2rem; color: #fff; background: rgba(4, 10, 20, .35); opacity: .85; transition: opacity .2s;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.video-card:hover .video-thumb::after { opacity: 1; }
.video-card .vt { padding: .8rem 1rem; font-size: .9rem; font-weight: 600; }

/* docs / slides */
.docs-list { display: grid; gap: .7rem; }
.doc-item {
  display: flex; align-items: center; gap: .9rem; padding: .85rem 1.1rem;
  border: 1px solid var(--line); border-left: 3px solid var(--mc, var(--accent));
  border-radius: 0; background: var(--surface); color: var(--text);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: border-color .2s, transform .2s;
}
.doc-item:hover { border-color: var(--mc); transform: translateX(4px); text-decoration: none; }
.doc-item .di { font-size: 1.3rem; }
.doc-item .dn { font-weight: 600; font-size: .92rem; }
.doc-item .ds { margin-left: auto; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }

/* lab callout */
.lab-callout { border-left: 4px solid var(--mc); padding: 1.3rem 1.6rem; }
.lab-callout h3 { margin: 0 0 .4rem; font-size: 1rem; letter-spacing: .14em; text-transform: uppercase; color: var(--mc); }
.lab-callout p { margin: 0; }

/* prev/next */
.pager { display: flex; justify-content: space-between; gap: 1rem; }
.pager a { flex: 1; max-width: 340px; padding: 1rem 1.3rem; }
.pager .plabel { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.pager .ptitle { font-weight: 700; font-family: var(--font-display); }
.pager a:last-child { text-align: right; margin-left: auto; }

/* empty states */
.empty { padding: 1.4rem; text-align: center; color: var(--muted); font-size: .9rem; border: 1px dashed var(--line); border-radius: 0; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); }

/* ==========================================================================
   ADMIN
   ========================================================================== */
.admin-body { max-width: 780px; margin: 0 auto; padding: 3rem 1.25rem 5rem; display: grid; gap: 1.6rem; }
.admin-panel { padding: 1.8rem 2rem; }
.admin-panel h2 { margin-top: 0; font-size: 1.2rem; }
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 0;
  color: var(--text); padding: .65rem .9rem; font-family: var(--font-body); font-size: .95rem;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.status { font-family: var(--font-mono); font-size: .85rem; margin-top: .8rem; min-height: 1.2em; }
.status.ok { color: var(--m3); }
.status.err { color: #ff5c7a; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .typewriter { width: var(--tw, auto); border-right: none; }
  .reveal, .stagger > * { opacity: 1; transform: none; }
}
