/* ===========================================
   SIGNALSTUDIO LABS — Tactical Engineering v4
   Standard CSS. No frameworks. No conflicts.
   =========================================== */

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

/* --- BODY --- */
body {
  background-color: #0b0d11 !important;
  color: #f0f2f5;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  margin: 0 !important;
  padding: 0 !important;
}

html {
  scroll-behavior: smooth;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font: inherit;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
::selection { background: #ff4d00; color: #fff; }

/* --- CONTAINER --- */
.wrap {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* --- GRID BACKGROUND --- */
#gridBg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ========== NAVIGATION ========== */
#mainNav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background-color: rgba(11, 13, 17, 0.95);
  border-bottom: 1px solid #1e293b;
  backdrop-filter: blur(8px);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0f2f5;
}

.nav-logo-dot {
  width: 7px;
  height: 7px;
  background-color: #ff4d00;
  border-radius: 2px;
  display: inline-block;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-menu a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  transition: color 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: #f0f2f5;
}

.nav-menu a.active {
  border-bottom: 1px solid #ff4d00;
  padding-bottom: 2px;
}

/* Language Switch */
.lang-switch {
  display: inline-flex;
  border: 1px solid #1e293b;
  border-radius: 2px;
  overflow: hidden;
}

.lang-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  color: #64748b;
  transition: all 0.15s;
}

.lang-btn.active {
  background-color: #ff4d00;
  color: #fff;
}

/* Hamburger */
.ham-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
}

.ham-btn span {
  width: 18px;
  height: 1.5px;
  background-color: #94a3b8;
}

#mobileMenu {
  display: none;
  flex-direction: column;
  padding: 12px 24px 16px;
  border-bottom: 1px solid #1e293b;
  gap: 12px;
  background-color: #0b0d11;
}

#mobileMenu.open {
  display: flex;
}

@media (max-width: 768px) {
  .ham-btn { display: flex; }
  .nav-menu { display: none; }
}

/* ========== TYPOGRAPHY ========== */
.title-xl {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: #f0f2f5;
}

.title-lg {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #f0f2f5;
}

.title-md {
  font-size: 1.15rem;
  font-weight: 600;
  color: #f0f2f5;
}

.label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ff4d00;
}

.subtitle {
  font-size: 0.95rem;
  color: #94a3b8;
  line-height: 1.7;
  max-width: 600px;
}

.mono {
  font-family: 'JetBrains Mono', monospace !important;
}

/* Tactical Code Badge */
.tcode {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #586578;
  padding: 3px 7px;
  border: 1px solid #1e293b;
  border-radius: 2px;
  line-height: 1;
}

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0px;
  border: 1px solid #1e293b;
}

.stats-grid .stat {
  padding: 20px 24px;
  text-align: center;
  border-right: 1px solid #1e293b;
}

.stats-grid .stat:last-child {
  border-right: none;
}

.stats-grid .stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: #f0f2f5;
  line-height: 1.2;
}

.stats-grid .stat-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stats-grid .stat {
    border-bottom: 1px solid #1e293b;
  }
  .stats-grid .stat:nth-child(2n) {
    border-right: none;
  }
  .stats-grid .stat:nth-child(2n+1) {
    border-right: 1px solid #1e293b;
  }
}

@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid .stat {
    border-right: none;
    border-bottom: 1px solid #1e293b;
  }
  .stats-grid .stat:last-child {
    border-bottom: none;
  }
}

/* ========== CARD ========== */
.card {
  border: 1px solid #1e293b;
  background: rgba(255, 255, 255, 0.03);
  padding: 2rem;
  border-radius: 2px;
  position: relative;
  transition: border-color 0.25s;
}

.card:hover {
  border-color: #2a3548;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #1e293b;
}

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 11px 22px;
  background-color: #ff4d00;
  color: #fff;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}

.btn-primary:hover {
  background-color: #e64500;
  transform: translateY(-1px);
}

/* Terminal-style button */
.btn-cmd {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 10px 20px;
  background-color: #0b0d11;
  color: #94a3b8;
  border: 1px solid #1e293b;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-cmd::before {
  content: '>';
  color: #ff4d00;
  font-weight: 700;
}

.btn-cmd:hover {
  border-color: #ff4d00;
  color: #f0f2f5;
}

/* ========== FORM INPUTS ========== */
.input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  padding: 9px 12px;
  background-color: #0b0d11;
  color: #f0f2f5;
  border: 1px solid #1e293b;
  border-radius: 2px;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: #ff4d00;
}

.input::placeholder {
  color: #475569;
}

textarea.input {
  resize: vertical;
  min-height: 90px;
}

/* ========== TERMINAL ========== */
.terminal {
  background-color: #080a0e;
  border: 1px solid #1e293b;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.85;
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid #1e293b;
  background-color: rgba(255, 255, 255, 0.015);
}

.terminal-bar .title {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #475569;
}

.terminal-bar .dots {
  display: flex;
  gap: 5px;
}

.terminal-bar .dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid #1e293b;
}

.term-body {
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.term-body::-webkit-scrollbar { width: 3px; }
.term-body::-webkit-scrollbar-thumb { background: #1e293b; }

.log-line {
  display: block;
  color: #586578;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line .timestamp { opacity: 0.5; }
.log-line .level-info { color: #3b82f6; }
.log-line .level-ok { color: #22c55e; }
.log-line .level-warn { color: #eab308; }
.log-line .level-err { color: #ef4444; }
.log-line .level-sys { color: #ff4d00; }

/* ========== ROI GRID ========== */
.roi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid #1e293b;
}

.roi-grid .roi-cell {
  padding: 18px;
  border-right: 1px solid #1e293b;
  border-bottom: 1px solid #1e293b;
}

.roi-grid .roi-cell:nth-child(3n) { border-right: none; }
.roi-grid .roi-cell:nth-last-child(-n+3) { border-bottom: none; }

.roi-cell .roi-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
}

.roi-cell .roi-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #f0f2f5;
  margin-top: 4px;
}

.roi-cell .roi-val.accent {
  color: #ff4d00 !important;
}

@media (max-width: 640px) {
  .roi-grid { grid-template-columns: 1fr 1fr; }
  .roi-grid .roi-cell:nth-child(3n) { border-right: 1px solid #1e293b; }
  .roi-grid .roi-cell:nth-child(2n) { border-right: none; }
}

@media (max-width: 400px) {
  .roi-grid { grid-template-columns: 1fr; }
  .roi-grid .roi-cell { border-right: none !important; }
}

/* ========== CALENDAR ========== */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-grid .cal-h {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 500;
  color: #475569;
  padding: 5px 0;
}

.cal-grid .cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #94a3b8;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.12s;
}

.cal-grid .cal-day:hover {
  border-color: #ff4d00;
  color: #f0f2f5;
}

.cal-grid .cal-day.booked {
  background-color: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  cursor: not-allowed;
  border-color: rgba(239, 68, 68, 0.15);
}

.cal-grid .cal-day.selected {
  background-color: #ff4d00;
  color: #fff;
  border-color: #ff4d00;
}

/* ========== SVG LOGIC FLOW ========== */
.flow-svg {
  width: 100%;
  display: block;
  overflow: visible;
}

.flow-svg text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  fill: #94a3b8;
}

.flow-svg .box {
  fill: #141820;
  stroke: #1e293b;
  stroke-width: 1;
}

.flow-svg .box.on {
  stroke: #ff4d00;
}

.flow-svg .arrow {
  stroke: #1e293b;
  stroke-width: 1;
  fill: none;
}

.flow-svg .arrow.on {
  stroke: #ff4d00;
}

/* ========== BLUEPRINT ========== */
.phase-block {
  position: relative;
  padding: 24px;
  border: 1px solid #1e293b;
  background: rgba(255, 255, 255, 0.02);
}

.phase-block::before {
  content: attr(data-phase);
  position: absolute;
  top: -9px;
  left: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff4d00;
  background-color: #0b0d11;
  padding: 0 8px;
}

.phase-conn {
  display: flex;
  justify-content: center;
  padding: 6px 0;
  color: #475569;
}

.phase-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid #1e293b;
}

.phase-steps .step {
  padding: 14px 16px;
  border-right: 1px solid #1e293b;
}

.phase-steps .step:last-child {
  border-right: none;
}

.phase-steps .step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: #ff4d00;
  font-weight: 600;
}

.phase-steps .step-txt {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .phase-steps { grid-template-columns: 1fr 1fr; }
  .phase-steps .step { border-bottom: 1px solid #1e293b; }
}

@media (max-width: 480px) {
  .phase-steps { grid-template-columns: 1fr; }
  .phase-steps .step { border-right: none; }
}

/* ========== SPEC TABLE ========== */
.spec-table {
  border: 1px solid #1e293b;
  width: 100%;
}

.spec-table .spec-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid #1e293b;
}

.spec-table .spec-row:last-child {
  border-bottom: none;
}

.spec-table .spec-key {
  padding: 10px 14px;
  border-right: 1px solid #1e293b;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.spec-table .spec-val {
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #f0f2f5;
}

@media (max-width: 600px) {
  .spec-table .spec-row { grid-template-columns: 1fr; }
  .spec-table .spec-key { border-right: none; border-bottom: 1px solid #1e293b; }
}

/* ========== SKILL TAGS ========== */
.tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border: 1px solid #1e293b;
  border-radius: 2px;
  color: #94a3b8;
}

.tag.hit {
  border-color: #ff4d00;
  color: #ff4d00;
  background: rgba(255, 77, 0, 0.1);
}

/* ========== DEMO OUTPUT ========== */
.demo-out {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  color: #94a3b8;
  background-color: #0b0d11;
  border: 1px solid #1e293b;
  padding: 12px;
  border-radius: 2px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ========== SECTIONS ========== */
.section {
  padding: 80px 0;
  position: relative;
  z-index: 1;
}

.divider {
  border: none;
  border-top: 1px solid #1e293b;
  margin: 0;
}

/* ========== FOOTER ========== */
#footer {
  border-top: 1px solid #1e293b;
  padding: 36px 0;
  text-align: center;
}

#footer p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: #475569;
  letter-spacing: 0.05em;
}

/* ========== ANIMATIONS ========== */
.fi {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.fi.vi {
  opacity: 1;
  transform: translateY(0);
}

/* ========== BLINK ANIMATION ========== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ========== ENGINE LAUNCH BUTTON (nav) ========== */
.nav-engine {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid #ff4d00;
  border-radius: 2px;
  color: #ff4d00;
  transition: all 0.15s;
}

.nav-engine:hover {
  background-color: #ff4d00;
  color: #fff;
}

/* ========== BI REPORT TABLE ========== */
.bi-row {
  display: grid;
  grid-template-columns: 160px 1fr 100px;
  border-bottom: 1px solid #1e293b;
}

.bi-row:last-child { border-bottom: none; }

.bi-row .bi-key {
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #ff4d00;
  border-right: 1px solid #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bi-row .bi-text {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #94a3b8;
  border-right: 1px solid #1e293b;
}

.bi-row .bi-sev {
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}

.bi-sev.high { color: #ef4444; }
.bi-sev.med { color: #eab308; }
.bi-sev.low { color: #22c55e; }

/* ========== COMPLEXITY BREAKDOWN ========== */
.cx-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  border: 1px solid #1e293b;
  border-top: none;
}

.cx-row .cx-label {
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #94a3b8;
  border-right: 1px solid #1e293b;
}

.cx-row .cx-val {
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ff4d00;
  text-align: center;
}

/* ========== UTILITY ========== */
.hid { display: none !important; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .wrap { padding-left: 18px; padding-right: 18px; }
  .section { padding: 48px 0; }
  .card { padding: 1.25rem; }
  .title-xl { font-size: 2.2rem; }
  #cmdGrid { grid-template-columns: 1fr !important; }
  .bi-row { grid-template-columns: 1fr; }
  .bi-row .bi-key, .bi-row .bi-text { border-right: none; }
}
