/* ============================================================
   Applied AI Academy — design system
   Typography: headlines Century Gothic Bold (Didact Gothic / Futura fallback),
   body Helvetica Neue Light. Colour: 60/30/10 — deep ink dominant, slate
   surfaces secondary, signal-cyan accent. Slow progressive animations,
   hover-reveal, expand/collapse. Reduced-motion aware.
   ============================================================ */

:root {
  --font-head: "Century Gothic", "CenturyGothic", "Didact Gothic", "Futura", "Trebuchet MS", sans-serif;
  --font-body: "Helvetica Neue", Helvetica, "Inter", Arial, sans-serif;

  /* dark theme (default) — 60% ink, 30% slate, 10% cyan */
  --bg: #0a0f16;
  --bg2: #0d141d;
  --surface: #121a24;
  --surface2: #17222e;
  --border: #22303f;
  --ink: #e8eef4;
  --ink-soft: #9fb0c0;
  --ink-faint: #64788c;
  --accent: #22d3ee;
  --accent-soft: rgba(34, 211, 238, .12);
  --accent-ink: #062a31;
  --core: #34d399;
  --builder: #fbbf24;
  --advanced: #a78bfa;
  --danger: #fb7185;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 16px;
  --radius-sm: 10px;
  --glow1: #22d3ee;
  --glow2: #a78bfa;
  --glow3: #34d399;
}
[data-theme="light"] {
  --bg: #f4f6f9;
  --bg2: #eef1f5;
  --surface: #ffffff;
  --surface2: #f7f9fb;
  --border: #dde4ec;
  --ink: #101a26;
  --ink-soft: #46586b;
  --ink-faint: #7d8ea0;
  --accent: #0891b2;
  --accent-soft: rgba(8, 145, 178, .1);
  --accent-ink: #ffffff;
  --shadow: 0 10px 30px rgba(16, 42, 67, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-weight: 300; font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.22; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.08rem; } h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: .08em .35em; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- ambient aurora ---------- */
.bg-aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.bg-aurora span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .16; animation: drift 26s ease-in-out infinite alternate; }
.bg-aurora span:nth-child(1) { width: 46vw; height: 46vw; background: var(--glow1); top: -12%; left: -8%; }
.bg-aurora span:nth-child(2) { width: 38vw; height: 38vw; background: var(--glow2); bottom: -10%; right: -6%; animation-delay: -8s; }
.bg-aurora span:nth-child(3) { width: 30vw; height: 30vw; background: var(--glow3); top: 42%; left: 58%; opacity: .1; animation-delay: -16s; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(4vw, -3vh) scale(1.12); } }
[data-theme="light"] .bg-aurora span { opacity: .12; }

/* ---------- app layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex-shrink: 0; padding: 22px 16px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, var(--surface), transparent 160%);
  border-right: 1px solid var(--border); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: radial-gradient(circle at 30% 30%, var(--accent), #0e7490);
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700;
  color: #04252b; font-size: 1.05rem; box-shadow: 0 4px 14px rgba(34, 211, 238, .35);
}
.brand-title { font-family: var(--font-head); font-weight: 700; font-size: .98rem; }
.brand-sub { font-size: .68rem; color: var(--ink-faint); letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--ink-soft); font-size: .92rem; transition: background .25s, color .25s;
}
.nav a:hover { background: var(--surface2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 400; }
.nav .ico { width: 20px; text-align: center; }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; font-size: .8rem; color: var(--ink-faint); }
.main { flex: 1; padding: 30px clamp(18px, 4vw, 52px) 80px; max-width: 1160px; }

/* ---------- generic components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card.hoverable { transition: transform .35s ease, border-color .35s ease; }
.card.hoverable:hover { transform: translateY(-3px); border-color: var(--accent); }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: none;
  font-family: var(--font-head); font-weight: 700; font-size: .88rem;
  padding: 10px 20px; border-radius: 999px; transition: filter .25s, transform .25s;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.subtle { background: var(--surface2); color: var(--ink-soft); border: 1px solid var(--border); }
.btn.small { padding: 6px 14px; font-size: .78rem; }
.btn.danger { background: var(--danger); color: #3d0812; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px;
  font-size: .72rem; letter-spacing: .04em; border: 1px solid var(--border);
  background: var(--surface2); color: var(--ink-soft); text-transform: uppercase; font-weight: 400;
}
.chip.accent { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip.core { border-color: var(--core); color: var(--core); background: rgba(52, 211, 153, .1); }
.chip.builder { border-color: var(--builder); color: var(--builder); background: rgba(251, 191, 36, .1); }
.chip.advanced { border-color: var(--advanced); color: var(--advanced); background: rgba(167, 139, 250, .1); }

.kicker { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-family: var(--font-head); font-weight: 700; margin-bottom: 6px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: .85rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; background: var(--bg2); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; font-family: var(--font-body);
  font-weight: 300; font-size: .95rem; outline: none; transition: border-color .25s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; }
label.fld { display: block; font-size: .8rem; color: var(--ink-soft); margin: 12px 0 5px; letter-spacing: .03em; }

/* ---------- reveal-on-scroll (slow, progressive) ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s ease; }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .12s; } .reveal.d2 { transition-delay: .24s; }
.reveal.d3 { transition-delay: .36s; } .reveal.d4 { transition-delay: .48s; }

/* ---------- accordion (expand/collapse) ---------- */
details.acc { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface2); margin-bottom: 10px; overflow: hidden; }
details.acc summary {
  cursor: pointer; padding: 13px 18px; font-family: var(--font-head); font-weight: 700;
  font-size: .92rem; list-style: none; display: flex; align-items: center; gap: 10px; user-select: none;
}
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::before { content: '+'; color: var(--accent); font-size: 1.1rem; width: 16px; transition: transform .35s; }
details.acc[open] summary::before { content: '–'; }
details.acc .acc-body { padding: 2px 18px 16px; }
details.acc.answers { border-color: var(--core); }
details.acc.answers summary { color: var(--core); }

/* ---------- glossary chips + hover-reveal tooltip ---------- */
.term {
  border-bottom: 1.5px dotted; cursor: help; position: relative; font-weight: 400;
}
.term.concept  { color: var(--accent); border-color: var(--accent); }
.term.framework{ color: var(--advanced); border-color: var(--advanced); }
.term.risk     { color: var(--danger); border-color: var(--danger); }
.term.practice { color: var(--core); border-color: var(--core); }
.term .tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  width: min(320px, 76vw); background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  font-size: .82rem; line-height: 1.5; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .35s ease, transform .35s ease; z-index: 60;
}
.term:hover .tip, .term:focus .tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .75rem; color: var(--ink-faint); margin: 8px 0 2px; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* ---------- progress bars & KPIs ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--border); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 1.1s ease; }
.kpi { text-align: left; }
.kpi .n { font-family: var(--font-head); font-weight: 700; font-size: 1.7rem; color: var(--accent); }
.kpi .l { font-size: .78rem; color: var(--ink-faint); letter-spacing: .05em; text-transform: uppercase; }

/* ---------- lessons ---------- */
.lesson-head { padding: 26px 26px 20px; border-left: 4px solid var(--accent); }
.videos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.video-embed { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #000; aspect-ratio: 16/9; cursor: pointer; border: 1px solid var(--border); }
.video-embed img { width: 100%; height: 100%; object-fit: cover; opacity: .82; transition: opacity .3s, transform .5s; }
.video-embed:hover img { opacity: 1; transform: scale(1.03); }
.video-embed .play {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.video-embed .play i {
  width: 58px; height: 58px; border-radius: 50%; background: rgba(10, 15, 22, .75); border: 2px solid var(--accent);
  display: grid; place-items: center; color: var(--accent); font-size: 1.3rem; font-style: normal; transition: transform .3s;
}
.video-embed:hover .play i { transform: scale(1.1); }
.video-embed iframe { width: 100%; height: 100%; border: 0; }
.video-meta { padding: 8px 2px 0; font-size: .82rem; }
.video-link { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface2); transition: border-color .3s, transform .3s; }
.video-link:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }

.lab-track { border-left: 3px solid var(--border); padding: 4px 0 4px 16px; margin: 12px 0; }
.lab-track.core { border-color: var(--core); }
.lab-track.builder { border-color: var(--builder); }
.lab-track.advanced { border-color: var(--advanced); }
.lab-track h4 { margin-bottom: 4px; }
.lab-track ul { margin: 4px 0; padding-left: 18px; }
.lab-track li { margin-bottom: 6px; font-size: .93rem; }

/* ---------- quiz ---------- */
.quiz-q { margin-bottom: 18px; }
.quiz-opt {
  display: block; padding: 11px 16px; margin: 7px 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface2); cursor: pointer; font-size: .93rem;
  transition: border-color .25s, background .25s;
}
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.quiz-opt.right { border-color: var(--core); background: rgba(52, 211, 153, .12); }
.quiz-opt.wrong { border-color: var(--danger); background: rgba(251, 113, 133, .1); }
.quiz-x { font-size: .85rem; color: var(--ink-soft); padding: 8px 12px; border-left: 3px solid var(--core); margin-top: 6px; }

/* ---------- flashcards ---------- */
.flash-wrap { perspective: 1200px; max-width: 620px; margin: 0 auto; }
.flash-card {
  position: relative; min-height: 240px; transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2, .7, .3, 1); cursor: pointer;
}
.flash-card.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; display: grid; place-items: center;
  padding: 30px; text-align: center; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow);
}
.flash-face.back { transform: rotateY(180deg); background: var(--surface2); font-size: .95rem; }
.flash-face .q { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }

/* ---------- radar / compass ---------- */
.radar-wrap { display: grid; place-items: center; }
.radar-wrap svg { max-width: 460px; width: 100%; height: auto; }

/* ---------- anchored assessment ---------- */
.anchor-row { display: flex; justify-content: space-between; gap: 14px; font-size: .78rem; color: var(--ink-faint); margin: 6px 0 8px; }
.likert { display: flex; gap: 8px; }
.likert button {
  flex: 1; padding: 10px 0; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface2); color: var(--ink-soft); cursor: pointer; font-family: var(--font-head);
  font-weight: 700; transition: all .25s;
}
.likert button:hover { border-color: var(--accent); color: var(--accent); }
.likert button.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- chat / mentor ---------- */
.chat-box { display: flex; flex-direction: column; gap: 12px; max-height: 55vh; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 16px; font-size: .93rem; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.ai.thinking i { display: inline-block; animation: pulse 1.2s infinite; font-style: normal; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.chat-input { display: flex; gap: 10px; margin-top: 12px; }
.chat-input textarea { min-height: 52px; flex: 1; }
.handoff { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 70;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 30% 30%, var(--accent), #0e7490);
  color: #04252b; font-size: 1.5rem; box-shadow: 0 8px 26px rgba(34, 211, 238, .4);
  transition: transform .3s;
}
.fab:hover { transform: scale(1.08); }
.fab-panel {
  position: fixed; right: 26px; bottom: 96px; z-index: 70; width: min(400px, calc(100vw - 40px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; display: none;
}
.fab-panel.open { display: block; animation: rise .4s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data th { font-family: var(--font-head); font-weight: 700; font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.table-scroll { overflow-x: auto; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--surface); color: var(--ink); border: 1px solid var(--accent);
  border-radius: 999px; padding: 10px 22px; font-size: .88rem; z-index: 100;
  opacity: 0; transition: all .4s ease; box-shadow: var(--shadow); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- gate (sign-in) ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.gate-card { width: min(480px, 94vw); }
.profile-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: border-color .25s, background .25s;
}
.profile-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent);
}

/* ---------- certificate ---------- */
.certificate {
  border: 3px double var(--accent); border-radius: var(--radius); padding: 46px 40px; text-align: center;
  background: var(--surface);
}
.certificate .big { font-size: 2rem; }

/* ---------- badges ---------- */
.badge { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface2); }
.badge.locked { opacity: .4; filter: grayscale(1); }
.badge .icon { font-size: 1.5rem; }

/* ---------- mobile ---------- */
.menu-btn { display: none; }
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; z-index: 80; height: 100vh; transform: translateX(-105%);
    transition: transform .4s ease; width: 260px; background: var(--bg2);
  }
  .sidebar.open { transform: none; }
  .menu-btn {
    display: grid; place-items: center; position: fixed; z-index: 81; top: 14px; left: 14px;
    width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1.15rem;
  }
  .main { padding-top: 66px; }
}

/* ---------- print (certificate / workbook) ---------- */
@media print {
  .sidebar, .fab, .fab-panel, .menu-btn, .no-print { display: none !important; }
  body, .bg-aurora { background: #fff !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ============================================================
   DESIGN STYLE — Minimal (flat, hairline, no ambient glow).
   Toggled independently of the colour palette via html.style-minimal.
   ============================================================ */
html.style-minimal .bg-aurora { display: none; }
html.style-minimal body { background: var(--bg); }
html.style-minimal .card { box-shadow: none; border-radius: 8px; }
html.style-minimal .card.hoverable:hover { transform: none; border-color: var(--accent); box-shadow: none; }
html.style-minimal .btn { border-radius: 6px; box-shadow: none; }
html.style-minimal .btn:hover { transform: none; }
html.style-minimal .chip, html.style-minimal .likert button, html.style-minimal .quiz-opt,
html.style-minimal input, html.style-minimal textarea, html.style-minimal select,
html.style-minimal details.acc, html.style-minimal .video-link, html.style-minimal .badge,
html.style-minimal .bar, html.style-minimal .bar > i { border-radius: 6px; }
html.style-minimal .brand-mark { box-shadow: none; background: var(--accent); color: var(--accent-ink); border-radius: 8px; }
html.style-minimal .fab { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .22); border-radius: 12px; }
html.style-minimal .sidebar { background: var(--surface); }
html.style-minimal .lesson-head { border-left-width: 3px; }
html.style-minimal .kpi .n { letter-spacing: -.01em; }
html.style-minimal .video-embed { border-radius: 6px; }
html.style-minimal .msg { border-radius: 8px; }
html.style-minimal .toast { border-radius: 8px; }
/* snappier reveals in minimal mode */
html.style-minimal .reveal { transition: opacity .5s ease, transform .5s ease; transform: translateY(10px); }

/* Immersive intensifies the ambient glow slightly */
html.style-immersive .bg-aurora span { opacity: .18; }
html.style-immersive[data-theme="light"] .bg-aurora span { opacity: .13; }

/* appearance pickers (Settings) */
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--ink-soft); cursor: pointer;
  font-size: .82rem; transition: border-color .2s, color .2s; font-family: var(--font-body); }
.sw:hover { border-color: var(--accent); color: var(--ink); }
.sw.sel { border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.sw-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sw); border: 1px solid rgba(128, 128, 128, .35); flex-shrink: 0; }
.style-card.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
