/* ============================================================
   KMSP42 OTP Training Course — Shared Stylesheet
   ============================================================ */

/* --- Font Faces --- */
@font-face { font-family: 'Share Tech Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/share-tech-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'Bebas Neue'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/bebas-neue-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 300; font-style: normal; font-display: swap; src: url('/fonts/ibm-plex-mono-300.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/ibm-plex-mono-600.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 300; font-style: normal; font-display: swap; src: url('/fonts/ibm-plex-sans-300.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/ibm-plex-sans-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/ibm-plex-sans-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/ibm-plex-sans-600.woff2') format('woff2'); }

/* --- Custom Properties --- */
:root {
  /* Grey scale */
  --grey-900: #0d0f10;
  --grey-800: #141618;
  --grey-750: #1a1d1f;
  --grey-700: #1e2224;
  --grey-600: #252a2c;
  --grey-500: #586870;
  --grey-400: #728088;
  --grey-300: #8a9299;
  --grey-200: #95a0a8;
  --grey-100: #b8c0c5;
  --titanium: #c8d0d4;
  --titanium-shine: #dde4e8;

  /* Content mode (gold/amber) */
  --gold: #d4a843;
  --gold-dim: #a07830;
  --gold-glow: rgba(212,168,67,0.12);
  --fyeo-red: #ff6b35;

  /* Training mode (blue) */
  --blue: #3ab4f5;
  --blue-dim: #1a8cc8;
  --blue-glow: rgba(58,180,245,0.12);

  /* Feedback */
  --correct: #4dff91;
  --correct-glow: rgba(77,255,145,0.15);
  --wrong: #ff4444;
  --wrong-glow: rgba(255,68,68,0.15);

  /* Reference site */
  --green: #4dff91;
  --green-dim: #1aab52;
}

/* ============================================================
   1. Base Styles
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--grey-900);
  color: var(--grey-100);
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.05) 2px,
    rgba(0,0,0,0.05) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--titanium-shine);
}

strong {
  font-weight: 500;
  color: var(--titanium);
}

code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9em;
  background: var(--grey-800);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--gold);
}

p {
  margin-bottom: 16px;
}

ul, ol {
  margin: 0 0 16px 24px;
}

li {
  margin-bottom: 6px;
}

/* ============================================================
   2. Sticky Nav (.course-nav)
   ============================================================ */
.course-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 52px;
  background: rgba(13,15,16,0.95);
  border-bottom: 1px solid var(--grey-600);
  backdrop-filter: blur(10px);
}

.course-nav-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 4px;
  color: var(--titanium-shine);
  text-decoration: none;
}

.course-nav-logo span {
  color: var(--green);
}

.course-nav-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
}

.course-nav-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--green-dim);
  border: 1px solid var(--green-dim);
  padding: 3px 8px;
  text-transform: uppercase;
  transition: all 0.3s;
}

.course-nav-badge:hover {
  color: var(--green);
  border-color: var(--green);
}

/* ============================================================
   3. Course Layout & Sidebar
   ============================================================ */
.course-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 52px);
}

.course-sidebar {
  width: 220px;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  background: var(--grey-800);
  border-right: 1px solid var(--grey-600);
  padding: 20px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--grey-600) var(--grey-800);
}

.course-sidebar::-webkit-scrollbar {
  width: 4px;
}

.course-sidebar::-webkit-scrollbar-track {
  background: var(--grey-800);
}

.course-sidebar::-webkit-scrollbar-thumb {
  background: var(--grey-600);
  border-radius: 2px;
}

.sidebar-heading {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--grey-400);
  padding: 8px 16px;
  margin-top: 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: var(--grey-300);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.2s;
}

.sidebar-link:hover {
  color: var(--titanium);
  background: var(--grey-750);
  border-left-color: var(--grey-400);
}

.sidebar-link.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: var(--gold-glow);
}

.sidebar-link.complete {
  color: var(--green-dim);
}

.sidebar-link .sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--grey-500);
}

.sidebar-link.active .sidebar-dot {
  background: var(--gold);
}

.sidebar-link.complete .sidebar-dot {
  background: var(--green);
}

/* ============================================================
   4. Content Area
   ============================================================ */
.course-content {
  max-width: 760px;
  padding: 40px;
}

/* ============================================================
   5. Module Header
   ============================================================ */
.module-header {
  position: relative;
  border: 2px solid var(--gold);
  padding: 28px 32px 24px;
  margin-bottom: 40px;
}

.module-header::before,
.module-header::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--fyeo-red);
  border-style: solid;
}

.module-header::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.module-header::after {
  top: -1px;
  right: -1px;
  border-width: 2px 2px 0 0;
}

.module-header-bottom-left,
.module-header-bottom-right {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--fyeo-red);
  border-style: solid;
}

.module-header-bottom-left {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 2px 2px;
}

.module-header-bottom-right {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

.module-number {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 6px;
}

.module-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  letter-spacing: 3px;
  color: var(--titanium-shine);
  line-height: 1.1;
  margin-bottom: 12px;
}

.reading-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--grey-400);
  text-transform: uppercase;
}

/* ============================================================
   6. Callout Boxes
   ============================================================ */
.callout {
  position: relative;
  background: #111;
  border: 1px solid var(--gold);
  padding: 24px 20px 20px;
  margin: 28px 0;
}

.callout-label {
  position: absolute;
  top: -8px;
  left: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  background: #111;
  padding: 0 8px;
}

.callout-venona {
  border-color: var(--fyeo-red);
}

.callout-venona .callout-label {
  color: var(--fyeo-red);
}

/* ============================================================
   7. Section Headings
   ============================================================ */
.section-heading {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 2px;
  color: var(--titanium-shine);
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--grey-600);
}

/* ============================================================
   8. Code Blocks
   ============================================================ */
.code-block {
  background: var(--grey-800);
  border: 1px solid var(--grey-600);
  border-radius: 4px;
  padding: 16px 20px;
  margin: 16px 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--titanium);
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
}

/* ============================================================
   9. Content Tables
   ============================================================ */
.content-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13px;
}

.content-table th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--grey-800);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--gold-dim);
}

.content-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--grey-600);
  color: var(--grey-100);
}

.content-table tr:hover td {
  background: var(--grey-750);
}

/* ============================================================
   10. Exercise Section
   ============================================================ */
.exercise-section {
  border-left: 3px solid var(--blue);
  background: var(--blue-glow);
  padding: 24px 24px 24px 28px;
  margin: 28px 0;
}

.exercise-section-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 12px;
}

/* ============================================================
   11. Answer Toggle
   ============================================================ */
.answer-toggle {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--blue);
  background: transparent;
  border: 1px solid var(--blue-dim);
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.2s;
  margin: 12px 0;
}

.answer-toggle:hover {
  background: var(--blue-glow);
  border-color: var(--blue);
}

.answer-content {
  display: none;
  margin-top: 12px;
  padding: 16px 20px;
  background: var(--grey-800);
  border: 1px solid var(--grey-600);
}

.answer-content.visible {
  display: block;
}

/* ============================================================
   12. Drill Input
   ============================================================ */
.drill-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 24px;
  font-weight: 400;
  color: var(--titanium-shine);
  background: var(--grey-800);
  border: 2px solid var(--blue);
  padding: 10px 16px;
  outline: none;
  width: 100%;
  max-width: 400px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.drill-input:focus {
  box-shadow: 0 0 12px var(--blue-glow);
}

.drill-input.correct {
  border-color: var(--correct);
  box-shadow: 0 0 16px var(--correct-glow);
}

.drill-input.wrong {
  border-color: var(--wrong);
  box-shadow: 0 0 16px var(--wrong-glow);
}

/* ============================================================
   13. Timer
   ============================================================ */
.timer {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 32px;
  font-weight: 600;
  color: var(--blue);
  text-shadow: 0 0 20px var(--blue-glow);
  letter-spacing: 2px;
}

/* ============================================================
   14. Personal Best
   ============================================================ */
.personal-best {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}

/* ============================================================
   15. Skill Matrix
   ============================================================ */
.skill-matrix {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13px;
}

.skill-matrix th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--grey-800);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--blue-dim);
}

.skill-matrix td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--grey-600);
  color: var(--grey-100);
}

.skill-matrix tr:hover td {
  background: var(--grey-750);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.status-dot.met {
  background: var(--correct);
  box-shadow: 0 0 6px var(--correct-glow);
}

.status-dot.near {
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
}

.status-dot.far {
  background: var(--wrong);
  box-shadow: 0 0 6px var(--wrong-glow);
}

.status-dot.none {
  background: var(--grey-500);
}

/* ============================================================
   16. Module Grid
   ============================================================ */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 28px 0;
}

.module-card {
  background: var(--grey-800);
  border: 1px solid var(--grey-600);
  padding: 24px;
  text-decoration: none;
  transition: all 0.25s;
  display: block;
}

.module-card:hover {
  border-color: var(--gold-dim);
  background: var(--grey-750);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.module-card-number {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 6px;
}

.module-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--titanium-shine);
  margin-bottom: 8px;
}

.module-card-desc {
  font-size: 13px;
  color: var(--grey-300);
  line-height: 1.6;
  margin-bottom: 12px;
}

.module-card-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--grey-400);
  text-transform: uppercase;
}

/* ============================================================
   17. Bottom Module Nav
   ============================================================ */
.module-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--grey-600);
}

.module-nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--grey-300);
  text-decoration: none;
  transition: color 0.2s;
}

.module-nav a:hover {
  color: var(--gold);
}

.mark-complete-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--correct);
  background: transparent;
  border: 1px solid var(--correct);
  padding: 8px 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.mark-complete-btn:hover {
  background: var(--correct-glow);
}

.mark-complete-btn.completed {
  background: var(--correct);
  color: var(--grey-900);
}

/* ============================================================
   18. Games Page
   ============================================================ */
.games-header {
  text-align: center;
  padding: 40px 20px 32px;
  border-bottom: 1px solid var(--grey-600);
  margin-bottom: 32px;
}

.games-header h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px;
  letter-spacing: 4px;
  color: var(--titanium-shine);
  margin-bottom: 8px;
}

.games-header p {
  font-size: 14px;
  color: var(--grey-300);
}

.session-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 16px 0;
  margin-bottom: 28px;
}

.session-stats .stat {
  text-align: center;
}

.session-stats .stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 24px;
  font-weight: 600;
  color: var(--blue);
}

.session-stats .stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--grey-400);
  margin-top: 4px;
}

.drill-card {
  background: var(--grey-800);
  border: 1px solid var(--grey-600);
  padding: 28px;
  margin-bottom: 20px;
}

.drill-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--titanium-shine);
  margin-bottom: 8px;
}

.drill-card-desc {
  font-size: 13px;
  color: var(--grey-300);
  margin-bottom: 16px;
}

.start-btn {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--blue);
  background: transparent;
  border: 1px solid var(--blue);
  padding: 8px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.start-btn:hover {
  background: var(--blue-glow);
  color: var(--titanium-shine);
  border-color: var(--blue);
}

/* ============================================================
   19. Progress Dots
   ============================================================ */
.progress-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.progress-not-started {
  background: var(--grey-500);
}

.progress-visited {
  background: var(--gold);
  box-shadow: 0 0 4px var(--gold-glow);
}

.progress-complete {
  background: var(--correct);
  box-shadow: 0 0 4px var(--correct-glow);
}

/* ============================================================
   20. Responsive (max-width: 700px)
   ============================================================ */
@media (max-width: 700px) {
  .course-layout {
    grid-template-columns: 1fr;
  }

  .course-sidebar {
    position: fixed;
    top: 52px;
    left: -260px;
    width: 260px;
    height: calc(100vh - 52px);
    z-index: 180;
    transition: left 0.3s;
    border-right: 1px solid var(--grey-600);
  }

  .course-sidebar.open {
    left: 0;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 60px;
    left: 8px;
    z-index: 190;
    width: 36px;
    height: 36px;
    background: var(--grey-800);
    border: 1px solid var(--grey-600);
    color: var(--grey-300);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .sidebar-toggle:hover {
    color: var(--gold);
    border-color: var(--gold-dim);
  }

  .course-nav {
    padding: 0 16px;
  }

  .course-nav-title {
    display: none;
  }

  .course-content {
    padding: 24px 16px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-header {
    padding: 20px;
  }

  .module-title {
    font-size: 28px;
  }

  .module-nav {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    text-align: center;
  }

  .session-stats {
    flex-wrap: wrap;
    gap: 20px;
  }

  .drill-input {
    font-size: 18px;
    max-width: 100%;
  }

  .timer {
    font-size: 24px;
  }
}

/* Hide sidebar toggle on desktop */
@media (min-width: 701px) {
  .sidebar-toggle {
    display: none;
  }
}

/* ============================================================
   21. Print
   ============================================================ */
@media print {
  body {
    background: #f5f0e6;
    color: #222;
  }

  body::before {
    display: none;
  }

  .course-nav,
  .course-sidebar,
  .sidebar-toggle,
  .module-nav,
  .mark-complete-btn,
  .answer-toggle,
  .start-btn {
    display: none;
  }

  .course-layout {
    grid-template-columns: 1fr;
  }

  .course-content {
    max-width: 100%;
    padding: 20px;
  }

  .module-header {
    border-color: #888;
  }

  .module-header::before,
  .module-header::after,
  .module-header-bottom-left,
  .module-header-bottom-right {
    display: none;
  }

  .module-title {
    color: #111;
  }

  .callout {
    background: #f0ebe0;
    border-color: #888;
  }

  .code-block {
    background: #eee;
    border-color: #ccc;
    color: #222;
  }

  .content-table th {
    background: #ddd;
    color: #333;
    border-bottom-color: #888;
  }

  .content-table td {
    border-bottom-color: #ccc;
    color: #222;
  }

  .exercise-section {
    border-left-color: #888;
    background: #f0ebe0;
  }

  .answer-content {
    display: block;
    background: #f0ebe0;
    border-color: #ccc;
  }

  a {
    color: #222;
    text-decoration: underline;
  }
}
