/* ==========================================================================
   THEME TOKENS
   --------------------------------------------------------------------------
   Centralized color, elevation, and effect variables for dark/light themes.
   The site defaults to dark mode, with a light-theme override applied through
   the [data-theme="light"] attribute or the user's system preference.
   ========================================================================== */

:root {
  color-scheme: dark light;

  /* Page background and shell surfaces */
  --bg: #050505;
  --bg-alt: #0a0a0a;
  --panel: rgba(18, 18, 22, 0.96);
  --panel-2: rgba(12, 12, 16, 0.94);
  --terminal-bar-bg: rgba(0, 0, 0, 0.45);

  /* Borders and outline accents */
  --panel-border: #5a1520;
  --panel-border-soft: rgba(255, 49, 92, 0.14);

  /* Card surfaces */
  --card-bg: rgba(22, 22, 26, 0.94);
  --card-bg-2: rgba(16, 16, 20, 0.92);
  --card-inset: rgba(255, 49, 92, 0.04);
  --card-shadow: rgba(0, 0, 0, 0.28);

  /* Navigation styling */
  --nav-bg: rgba(18, 18, 18, 0.42);
  --nav-bg-2: rgba(8, 8, 8, 0.2);
  --nav-divider: rgba(255, 255, 255, 0.05);
  --nav-active-bg: rgba(255, 49, 92, 0.08);
  --nav-active-text: #ffffff;

  /* Highlight / featured card styling */
  --highlight-bg: rgba(24, 8, 10, 0.86);
  --highlight-inset: rgba(255, 49, 92, 0.08);
  --highlight-glow: rgba(255, 49, 92, 0.12);

  /* Text hierarchy */
  --text: #f5f7fa;
  --muted: #b3bac5;
  --text-soft: #dde3ec;

  /* Accent palette */
  --red: #ff315c;
  --red-dim: #a61a34;
  --red-glow: rgba(255, 49, 92, 0.22);

  /* Global shadow colors */
  --shadow: rgba(0, 0, 0, 0.45);
  --shadow-red: rgba(255, 49, 92, 0.14);

  /* Overlay tuning */
  --noise-opacity: 0.028;
  --vignette-opacity: 0.18;

  /* CRT scanline overlay tuning */
  --scanline-sweep-opacity: 0.68;
  --scanline-pattern-opacity: 0.30;
  --scanline-sweep-color: rgba(155, 155, 155, 0.22);
  --scanline-pattern-color: rgba(155, 155, 155, 0.14);
  --scanline-pattern-size: 6px;
  --scanline-sweep-duration: 5.5s;
  --scanline-pattern-duration: 0.75s;
}

/* --------------------------------------------------------------------------
   Light theme overrides.
   These variables are applied whenever the document root explicitly requests
   the light theme through html[data-theme="light"].
   -------------------------------------------------------------------------- */
html[data-theme="light"] {
  --bg: #eceff3;
  --bg-alt: #dfe4ea;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-2: rgba(245, 247, 250, 0.94);
  --terminal-bar-bg: rgba(232, 236, 241, 0.95);

  --panel-border: #d3d8df;
  --panel-border-soft: rgba(193, 18, 58, 0.10);

  --card-bg: rgba(255, 255, 255, 0.94);
  --card-bg-2: rgba(244, 246, 249, 0.98);
  --card-inset: rgba(193, 18, 58, 0.04);
  --card-shadow: rgba(25, 30, 40, 0.08);

  --nav-bg: rgba(233, 236, 240, 0.92);
  --nav-bg-2: rgba(222, 226, 231, 0.90);
  --nav-divider: rgba(25, 30, 40, 0.08);
  --nav-active-bg: rgba(193, 18, 58, 0.08);
  --nav-active-text: #14171c;

  --highlight-bg: rgba(255, 244, 247, 0.98);
  --highlight-inset: rgba(193, 18, 58, 0.06);
  --highlight-glow: rgba(193, 18, 58, 0.08);

  --text: #14171c;
  --muted: #5f6875;
  --text-soft: #2a313b;

  --red: #c1123a;
  --red-dim: #8f1027;
  --red-glow: rgba(193, 18, 58, 0.12);

  --shadow: rgba(25, 30, 40, 0.12);
  --shadow-red: rgba(193, 18, 58, 0.08);

  /* Overlays are intentionally much softer in light mode */
  --noise-opacity: 0.006;
  --vignette-opacity: 0.05;

  --scanline-sweep-opacity: 0.28;
  --scanline-pattern-opacity: 0.18;
  --scanline-sweep-color: rgba(0, 0, 0, 0.16);
  --scanline-pattern-color: rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   BASE RESET AND GLOBAL DOCUMENT STYLING
   ========================================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

/* --------------------------------------------------------------------------
   The page background uses layered gradients to add depth without requiring
   external images. This helps the terminal shell separate from the page.
   -------------------------------------------------------------------------- */
body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top center, rgba(255, 49, 92, 0.12), transparent 32%),
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.04), transparent 20%),
    linear-gradient(to bottom, var(--bg-alt), var(--bg) 68%);
}

/* Consistent muted text styling for secondary interface labels */
.subtitle,
.small,
.title {
  color: var(--muted);
}

/* ==========================================================================
   OVERLAY LAYERS
   --------------------------------------------------------------------------
   The site uses two fixed overlay elements in the background:
   - .noise: very subtle static grain for texture
   - .scanlines: CRT scanline pattern and sweep line using pseudo-elements
   ========================================================================== */

.noise,
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   Subtle static film-grain texture.
   This is intentionally restrained so the CRT effect is driven mainly by the
   scanline layer rather than by aggressive noise animation.
   -------------------------------------------------------------------------- */
.noise {
  opacity: var(--noise-opacity);
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 2px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0px,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 3px
    );
  background-size:
    3px 3px,
    4px 4px;
  mix-blend-mode: soft-light;
}

/* --------------------------------------------------------------------------
   CRT scanline overlay container.
   The real visible effect is rendered by the ::before and ::after pseudo-
   elements below.
   -------------------------------------------------------------------------- */
.scanlines {
  overflow: hidden;
}

/* Shared pseudo-element base */
.scanlines::before,
.scanlines::after {
  display: block;
  pointer-events: none;
  content: "";
  position: absolute;
}

/* --------------------------------------------------------------------------
   Moving sweep line.
   This travels vertically down the viewport and gives the screen a classic
   analog refresh-pass feel.
   -------------------------------------------------------------------------- */
.scanlines::before {
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to bottom,
    rgba(155, 155, 155, 0.04),
    var(--scanline-sweep-color),
    rgba(155, 155, 155, 0.02)
  );
  opacity: var(--scanline-sweep-opacity);
  animation: scanline-sweep var(--scanline-sweep-duration) linear infinite;
}

/* --------------------------------------------------------------------------
   Repeating horizontal scanline pattern.
   This creates the persistent CRT line structure across the full screen.
   -------------------------------------------------------------------------- */
.scanlines::after {
  inset: 0;
  background: linear-gradient(
    to bottom,
    trasparent 0%,
    transparent 30%,
    var(--scanline-pattern-color) 30%,
    var(--scanline-pattern-color) 70%,
    transparent 70%,
    transparent 100%
  );
  background-size: 100% var(--scanline-pattern-size);
  opacity: var(--scanline-pattern-opacity);
  animation: scanline-texture var(--scanline-pattern-duration) steps(60) infinite;
}

/* --------------------------------------------------------------------------
   Soft screen vignette.
   This slightly darkens the outer edges so the page reads more like a display
   surface and less like a flat browser canvas.
   -------------------------------------------------------------------------- */
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(
      ellipse at center,
      transparent 55%,
      rgba(0, 0, 0, var(--vignette-opacity)) 100%
    );
}

/* ==========================================================================
   MAIN SHELL / WINDOW CHROME
   ========================================================================== */

/* --------------------------------------------------------------------------
   The terminal shell is the primary container for the faux-terminal layout:
   titlebar, navigation, and page content.
   -------------------------------------------------------------------------- */
.terminal-shell {
  position: relative;
  z-index: 1;
  width: min(1000px, calc(100% - 2rem));
  margin: 3rem auto;
  background: linear-gradient(to bottom, var(--panel), var(--panel-2));
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px var(--panel-border-soft),
    0 24px 60px var(--shadow),
    0 0 24px var(--shadow-red);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Top terminal titlebar.
   This aligns the faux window controls on the left and the title / theme
   control on the right.
   -------------------------------------------------------------------------- */
.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--panel-border);
  background: var(--terminal-bar-bg);
}

/* Left cluster for the window-control dots */
.terminal-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
}

/* Right cluster for the title and theme toggle */
.terminal-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
  min-width: 0;
}

/* Faux window control dots */
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red {
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
}

.dot.dark {
  background: #3a3a3a;
}

/* Terminal window title */
.title {
  margin-left: 0;
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* ==========================================================================
   GENERIC LAYOUT BLOCKS
   ========================================================================== */

.hero,
.grid,
.footer-panel {
  padding: 2rem 1.5rem 1.5rem;
}

/* Small monospace labels used throughout the UI */
.prompt,
.label {
  margin: 0 0 0.75rem 0;
  color: var(--red);
  font-family: "Courier New", Courier, monospace;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

/* Primary page headings */
.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 49, 92, 0.16);
}

/* Supporting hero copy */
.subtitle {
  max-width: 62ch;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Responsive content grid used for cards and feed layouts */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ==========================================================================
   CARD SURFACES
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared card and footer panel styling.
   Cards are elevated slightly above the shell background to preserve legibility
   and improve the page's structural hierarchy.
   -------------------------------------------------------------------------- */
.card,
.footer-panel {
  background: linear-gradient(to bottom, var(--card-bg), var(--card-bg-2));
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow:
    inset 0 0 0 1px var(--card-inset),
    0 10px 24px var(--card-shadow);
  padding: 1.35rem 1.4rem;
}

.card h2,
.footer-panel h2 {
  margin: 0 0 0.75rem 0;
  line-height: 1.25;
  color: var(--text);
}

.card p,
.card li,
.footer-panel p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.75;
}

.card p + p,
.card ul,
.card ol {
  margin-top: 0.9rem;
}

/* Small helper text */
.small {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Live clock treatment on the home page */
#clock {
  color: var(--red);
  font-family: "Courier New", Courier, monospace;
  font-size: 2rem;
  letter-spacing: 0.08em;
}

/* ==========================================================================
   BUTTONS AND CONTROLS
   ========================================================================== */

/* Primary inline action button */
.button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--red-dim);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: "Courier New", Courier, monospace;
  transition: all 0.2s ease;
  background: rgba(255, 49, 92, 0.08);
}

.button:hover {
  background: rgba(255, 49, 92, 0.14);
  box-shadow: 0 0 18px var(--red-glow);
}

/* Theme toggle button placed in the titlebar */
.theme-toggle {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255, 49, 92, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(255, 49, 92, 0.14);
  box-shadow: 0 0 14px var(--red-glow);
}

.theme-toggle:active {
  transform: translateY(1px);
}

.theme-toggle-label {
  display: inline-block;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

/* Top navigation strip beneath the titlebar */
.site-nav {
  display: flex;
  justify-content: space-evenly;
  align-items: stretch;
  width: 100%;
  padding: 0;
  border-bottom: 1px solid var(--panel-border);
  background: linear-gradient(to bottom, var(--nav-bg), var(--nav-bg-2));
}

/* Individual navigation tabs */
.nav-link {
  position: relative;
  flex: 1;
  text-align: center;
  padding: 1rem 0.75rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: color 0.2s ease, background 0.2s ease, text-shadow 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 49, 92, 0.05);
  text-shadow: 0 0 8px var(--red-glow);
}

/* Animated underline indicator */
.nav-link::after {
  content: "";
  position: absolute;
  left: 12%;
  bottom: 0;
  width: 76%;
  height: 2px;
  background: var(--red);
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
  box-shadow: 0 0 10px var(--red-glow);
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* Subtle dividers between tabs */
.nav-link:not(:last-child) {
  border-right: 1px solid var(--nav-divider);
}

/* Active tab state */
.nav-link.active {
  color: var(--nav-active-text);
  background: var(--nav-active-bg);
  box-shadow: inset 0 -1px 0 rgba(255, 49, 92, 0.25);
}

/* ==========================================================================
   CONTENT-SPECIFIC LAYOUTS
   ========================================================================== */

.section-block {
  padding: 0 1.5rem 2rem;
}

.section-block .small {
  margin-bottom: 1rem;
}

/* Section heading label */
.section-label {
  margin: 0 0 0.85rem 0;
  color: var(--red);
  font-family: "Courier New", Courier, monospace;
  letter-spacing: 0.04em;
}

/* Roadmap / pathway grid */
.roadmap-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Decorative terminal-style marker on roadmap cards */
.roadmap-card {
  position: relative;
}

.roadmap-card::after {
  content: ">";
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  color: rgba(255, 49, 92, 0.18);
  font-family: "Courier New", Courier, monospace;
  font-size: 1.5rem;
}

/* Featured / highlighted cards */
.highlight-card {
  border-color: var(--red-dim);
  box-shadow:
    inset 0 0 0 1px var(--highlight-inset),
    0 0 20px var(--highlight-glow);
  background: var(--highlight-bg);
}

/* Outcomes and topic lists */
.outcome-list {
  margin: 0;
  padding-left: 1.2rem;
}

.outcome-list li,
.topic-list li {
  color: var(--text-soft);
}

.outcome-list li {
  margin-bottom: 0.65rem;
  line-height: 1.6;
}

/* Course page stacked layout */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.course-card h2 {
  margin-bottom: 0.75rem;
}

.course-card p:last-child {
  line-height: 1.75;
}

/* Optional muted helper paragraph used above topic lists */
.topic-summary {
  margin-bottom: 1rem !important;
  color: var(--muted) !important;
  line-height: 1.75;
}

.topic-list {
  margin: 0;
  padding-left: 1.25rem;
}

.topic-list li {
  margin-bottom: 0.65rem;
  line-height: 1.7;
}

/* ==========================================================================
   AUTOMATIC LIGHT MODE FALLBACK
   --------------------------------------------------------------------------
   If no explicit theme is set on the document, the site follows the user's
   system preference for light mode.
   ========================================================================== */

@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --bg: #eceff3;
    --bg-alt: #dfe4ea;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-2: rgba(245, 247, 250, 0.94);
    --terminal-bar-bg: rgba(232, 236, 241, 0.95);

    --panel-border: #d3d8df;
    --panel-border-soft: rgba(193, 18, 58, 0.10);

    --card-bg: rgba(255, 255, 255, 0.94);
    --card-bg-2: rgba(244, 246, 249, 0.98);
    --card-inset: rgba(193, 18, 58, 0.04);
    --card-shadow: rgba(25, 30, 40, 0.08);

    --nav-bg: rgba(233, 236, 240, 0.92);
    --nav-bg-2: rgba(222, 226, 231, 0.90);
    --nav-divider: rgba(25, 30, 40, 0.08);
    --nav-active-bg: rgba(193, 18, 58, 0.08);
    --nav-active-text: #14171c;

    --highlight-bg: rgba(255, 244, 247, 0.98);
    --highlight-inset: rgba(193, 18, 58, 0.06);
    --highlight-glow: rgba(193, 18, 58, 0.08);

    --text: #14171c;
    --muted: #5f6875;
    --text-soft: #2a313b;

    --red: #c1123a;
    --red-dim: #8f1027;
    --red-glow: rgba(193, 18, 58, 0.12);

    --shadow: rgba(25, 30, 40, 0.12);
    --shadow-red: rgba(193, 18, 58, 0.08);

    --noise-opacity: 0.006;
    --vignette-opacity: 0.05;

    --scanline-sweep-opacity: 0.18;
    --scanline-pattern-opacity: 0.10;
    --scanline-sweep-color: rgba(0, 0, 0, 0.10);
    --scanline-pattern-color: rgba(0, 0, 0, 0.08);
  }
}

/* ==========================================================================
   MOTION REDUCTION ACCESSIBILITY SUPPORT
   --------------------------------------------------------------------------
   Users who prefer reduced motion should not receive animated CRT effects.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .scanlines::before,
  .scanlines::after {
    animation: none;
  }
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 640px) {
  .terminal-shell {
    margin: 1rem auto;
  }

  .hero,
  .grid,
  .footer-panel {
    padding: 1.1rem;
  }

  .site-nav {
    flex-wrap: wrap;
  }

  .nav-link {
    flex: 1 1 50%;
    font-size: 0.9rem;
    padding: 0.9rem 0.5rem 0.8rem;
  }

  .terminal-bar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .terminal-right {
    width: 100%;
    justify-content: space-between;
  }

  .title {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ==========================================================================
   CRT ANIMATION KEYFRAMES
   --------------------------------------------------------------------------
   These keyframes implement the classic CRT sweep-line motion and the subtle
   movement of the repeating scanline texture.
   ========================================================================== */

/* Vertical sweep line traveling down the viewport */
@keyframes scanline-sweep {
  0% {
    transform: translate3d(0, -10vh, 0);
  }
  100% {
    transform: translate3d(0, 110vh, 0);
  }
}

/* Slight movement in the repeating scanline texture */
@keyframes scanline-texture {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 4px;
  }
}

