/* ============================================================
   MI6.TF — Switchboard
   A dark, fast utility UI. Tool, not experience.
   ============================================================ */

/* Using system mono — matches the original Terminal-Noir feel, no web fonts */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:           #0B0D0E;
  --bg-lift:      #14171A;
  --bg-elevated:  #1B1F23;
  --bg-input:     #0F1214;

  /* Lines */
  --line:         #22262B;
  --line-strong:  #2E3338;
  --line-focus:   #3A4048;

  /* Text */
  --fg:           #F4F5F7;
  --fg-mute:      #A8ADB4;
  --fg-dim:       #6A6F77;
  --fg-faint:     #4A4F56;

  /* Brand accent — one shade */
  --accent:       #7CFFB2;
  --accent-dim:   #4FD48A;
  --accent-wash:  rgba(124, 255, 178, 0.08);
  --accent-ring:  rgba(124, 255, 178, 0.22);
  --on-accent:    #07120C;

  /* Signal colors */
  --warn:         #FFB866;
  --warn-wash:    rgba(255, 184, 102, 0.10);
  --danger:       #FF7A59;
  --danger-wash:  rgba(255, 122, 89, 0.10);
  --info:         #8AB4FF;

  /* Type — canonical mono stack, matches the original design */
  --font-display: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  --font-body:    'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  --font-mono:    'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  /* Geometry */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadow — used sparingly */
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 60px -20px rgba(0, 0, 0, 0.75);

  /* Compat aliases — so legacy selectors don't go haywire */
  --color-primary:        var(--accent);
  --color-primary-dark:   var(--accent-dim);
  --color-primary-hover:  var(--accent);
  --color-secondary:      var(--info);
  --color-accent-blue:    var(--info);
  --color-danger:         var(--danger);
  --color-danger-dark:    var(--danger);
  --color-warning:        var(--warn);
  --color-bg:             var(--bg);
  --color-surface:        var(--bg-lift);
  --color-surface-alt:    var(--bg-elevated);
  --color-border:         var(--line);
  --color-border-subtle:  var(--line);
  --color-text:           var(--fg);
  --color-text-muted:     var(--fg-mute);
  --color-text-dim:       var(--fg-dim);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
  position: relative;
}

/* Atmospheric wash — very subtle, green-biased, off-center */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 0%, rgba(124, 255, 178, 0.045), transparent 60%),
    radial-gradient(ellipse 50% 45% at 10% 100%, rgba(138, 180, 255, 0.030), transparent 60%);
}

/* ── Selection ─────────────────────────────────────────── */
::selection {
  background: var(--accent);
  color: var(--on-accent);
}

::-moz-selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* ── Scrollbar ─────────────────────────────────────────── */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 2px solid var(--bg);
  border-radius: 10px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--fg-faint); }

/* ── Skip link ─────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 12px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: top 0.18s ease;
}
.skip-link:focus { top: 12px; }

/* ── Links ─────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--fg); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Buttons (primary) ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 13px 20px;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 0 0 1px rgba(124, 255, 178, 0.15),
    0 6px 16px -6px rgba(124, 255, 178, 0.35);
}

.btn:hover:not(:disabled) {
  background: #96FFC4;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 3px rgba(124, 255, 178, 0.2),
    0 8px 20px -6px rgba(124, 255, 178, 0.45);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 0 1px rgba(124, 255, 178, 0.2);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--bg-elevated);
  color: var(--fg-dim);
  border-color: var(--line);
  box-shadow: none;
}

/* Ghost / secondary button */
.btn-small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  padding: 7px 12px;
  background: var(--bg-elevated);
  color: var(--fg-mute);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.08s ease;
  margin-right: 6px;
}

.btn-small:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: #252A30;
}

.btn-small:active {
  transform: translateY(1px);
}

.btn-small:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Shared card primitive (legacy pages) ──────────────── */
.card {
  background: var(--bg-lift);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
