/* base.css — tokens, reset, terminal frame, fixed bars, tooltips */
:root {
  --bg-deep: #070a0f;
  --bg-window: #0a0e17;
  --bg-bar: #0d121c;
  --bg-titlebar: #0f1726;
  --bg-card: #0b1019;
  --bg-btn: #101622;
  --color-green: #34d399;
  --color-green-dim: rgba(52, 211, 153, 0.12);
  --color-amber: #f59e0b;
  --color-cyan: #38bdf8;
  --color-red: #f87171;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: 1px solid #1e293b;
  --border-accent: 1px solid #334155;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", Courier, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body.terminal-body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.6;
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-green);
  color: #000;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* The page IS the terminal: titlebar + statusbar fixed, port scrolls */
.terminal-window {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-window);
}

.window-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-titlebar);
  border-bottom: var(--border-subtle);
  font-size: 13px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.term-status-badge {
  color: var(--color-green);
}
.window-title {
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.term-status-online {
  color: var(--color-green);
  animation: blink-soft 3s ease-in-out infinite;
}
@keyframes blink-soft {
  50% {
    opacity: 0.35;
  }
}

.scroll-port {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y proximity;
  scrollbar-width: thin;
  scrollbar-color: #334155 var(--bg-deep);
  mask-image: linear-gradient(
    to bottom,
    transparent,
    black 56px,
    black calc(100% - 56px),
    transparent
  );
}
.scroll-port::-webkit-scrollbar {
  width: 8px;
}
.scroll-port::-webkit-scrollbar-thumb {
  background: #334155;
}
.scroll-port::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

.window-statusbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--bg-titlebar);
  border-top: var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--color-green);
  text-decoration: none;
}
.footer-links a:hover {
  text-decoration: underline;
}

code {
  color: var(--color-cyan);
  font-family: var(--font-mono);
}

/* Tooltips — man-page glosses on openOODA jargon.
   CSS-only: hover + focus (tabindex=0 covers touch/keyboard). */
.t {
  color: var(--color-cyan);
  border-bottom: 1px dotted var(--color-cyan);
  cursor: help;
  position: relative;
  outline-offset: 2px;
}
.t::after {
  content: "> " attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: max-content;
  max-width: min(300px, 78vw);
  padding: 10px 12px;
  background: var(--bg-titlebar);
  border: 1px solid var(--color-green);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: normal;
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.t::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 12px;
  z-index: 51;
  border: 4px solid transparent;
  border-top-color: var(--color-green);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.t:hover::after,
.t:focus::after {
  opacity: 1;
  transform: translateY(0);
}
.t:hover::before,
.t:focus::before {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-port {
    scroll-snap-type: none;
  }
}
