/* App Ops Desk — shared design system */
:root {
  --bg: #090d16;
  --surface: #0f1623;
  --card: #131b2b;
  --card-hover: #182236;
  --text: #f4f7ff;
  --text-secondary: #a6b3c9;
  --muted: #7b8aa6;
  --line: #1f2b42;
  --line-strong: #2f3e5e;
  --accent: #7eb8ff;
  --accent-soft: rgba(126, 184, 255, 0.12);
  --accent-glow: rgba(126, 184, 255, 0.22);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* IMPORTANT: Force the same dark visual system on every device. */
body {
  background-color: var(--bg) !important;
  color: var(--text) !important;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 90% -10%, rgba(126, 184, 255, 0.10), transparent 55%),
    radial-gradient(900px 500px at 10% -5%, rgba(74, 222, 128, 0.06), transparent 50%),
    var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 32px 20px 100px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 40px 20px 100px; }
a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: #a8d0ff; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
h2, h3 { scroll-margin-top: 24px; }
::selection { background: var(--accent); color: #050e1c; }
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 300;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #050e1c;
  font-weight: 800;
}
.skip-link:focus { top: 16px; }

/* Nav */
.nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0 40px;
  gap: 16px;
}
.nav .brand {
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em;
  color: var(--text); display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto;
}
.nav .brand::before {
  content: "◈";
  color: var(--accent); font-size: 18px;
}
.nav .links {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  font-size: 14px; font-weight: 600;
  justify-content: flex-end;
}
.nav .links a { color: var(--text-secondary); }
.nav .links a:hover { color: var(--accent); }

.nav-mobile-toggle { display: none; }

/* Typography */
h1 { font-size: clamp(1.85rem, 7vw, 3.4rem); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 18px; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.25rem, 4.2vw, 1.85rem); line-height: 1.18; letter-spacing: -0.02em; margin: 0 0 14px; overflow-wrap: anywhere; }
h3 { font-size: 1.12rem; margin: 0 0 8px; font-weight: 700; }
.lede { font-size: clamp(1rem, 3.4vw, 1.15rem); color: var(--text-secondary); max-width: 38rem; margin-bottom: 28px; }
.lede-sm { font-size: 1.05rem; color: var(--text-secondary); margin-bottom: 22px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-hover { transition: background 0.2s, border-color 0.2s, transform 0.2s; }
.card-hover:hover { background: var(--card-hover); border-color: var(--line-strong); transform: translateY(-2px); }
.section { margin-top: 42px; }

/* Issue series nav */
.issue-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 28px 0 8px;
}
.issue-nav a {
  flex: 1 1 220px;
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}
.issue-nav a:hover {
  border-color: var(--line-strong);
  color: var(--accent);
  background: var(--card-hover);
}
.issue-nav .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}
.archive-item {
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.archive-item a { font-weight: 700; color: var(--text); }
.archive-item a:hover { color: var(--accent); }
.archive-item .fine { display: block; margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #93c6ff 0%, #66a3f5 100%);
  color: #050e1c; border: 0; border-radius: var(--radius-md);
  padding: 13px 20px; font: inherit; font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: filter 0.15s, transform 0.15s;
  min-height: 44px;
}
.btn:hover { filter: brightness(1.08); color: #050e1c; transform: translateY(-1px); }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.btn-row > .btn { margin-left: 0 !important; margin-right: 0 !important; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 16px 0 7px; }
input, select, textarea {
  width: 100%; border-radius: var(--radius-md); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); padding: 13px 14px; font: inherit; font-size: 16px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 48px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Tags / pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 700;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em;
}
.pill-accent { background: var(--accent-soft); border-color: var(--accent-glow); color: var(--accent); }
.price-pill {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; color: var(--text-secondary); margin-bottom: 14px;
}
.price-pill strong { color: var(--text); font-size: 16px; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1.25fr 0.85fr; gap: 22px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }

/* Issue / content styling */
.eyebrow { display: inline-flex; gap: 8px; align-items: center; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.callout { border-left: 3px solid var(--accent); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 14px 18px; margin: 18px 0; }
.callout-warn { border-left-color: var(--warning); background: rgba(251, 191, 36, 0.06); }
.callout-good { border-left-color: var(--success); background: rgba(74, 222, 128, 0.06); }
.callout-bad { border-left-color: var(--danger); background: rgba(248, 113, 113, 0.06); }
pre {
  background: #070c18; border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  font-size: 12.5px; line-height: 1.55; color: #c8d5f2;
  max-width: 100%;
}
code, .path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em; background: #070c18; border: 1px solid var(--line);
  border-radius: 6px; padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}
ul.clean, ol.clean { margin: 0; padding-left: 20px; }
ul.checklist, ol.checklist { margin: 0; padding-left: 1.2rem; }
li { margin: 9px 0; }
img, svg, video { max-width: 100%; height: auto; }

/* Footer */
.site-footer {
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between;
}
.site-footer a { word-break: break-word; }

/* Status message */
#status { min-height: 1.3em; margin-top: 12px; font-size: 14px; color: var(--success); }
#status.err { color: var(--danger); }

/* Utility */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.card-hover:hover { transform: translateY(-3px); background: var(--card-hover); border-color: var(--line-strong); }
.copy-btn {
  float: right;
  margin: 0 0 8px 8px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  cursor: pointer;
}
.copy-btn:hover { background: var(--card-hover); color: var(--text); }
.anchor-link {
  margin-left: 8px;
  font-size: 0.75em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}
h2:hover .anchor-link, h3:hover .anchor-link { opacity: 1; }
#top { position: fixed; bottom: 20px; right: 20px; z-index: 50; display: none; }
#top.visible { display: inline-flex; }

/* ========== Mobile / narrow screens ========== */
@media (max-width: 840px) {
  .wrap, .wrap-narrow { padding: 24px 16px 80px; }
  .nav {
    padding: 10px 0 28px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .nav .brand { font-size: 16px; }
  .nav .links {
    flex-wrap: wrap;
    gap: 6px 12px;
    justify-content: flex-start;
  }
  .nav .links a {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-secondary);
    white-space: nowrap;
  }
  .nav .links a:hover { color: var(--accent); border-color: var(--line-strong); }
  .card { padding: 20px; border-radius: var(--radius-lg); }
  .section { margin-top: 36px; }
  .issue-nav a { flex: 1 1 220px; }
  .btn-row { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .btn-row > .btn { width: auto; }
  p.mt-3 > .btn,
  p > .btn.btn-ghost[style*="margin-left"],
  p > a.btn[style*="margin-left"] {
    display: inline-flex;
    width: auto;
    margin-left: 10px !important;
    margin-top: 0;
  }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .site-footer { flex-direction: column; gap: 10px; }
  .price-pill { flex-wrap: wrap; }
}

@media (max-width: 400px) {
  .grid-3 { grid-template-columns: 1fr; }
  .issue-nav a { flex: 1 1 100%; }
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row > .btn { width: 100%; }
  p.mt-3 > .btn,
  p > .btn.btn-ghost[style*="margin-left"],
  p > a.btn[style*="margin-left"] {
    display: flex;
    width: 100%;
    margin-left: 0 !important;
    margin-top: 10px;
  }
  p.mt-3 > .btn:first-child,
  p > .btn:first-child { margin-top: 0; }
}

@media (max-width: 480px) {
  h1 { font-size: clamp(1.7rem, 9vw, 2.2rem); }
  .lede { font-size: 1rem; }
  pre { font-size: 12px; padding: 12px; }
  .archive-item { padding: 12px 14px; }
}

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  width: 0%;
  z-index: 100;
  transition: width 0.1s linear;
}
.search-wrap { margin: 18px 0; }
.search-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}
.search-results { margin-top: 12px; }
.search-results a { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.share-row a { font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.read-time { font-size: 13px; color: var(--muted); }
.related-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 14px; }

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-hover, .btn { transition: none; }
  .card-hover:hover, .btn:hover { transform: none; }
}

@media print {
  body { background: #fff; color: #000; }
  .nav, .site-footer, .btn-row, .pill { display: none !important; }
  .card { border: 1px solid #ccc; background: #fff; box-shadow: none; }
  a { color: #000; text-decoration: none; }
  h1, h2, h3 { page-break-after: avoid; }
  .checklist li { break-inside: avoid; }
  .wrap, .wrap-narrow { max-width: 100%; padding: 0; }
}

/* Safe areas (notched phones) */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .wrap, .wrap-narrow {
    padding-bottom: max(72px, env(safe-area-inset-bottom) + 48px);
  }
}
