/* =========================================================
   HIGHLAND EXPEDITIONARY ROVER DESIGN SYSTEM
   235th Highland Rover Crew (Kandy District, SLSA)
   Theme: Precision Telemetry Brutalism & Tactical Field Guide
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Noto+Sans+Sinhala:wght@400;600;700&family=Noto+Sans+Tamil:wght@400;600;700&display=swap');

:root {
  /* Surface & Base Colors */
  --color-surface: #0f1419;
  --color-surface-dim: #0f1419;
  --color-surface-bright: #353a3f;
  --color-surface-lowest: #0a0f14;
  --color-surface-low: #171c21;
  --color-surface-card: #1b2025;
  --color-surface-high: #252a30;
  --color-surface-highest: #30353b;

  /* Text & Mist Colors */
  --color-on-surface: #dee3ea;
  --color-highland-mist: #f4f7f6;
  --color-mist-subtle: #bac5cd;
  --color-mist-dim: #73808c;

  /* Brand Accents */
  --color-crimson-deep: #6a0d10;
  --color-crimson-heritage: #9e1b1e;
  --color-crimson-bright: #c81e1e;
  --color-gold-insignia: #d4af37;
  --color-gold-bright: #f4c430;
  --color-gold-muted: #917424;
  --color-forest-pine: #1e382b;
  --color-forest-moss: #2a4b3a;
  --color-hazard-amber: #e67e22;

  /* Borders & Elevation */
  --color-slate-base: #0b0f13;
  --color-slate-surface: #11161b;
  --color-slate-elevated: #1a2229;
  --color-slate-border: #283039;
  --color-slate-border-light: #37424f;

  /* Typography Stacks */
  --font-editorial: 'Georgia', Cambria, 'Times New Roman', Times, serif;
  --font-headlines: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Noto Sans Sinhala', 'Noto Sans Tamil', sans-serif;
  --font-mono: 'Space Mono', monospace;

  /* Radius Tokens */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Elevation Shadows & Glows */
  --shadow-tactile: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-gold-glow: 0 0 20px rgba(212, 175, 55, 0.15), 0 0 0 1px rgba(212, 175, 55, 0.3);
  --shadow-crimson-glow: 0 4px 20px rgba(158, 27, 30, 0.3);
  --shadow-modal: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(40, 48, 57, 0.8);
}

/* Reset & Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-surface-lowest);
}
::-webkit-scrollbar-thumb {
  background: var(--color-surface-high);
  border-radius: var(--radius-xs);
  border: 1px solid var(--color-slate-border);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-gold-muted);
}

/* Typography Helpers */
.font-editorial {
  font-family: var(--font-editorial);
}
.font-headlines {
  font-family: var(--font-headlines);
}
.font-mono {
  font-family: var(--font-mono);
}

/* Eyebrow / Telemetry Badges */
.eyebrow-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--color-gold-insignia);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Basecamp Telemetry Ribbon */
.telemetry-ribbon {
  background: rgba(10, 15, 20, 0.92);
  border-bottom: 1px solid rgba(40, 48, 57, 0.6);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-mist-subtle);
  padding: 5px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.05em;
  z-index: 60;
  position: relative;
}

.telemetry-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-gold-insignia);
  box-shadow: 0 0 8px var(--color-gold-insignia);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Tactical Card Styles */
.tactical-card {
  background-color: var(--color-surface-low);
  border: 1px solid var(--color-slate-border);
  border-radius: var(--radius-lg);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.tactical-card:hover {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: var(--shadow-gold-glow);
  transform: translateY(-2px);
}

.tactical-card-static {
  background-color: var(--color-surface-low);
  border: 1px solid var(--color-slate-border);
  border-radius: var(--radius-lg);
}

/* Buttons */
.btn-primary-crimson {
  background-color: var(--color-crimson-heritage);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(158, 27, 30, 0.35);
}

.btn-primary-crimson:hover {
  background-color: var(--color-crimson-bright);
  border-color: var(--color-gold-insignia);
  box-shadow: 0 4px 18px rgba(200, 30, 30, 0.45);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-secondary-tactical {
  background-color: var(--color-surface-card);
  color: var(--color-on-surface);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-slate-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-tactical:hover {
  border-color: var(--color-gold-insignia);
  color: var(--color-gold-bright);
  background-color: var(--color-surface-high);
}

.btn-gold-outline {
  border: 1px solid var(--color-gold-insignia);
  color: var(--color-gold-insignia);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-gold-outline:hover {
  background-color: var(--color-gold-insignia);
  color: var(--color-surface-lowest);
}

/* Mobile Drawer & Backdrop */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background-color: var(--color-surface-low);
  border-left: 1px solid var(--color-slate-border);
  z-index: 100;
  padding: 24px;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-modal);
}

.mobile-nav-drawer.open {
  right: 0;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 19, 0.8);
  backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 15, 19, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: var(--color-surface-low);
  border: 1px solid var(--color-slate-border);
  border-top: 2px solid var(--color-crimson-heritage);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-modal);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
  max-width: 820px;
}

.modal-backdrop.open .modal-card {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 1px solid var(--color-slate-border);
  border-radius: var(--radius-sm);
  color: var(--color-mist-subtle);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background-color: var(--color-crimson-deep);
  border-color: var(--color-crimson-heritage);
  color: #ffffff;
}

/* Lightbox */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 20, 0.95);
  backdrop-filter: blur(12px);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.lightbox-modal.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  max-width: 900px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-slate-border);
  box-shadow: var(--shadow-modal);
}

.lightbox-caption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--color-gold-bright);
  font-family: var(--font-mono);
  text-align: center;
}

.lightbox-close-btn {
  position: absolute;
  top: 24px;
  right: 28px;
  background: transparent;
  border: 1px solid var(--color-slate-border);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lightbox-close-btn:hover {
  background-color: var(--color-crimson-heritage);
}

/* Forms & Checkboxes */
.form-input-tactical,
input.form-input-tactical,
textarea.form-input-tactical {
  width: 100%;
  background-color: var(--color-surface-lowest) !important;
  border: 1px solid var(--color-slate-border) !important;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--color-highland-mist) !important;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.form-input-tactical:focus,
input.form-input-tactical:focus,
textarea.form-input-tactical:focus {
  outline: none;
  background-color: var(--color-surface-low) !important;
  border-color: var(--color-gold-insignia) !important;
  box-shadow: 0 0 0 1px var(--color-gold-insignia) !important;
  color: #ffffff !important;
}

.form-input-tactical::placeholder,
input.form-input-tactical::placeholder,
textarea.form-input-tactical::placeholder {
  color: rgba(186, 197, 205, 0.5) !important;
}

/* Custom Checkbox */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background-color: var(--color-surface-lowest);
  border: 1px solid var(--color-slate-border);
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  transition: all 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.custom-checkbox:checked {
  background-color: var(--color-crimson-heritage);
  border-color: var(--color-gold-insignia);
}

.custom-checkbox:checked::after {
  content: '✓';
  font-size: 11px;
  color: var(--color-gold-bright);
  font-weight: 700;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Material Symbols Adjustments */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  .telemetry-ribbon {
    font-size: 10px;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
}

/* Guideline Reader Modal Styles */
.modal-guide-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-slate-border);
}

.guide-tag-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-gold-insignia);
}

.guide-modal-title {
  font-family: var(--font-editorial);
  font-size: 20px;
  color: #ffffff;
  margin: 6px 0 4px;
}

.guide-modal-subtitle {
  font-size: 12px;
  color: var(--color-mist-subtle);
  margin-bottom: 14px;
}

.guide-lang-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-pill {
  background: var(--color-surface-card);
  border: 1px solid var(--color-slate-border);
  color: var(--color-mist-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-pill:hover, .lang-pill.active {
  background: var(--color-crimson-heritage);
  border-color: var(--color-gold-insignia);
  color: #ffffff;
}

.modal-guide-body {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 20px;
}

.guide-book-chapter {
  background: var(--color-surface-card);
  border: 1px solid var(--color-slate-border);
  border-left: 3px solid var(--color-crimson-heritage);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.guide-book-chapter h3 {
  font-family: var(--font-editorial);
  font-size: 15px;
  color: #ffffff;
  margin-bottom: 6px;
}

.guide-book-chapter div {
  font-size: 13px;
  color: var(--color-mist-subtle);
  line-height: 1.6;
}

.modal-guide-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--color-slate-border);
}

/* Lesson Reader Modal Styles */
.lesson-modal-hero {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--color-slate-border);
}

.lesson-modal-hero img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.lesson-modal-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(11, 15, 19, 0.95) 20%, rgba(11, 15, 19, 0.4) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
}

.lesson-content-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-on-surface);
}

.lesson-content-body h3 {
  font-family: var(--font-editorial);
  font-size: 18px;
  color: #ffffff;
  margin: 18px 0 8px;
}

.lesson-content-body p {
  margin-bottom: 12px;
  color: var(--color-mist-subtle);
}

.lesson-content-body ul, .lesson-content-body ol {
  padding-left: 20px;
  margin-bottom: 14px;
  color: var(--color-mist-subtle);
}

.lesson-content-body li {
  margin-bottom: 4px;
}

.lesson-takeaway-card {
  background: var(--color-surface-card);
  border-left: 3px solid var(--color-gold-insignia);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-top: 20px;
}

/* Mobile Polish Utilities */
@media (max-width: 640px) {
  .modal-card {
    padding: 20px 16px;
    max-height: 94vh;
    border-radius: var(--radius-md);
  }
  
  .stage-card-hero {
    flex-direction: column;
    gap: 8px;
  }
  
  .btn-primary-crimson, .btn-secondary-tactical {
    width: 100%;
  }
}
