/* ==========================================================================
   BREACHFALL — Tactical Military Design System
   Matches engine_extension/Sources/BreachfallEngine/MilitaryUITheme.swift
   ========================================================================== */

:root {
  --bg-canvas: #0b0e0c;
  --bg-panel: #151a17;
  --bg-panel-elevated: #1b221e;
  --olive: #38452b;
  --olive-bright: #4b5c3a;
  --edge: #66704f;
  --edge-dim: rgba(102, 112, 79, 0.38);
  --text: #ede8db;
  --muted: #abb59c;
  --amber: #f0b74d;
  --amber-soft: rgba(240, 183, 77, 0.14);
  --armor: #80c2c7;
  --danger: #d95447;
  --crimson: #c92a2a;

  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max-width: 1180px;
  --chamfer: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-canvas);
  color: var(--text);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(56, 69, 43, 0.18), transparent 45%),
    linear-gradient(rgba(102, 112, 79, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 112, 79, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--amber);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease;
}

a:hover {
  color: #ffd074;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Typography */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.05;
  margin: 0;
  color: var(--text);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--amber);
  display: inline-block;
}

.section-header {
  margin-bottom: 36px;
}

.section-header h2 {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  margin-top: 10px;
}

.section-header p {
  color: var(--muted);
  max-width: 680px;
  margin: 12px 0 0;
  font-size: 1.05rem;
}

/* Military Chamfered Panel */
.tac-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(27, 34, 30, 0.96), rgba(21, 26, 23, 0.98));
  border: 1px solid var(--edge-dim);
  border-left: 3px solid var(--edge);
  clip-path: polygon(
    0 0,
    calc(100% - var(--chamfer)) 0,
    100% var(--chamfer),
    100% 100%,
    var(--chamfer) 100%,
    0 calc(100% - var(--chamfer))
  );
  padding: 24px;
}

.tac-panel--amber {
  border-left-color: var(--amber);
}

.tac-panel--danger {
  border-left-color: var(--danger);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 13px 26px;
  border: 1.5px solid var(--edge);
  background: rgba(56, 69, 43, 0.85);
  color: var(--text);
  cursor: pointer;
  clip-path: polygon(
    0 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% 100%,
    10px 100%,
    0 calc(100% - 10px)
  );
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease, color 0.18s ease;
}

.btn:hover {
  background: var(--olive-bright);
  border-color: var(--amber);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #0b0e0c;
}

.btn--primary:hover {
  background: #ffca63;
  border-color: #ffca63;
  color: #0b0e0c;
}

.btn--ghost {
  background: rgba(21, 26, 23, 0.85);
  border-color: var(--edge);
  color: var(--text);
}

/* Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 14, 12, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--edge-dim);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--edge);
  object-fit: cover;
}

.brand-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text);
}

.brand-slash {
  height: 2px;
  width: 100%;
  margin-top: 3px;
  background: linear-gradient(90deg, transparent, var(--crimson) 20%, var(--danger) 55%, transparent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--amber);
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 82vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--edge-dim);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url("/assets/hero-deployment.webp");
  background-size: cover;
  background-position: 32% center;
  filter: brightness(0.74) contrast(1.06);
  transform: scale(1.02);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 14, 12, 0.94) 0%, rgba(11, 14, 12, 0.72) 48%, rgba(11, 14, 12, 0.35) 100%),
    linear-gradient(180deg, rgba(11, 14, 12, 0.3) 0%, rgba(11, 14, 12, 0.15) 60%, var(--bg-canvas) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 88px 0 76px;
  max-width: 650px;
}

.hero-wordmark {
  display: inline-block;
  margin-bottom: 18px;
}

.hero-wordmark span {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--amber);
}

.hero-wordmark .slash-bar {
  height: 3px;
  margin-top: 6px;
  background: linear-gradient(90deg, var(--crimson), var(--danger) 65%, transparent);
}

.hero h1 {
  font-size: clamp(3.4rem, 7.5vw, 5.8rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.03em;
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.7);
}

.hero-amber-rule {
  width: 96px;
  height: 5px;
  background: var(--amber);
  margin: 22px 0;
}

.hero-lead {
  font-size: 1.15rem;
  color: #d9d6cb;
  max-width: 560px;
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}

.platform-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(21, 26, 23, 0.85);
  border: 1px solid var(--edge-dim);
}

.platform-pill strong {
  color: var(--text);
}

/* Telemetry Strip */
.telemetry-strip {
  border-bottom: 1px solid var(--edge-dim);
  background: rgba(21, 26, 23, 0.92);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--edge-dim);
}

.telemetry-cell {
  background: var(--bg-panel);
  padding: 22px 18px;
  text-align: center;
}

.telemetry-value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--amber);
  line-height: 1;
}

.telemetry-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* Sections */
.section {
  padding: 78px 0;
  border-bottom: 1px solid var(--edge-dim);
}

.section--alt {
  background: rgba(16, 20, 17, 0.65);
}

/* Feature Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.feature-index {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  color: var(--amber);
  margin-bottom: 8px;
}

.feature-card h3 {
  font-size: 1.65rem;
  margin-bottom: 10px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  background: rgba(56, 69, 43, 0.38);
  border: 1px solid var(--edge-dim);
  color: var(--text);
}

.tag--armor {
  border-color: rgba(128, 194, 199, 0.45);
  color: var(--armor);
  background: rgba(128, 194, 199, 0.08);
}

/* Arsenal Grid */
.arsenal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.weapon-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}

.weapon-sprite-wrap {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  background: radial-gradient(circle, rgba(240, 183, 77, 0.09), transparent 72%);
  border-bottom: 1px solid var(--edge-dim);
  padding: 8px;
}

.weapon-sprite-wrap img {
  max-height: 58px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.75));
}

.weapon-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.weapon-head h3 {
  font-size: 1.35rem;
}

.weapon-role {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
}

.weapon-card p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--muted);
}

/* Gallery */
.gallery-featured {
  margin-bottom: 20px;
  border: 1.5px solid var(--edge);
  background: #080a09;
  overflow: hidden;
  cursor: pointer;
}

.gallery-featured img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.gallery-featured:hover img {
  transform: scale(1.015);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.gallery-item {
  border: 1px solid var(--edge-dim);
  background: #0d110e;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.gallery-item:hover {
  border-color: var(--amber);
  transform: translateY(-2px);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.gallery-caption {
  padding: 10px 14px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery-caption span:first-child {
  color: var(--text);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 7, 6, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  max-width: 1200px;
  width: 100%;
  position: relative;
}

.lightbox-inner img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border: 1.5px solid var(--edge);
  background: #0b0e0c;
}

.lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--edge);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* Legal & Support Document Pages */
.doc-hero {
  padding: 58px 0 40px;
  border-bottom: 1px solid var(--edge-dim);
  background: linear-gradient(180deg, rgba(21, 26, 23, 0.85), rgba(11, 14, 12, 0.4));
}

.doc-hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  margin-top: 10px;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--muted);
}

.doc-meta strong {
  color: var(--text);
}

.doc-body {
  padding: 48px 0 78px;
}

.doc-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: 90px;
}

.doc-toc h4 {
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  color: var(--amber);
  margin-bottom: 14px;
}

.doc-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-toc a {
  color: var(--muted);
  font-size: 0.94rem;
}

.doc-toc a:hover {
  color: var(--amber);
}

.prose {
  max-width: 780px;
}

.prose h2 {
  font-size: 1.75rem;
  margin: 36px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--edge-dim);
  color: var(--text);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  font-size: 1.25rem;
  margin: 22px 0 8px;
  color: var(--amber);
}

.prose p {
  margin: 0 0 14px;
  color: #d6d4cb;
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: #d6d4cb;
}

.prose li {
  margin-bottom: 8px;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  background: rgba(56, 69, 43, 0.32);
  border: 1px solid var(--edge-dim);
  color: var(--amber);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.94rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--edge-dim);
  vertical-align: top;
}

.data-table th {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(56, 69, 43, 0.35);
  color: var(--amber);
  font-size: 0.95rem;
}

.data-table td {
  background: rgba(21, 26, 23, 0.8);
  color: #d6d4cb;
}

.callout {
  margin: 20px 0 24px;
  padding: 18px 20px;
  background: var(--amber-soft);
  border: 1px solid rgba(240, 183, 77, 0.35);
  border-left: 3px solid var(--amber);
  color: var(--text);
}

.callout strong {
  color: var(--amber);
}

/* Footer */
.site-footer {
  padding: 48px 0 54px;
  background: #080a09;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--edge-dim);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--amber);
}

.footer-bottom {
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 960px) {
  .telemetry-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .arsenal-grid,
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .doc-toc {
    position: static;
  }
}

@media (max-width: 680px) {
  .nav-bar {
    flex-wrap: wrap;
    padding: 12px 0;
  }
  .nav-links {
    width: 100%;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .features-grid,
  .arsenal-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .telemetry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero {
    min-height: 70vh;
  }
  .hero-bg {
    background-position: 24% center;
  }
  .hero-content {
    padding: 64px 0 56px;
  }
}
