/* ================================================================
   root-portal.css — styles for the root index.html course selector.
   Extracted from inline <style> so the portal CSS is cached across
   return visits and so the HTML can adopt a stricter CSP.
   ================================================================ */

:root {
  --bg: #060810;
  --text: #e4e6ed;
  --text-muted: #9299ac;
  --text-dim: #5c6275;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

.noise {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hub-wrap {
  position: relative; z-index: 1;
  max-width: 1320px; margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

/* ── SKIP LINK ── */
.skip-link {
  position: absolute;
  top: -40px; left: 0;
  background: #000; color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  transition: top 0.2s;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ── HEADER ── */
.hub-header {
  text-align: center;
  padding: 4rem 2rem 2.5rem;
  position: relative;
  animation: fadeUp 0.6s ease-out;
}
.hub-header::before {
  content: "";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 800px; height: 500px;
  background: radial-gradient(ellipse at center, rgba(108, 140, 255, 0.06), transparent 70%);
  pointer-events: none;
}
.uni-badge {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  padding: 0.5rem 1.3rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-transform: uppercase; margin-bottom: 1.5rem;
}
.uni-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #34d399; box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
  animation: pulse 2.5s ease-in-out infinite;
}
.hub-header h1 {
  position: relative;
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 900; letter-spacing: -0.04em;
  line-height: 1.05;
  background: linear-gradient(135deg, #f0f2f8 0%, #6c8cff 45%, #a78bfa 75%, #34d399 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hub-header .tagline {
  position: relative;
  color: var(--text-muted); font-size: 1.08rem;
  margin-top: 1.1rem; max-width: 600px;
  margin-left: auto; margin-right: auto; line-height: 1.75;
}
.hub-header .semester-badge {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.74rem; font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── COURSE CARDS ── */
.courses-stack {
  display: flex; flex-direction: column;
  gap: 1.5rem; margin-top: 2rem;
}

.course-card {
  position: relative; overflow: hidden;
  border-radius: 28px;
  text-decoration: none; color: inherit;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 22rem;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.course-card:hover { transform: translateY(-4px); }

.course-card .card-bg {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  transition: background var(--transition);
}
.course-card .card-content,
.course-card .card-visual {
  position: relative; z-index: 1;
  padding: clamp(1.5rem, 3vw, 2.5rem);
}
.course-card .card-content {
  display: flex; flex-direction: column; justify-content: center;
}

.card-badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0.45rem 0.9rem; border-radius: 999px;
  width: fit-content;
  margin-bottom: 1.1rem;
}

.course-card h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 800; line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 0.8rem;
}

.course-card .card-desc {
  font-size: 1rem; line-height: 1.7;
  max-width: 28rem;
}

.card-stats {
  display: flex; gap: 0.8rem; flex-wrap: wrap;
  margin-top: 1.5rem;
}
.card-stat {
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  min-width: 7rem;
}
.card-stat .stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.64rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}
.card-stat .stat-value {
  font-size: 0.92rem; font-weight: 700;
}

.card-enter {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.9rem; font-weight: 700;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  width: fit-content;
  transition: all var(--transition);
  text-decoration: none;
}

/* ── VISUAL SIDE ── */
.card-visual {
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  gap: 1rem;
}
.visual-graphic {
  position: relative;
  width: 100%; max-width: 320px;
}
.visual-graphic svg {
  width: 100%; height: auto;
  filter: drop-shadow(0 8px 32px rgba(0, 0, 0, 0.2));
}

/* ── CARD 1: 5270 ALGORITHMS ── */
.card-algo {
  background: linear-gradient(145deg, rgba(10, 14, 36, 0.97), rgba(16, 24, 56, 0.95));
  border: 1px solid rgba(108, 140, 255, 0.18);
  box-shadow: 0 40px 100px rgba(6, 10, 28, 0.5);
}
.card-algo:hover {
  box-shadow: 0 48px 120px rgba(108, 140, 255, 0.12), 0 0 0 1px rgba(108, 140, 255, 0.3);
}
.card-algo .card-bg {
  background:
    radial-gradient(circle at 15% 20%, rgba(108, 140, 255, 0.18), transparent 22%),
    radial-gradient(circle at 85% 75%, rgba(167, 139, 250, 0.14), transparent 25%),
    radial-gradient(circle at 60% 10%, rgba(96, 165, 250, 0.08), transparent 30%);
}
.card-algo .card-badge {
  background: rgba(108, 140, 255, 0.12);
  color: #a8c0ff; border: 1px solid rgba(108, 140, 255, 0.2);
}
.card-algo h2 { color: #f0f3ff; }
.card-algo .card-desc { color: rgba(200, 210, 240, 0.75); }
.card-algo .card-stat {
  background: rgba(108, 140, 255, 0.08);
  border: 1px solid rgba(108, 140, 255, 0.12);
}
.card-algo .card-stat .stat-label { color: rgba(168, 192, 255, 0.6); }
.card-algo .card-stat .stat-value { color: #c8d8ff; }
.card-algo .card-enter {
  background: rgba(108, 140, 255, 0.15);
  color: #a8c0ff;
  border: 1px solid rgba(108, 140, 255, 0.25);
}
.card-algo .card-enter:hover { background: rgba(108, 140, 255, 0.3); color: #fff; }

/* ── CARD 2: 5046 NLP ── */
.card-nlp {
  background: linear-gradient(145deg, rgba(6, 22, 18, 0.97), rgba(8, 34, 28, 0.95));
  border: 1px solid rgba(52, 211, 153, 0.16);
  box-shadow: 0 40px 100px rgba(4, 14, 10, 0.5);
}
.card-nlp:hover {
  box-shadow: 0 48px 120px rgba(52, 211, 153, 0.1), 0 0 0 1px rgba(52, 211, 153, 0.28);
}
.card-nlp .card-bg {
  background:
    radial-gradient(circle at 20% 25%, rgba(52, 211, 153, 0.2), transparent 22%),
    radial-gradient(circle at 80% 70%, rgba(96, 165, 250, 0.12), transparent 25%),
    radial-gradient(circle at 50% 5%, rgba(52, 211, 153, 0.06), transparent 35%);
}
.card-nlp .card-badge {
  background: rgba(52, 211, 153, 0.1);
  color: #8af0c8; border: 1px solid rgba(52, 211, 153, 0.2);
}
.card-nlp h2 { color: #e8fdf5; }
.card-nlp .card-desc { color: rgba(200, 240, 225, 0.7); }
.card-nlp .card-stat {
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.12);
}
.card-nlp .card-stat .stat-label { color: rgba(138, 240, 200, 0.55); }
.card-nlp .card-stat .stat-value { color: #b8f0d5; }
.card-nlp .card-enter {
  background: rgba(52, 211, 153, 0.12);
  color: #8af0c8;
  border: 1px solid rgba(52, 211, 153, 0.22);
}
.card-nlp .card-enter:hover { background: rgba(52, 211, 153, 0.28); color: #fff; }

/* ── CARD 3: 5318 ML ── */
.card-ml {
  background: linear-gradient(145deg, rgba(7, 18, 26, 0.97), rgba(11, 36, 47, 0.95));
  border: 1px solid rgba(20, 184, 166, 0.16);
  box-shadow: 0 40px 100px rgba(6, 16, 22, 0.5);
}
.card-ml:hover {
  box-shadow: 0 48px 120px rgba(20, 184, 166, 0.1), 0 0 0 1px rgba(20, 184, 166, 0.28);
}
.card-ml .card-bg {
  background:
    radial-gradient(circle at 18% 18%, rgba(20, 184, 166, 0.22), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(255, 181, 106, 0.16), transparent 24%),
    radial-gradient(circle at 50% 90%, rgba(20, 184, 166, 0.06), transparent 30%);
}
.card-ml .card-badge {
  background: rgba(20, 184, 166, 0.1);
  color: #a8f4e8; border: 1px solid rgba(20, 184, 166, 0.2);
}
.card-ml h2 { color: #f5fbf9; }
.card-ml .card-desc { color: rgba(200, 235, 228, 0.72); }
.card-ml .card-stat {
  background: rgba(20, 184, 166, 0.07);
  border: 1px solid rgba(20, 184, 166, 0.12);
}
.card-ml .card-stat .stat-label { color: rgba(168, 244, 232, 0.5); }
.card-ml .card-stat .stat-value { color: #b4f6eb; }
.card-ml .card-enter {
  background: rgba(20, 184, 166, 0.12);
  color: #a8f4e8;
  border: 1px solid rgba(20, 184, 166, 0.22);
}
.card-ml .card-enter:hover { background: rgba(20, 184, 166, 0.28); color: #fff; }

/* ── CARD 4: 9001 INTRO PROG ── */
.card-prog {
  background: linear-gradient(145deg, rgba(20, 16, 6, 0.97), rgba(36, 28, 8, 0.95));
  border: 1px solid rgba(251, 191, 36, 0.16);
  box-shadow: 0 40px 100px rgba(18, 14, 4, 0.5);
}
.card-prog:hover {
  box-shadow: 0 48px 120px rgba(251, 191, 36, 0.08), 0 0 0 1px rgba(251, 191, 36, 0.28);
}
.card-prog .card-bg {
  background:
    radial-gradient(circle at 15% 30%, rgba(251, 191, 36, 0.18), transparent 22%),
    radial-gradient(circle at 85% 65%, rgba(251, 146, 60, 0.12), transparent 25%),
    radial-gradient(circle at 45% 5%, rgba(251, 191, 36, 0.06), transparent 35%);
}
.card-prog .card-badge {
  background: rgba(251, 191, 36, 0.1);
  color: #ffe08a; border: 1px solid rgba(251, 191, 36, 0.2);
}
.card-prog h2 { color: #fffbf0; }
.card-prog .card-desc { color: rgba(240, 225, 190, 0.72); }
.card-prog .card-stat {
  background: rgba(251, 191, 36, 0.07);
  border: 1px solid rgba(251, 191, 36, 0.12);
}
.card-prog .card-stat .stat-label { color: rgba(255, 224, 138, 0.5); }
.card-prog .card-stat .stat-value { color: #ffe5a0; }
.card-prog .card-enter {
  background: rgba(251, 191, 36, 0.12);
  color: #ffe08a;
  border: 1px solid rgba(251, 191, 36, 0.22);
}
.card-prog .card-enter:hover { background: rgba(251, 191, 36, 0.28); color: #fff; }

/* ── CARD 5: COMP9123 DSA ── */
.card-dsa {
  background: linear-gradient(145deg, rgba(28, 25, 20, 0.97), rgba(55, 38, 12, 0.94));
  border: 1px solid rgba(245, 158, 11, 0.2);
  box-shadow: 0 40px 100px rgba(12, 10, 8, 0.45);
}
.card-dsa:hover {
  box-shadow: 0 48px 120px rgba(245, 158, 11, 0.12), 0 0 0 1px rgba(245, 158, 11, 0.28);
}
.card-dsa .card-bg {
  background:
    radial-gradient(circle at 18% 24%, rgba(245, 158, 11, 0.16), transparent 24%),
    radial-gradient(circle at 82% 72%, rgba(217, 119, 6, 0.1), transparent 26%);
}
.card-dsa .card-badge {
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.22);
}
.card-dsa h2 { color: #fffbeb; }
.card-dsa .card-desc { color: rgba(254, 243, 199, 0.72); }
.card-dsa .card-stat {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.12);
}
.card-dsa .card-stat .stat-label { color: rgba(253, 230, 138, 0.55); }
.card-dsa .card-stat .stat-value { color: #fde68a; }
.card-dsa .card-enter {
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.24);
}
.card-dsa .card-enter:hover { background: rgba(245, 158, 11, 0.28); color: #fff; }

/* ── SVG / CODE ILLUSTRATIONS ── */
.algo-grid-visual {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem;
  max-width: 300px; width: 100%;
}
.algo-cell {
  aspect-ratio: 1;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.6rem; font-weight: 700;
  transition: all var(--transition);
}
.algo-cell:nth-child(1) { background: rgba(108, 140, 255, 0.12); border: 1px solid rgba(108, 140, 255, 0.2); color: #a8c0ff; }
.algo-cell:nth-child(2) { background: rgba(167, 139, 250, 0.1); border: 1px solid rgba(167, 139, 250, 0.18); color: #c4b5fd; }
.algo-cell:nth-child(3) { background: rgba(96, 165, 250, 0.1); border: 1px solid rgba(96, 165, 250, 0.18); color: #93c5fd; }
.algo-cell:nth-child(4) { background: rgba(108, 140, 255, 0.08); border: 1px solid rgba(108, 140, 255, 0.15); color: #a8c0ff; }
.card-algo:hover .algo-cell { transform: rotate(2deg) scale(1.02); }

.nlp-tokens {
  display: flex; flex-direction: column; gap: 0.6rem;
  max-width: 300px; width: 100%;
}
.token-row {
  display: flex; gap: 0.45rem; justify-content: center;
}
.token {
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 600;
  transition: all var(--transition);
}
.token.t1 { background: rgba(52, 211, 153, 0.14); color: #8af0c8; border: 1px solid rgba(52, 211, 153, 0.2); }
.token.t2 { background: rgba(96, 165, 250, 0.12); color: #93c5fd; border: 1px solid rgba(96, 165, 250, 0.18); }
.token.t3 { background: rgba(52, 211, 153, 0.08); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.14); }
.token.t4 { background: rgba(251, 191, 36, 0.1); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.16); }
.card-nlp:hover .token { transform: translateY(-2px); }
.nlp-tokens .token-row-wave { margin-top: 0.4rem; justify-content: center; }

.ml-pipeline {
  display: flex; flex-direction: column; gap: 0.6rem;
  max-width: 280px; width: 100%;
}
.pipe-step {
  display: grid; grid-template-columns: 2.6rem 1fr;
  gap: 0.7rem; align-items: center;
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  background: rgba(20, 184, 166, 0.06);
  border: 1px solid rgba(20, 184, 166, 0.1);
  transition: all var(--transition);
}
.pipe-idx {
  width: 2.4rem; height: 2.4rem;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 184, 166, 0.14);
  color: #a8f4e8;
  font-family: var(--font-mono);
  font-size: 0.75rem; font-weight: 700;
}
.pipe-text {
  font-size: 0.85rem; font-weight: 600;
  color: rgba(200, 235, 228, 0.85);
}
.card-ml:hover .pipe-step { transform: translateX(4px); }

.code-block-visual {
  max-width: 300px; width: 100%;
  background: rgba(251, 191, 36, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.1);
  border-radius: 16px;
  padding: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.8;
  transition: all var(--transition);
}
.code-block-visual .kw { color: #fbbf24; }
.code-block-visual .fn { color: #60a5fa; }
.code-block-visual .str { color: #34d399; }
.code-block-visual .cm { color: rgba(240, 225, 190, 0.35); }
.code-block-visual .op { color: rgba(240, 225, 190, 0.6); }
.code-block-visual .var { color: #fb923c; }
.card-prog:hover .code-block-visual {
  border-color: rgba(251, 191, 36, 0.25);
  box-shadow: 0 8px 32px rgba(251, 191, 36, 0.06);
}

/* ── FOOTER ── */
.hub-footer {
  text-align: center;
  padding: 3rem 0 1.5rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 1rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .course-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .card-visual { padding-top: 0 !important; }
  .hub-wrap { padding: 1rem 1rem 2.5rem; }
  .hub-header { padding: 3rem 1rem 2rem; }
}
@media (max-width: 500px) {
  .course-card { border-radius: 20px; }
  .card-stats { flex-direction: column; }
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.courses-stack > * {
  animation: slideIn 0.6s ease-out both;
}
.courses-stack > *:nth-child(1) { animation-delay: 0.1s; }
.courses-stack > *:nth-child(2) { animation-delay: 0.2s; }
.courses-stack > *:nth-child(3) { animation-delay: 0.3s; }
.courses-stack > *:nth-child(4) { animation-delay: 0.4s; }
.courses-stack > *:nth-child(5) { animation-delay: 0.5s; }

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}

/* ── PRINT ── */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .noise, .hub-header::before { display: none !important; }
  .course-card {
    break-inside: avoid; page-break-inside: avoid;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .course-card h2, .course-card .card-desc { color: #000 !important; }
  a[href]:not([href^="#"])::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
  }
}
