/* ============================================================
   shared.css — chrome shared between index.html and article pages
   Loaded BEFORE each page's inline <style> so per-page tokens
   and overrides cascade naturally.
   Tokens align with the Win11 Fluent light theme used by the
   RunFence app itself: white paper, Win11 accent blue (#0067c0),
   Inter for UI text, Cascadia Code for monospace.
   ============================================================ */

:root {
  --ink: #1a1a1a;
  --ink-deep: #0d0d0d;
  --ink-2: #2b2b2b;
  --paper: #ffffff;
  --paper-2: #fafafa;
  --paper-3: #f5f5f5;
  --bg: #f3f3f3;
  --line: #e5e5e5;
  --line-2: #d6d6d6;
  --line-soft: #ebebeb;
  --muted: #5c5c5c;
  --muted-2: #8a8a8a;
  --accent: #0067c0;
  --accent-deep: #005a9e;
  --accent-bg: #ebf3fb;
  --good: #107c41;
  --good-bg: #ecf6ee;
  --bad: #c42b1c;
  --warn: #c45500;
  --warn-bg: #fff4e6;
  --mid: #c45500;
  --shadow: 0 30px 80px -30px rgba(0,0,0,0.22), 0 8px 20px -8px rgba(0,0,0,0.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06), 0 1px 1px rgba(0,0,0,0.04);
  --max: 1240px;
  --mono: "Cascadia Code", ui-monospace, Consolas, "Segoe UI Mono", SFMono-Regular, Menlo, monospace;
  --sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "ss02", "cv11";
}
a { color: inherit; text-decoration: none; }

.mono { font-family: var(--mono); font-feature-settings: "zero", "ss01"; }

code, kbd {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.1rem 0.36rem;
  background: var(--paper-3);
  border-radius: 6px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.shell { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(243, 243, 243, 0.85);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 14px 0;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 700; letter-spacing: -0.02em; font-size: 18px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--accent);
  color: white;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}
.brand-mark svg { width: 22px; height: 22px; }

.nav { display: flex; align-items: center; gap: 40px; font-size: 14.5px; color: var(--muted); }
.nav-cluster { display: flex; align-items: center; gap: 28px; }
.nav a:hover { color: var(--ink); }

.nav-dropdown { position: relative; }
.nav-dropdown summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover { color: var(--ink); }
.nav-dropdown.is-current summary { color: var(--accent); font-weight: 600; }

.nav-caret {
  width: 10px; height: 10px; opacity: 0.7; transition: transform .16s ease;
}
.nav-dropdown[open] .nav-caret { transform: rotate(180deg); }

.nav-panel {
  position: absolute; right: 0; top: calc(100% + 12px);
  width: min(380px, calc(100vw - 24px));
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.nav-panel-link {
  display: flex; gap: 12px; padding: 12px;
  border-radius: 10px;
  position: relative;
}
.nav-panel-link:hover { background: var(--paper-2); }
.nav-panel-link strong { display: block; font-size: 14px; color: var(--ink); }
.nav-panel-link span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.nav-panel-dot {
  width: 8px; height: 8px; margin-top: 6px; border-radius: 999px;
  background: var(--accent); flex: 0 0 auto;
}
/* current page state inside the dropdown */
.nav-panel-link[aria-current="page"] {
  background: var(--accent-bg);
  outline: 1px solid rgba(0, 103, 192, 0.22);
}
.nav-panel-link[aria-current="page"] strong { color: var(--accent); }
.nav-panel-link[aria-current="page"] .nav-panel-dot {
  box-shadow: 0 0 0 4px rgba(0, 103, 192, 0.18);
}

.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 6px;
  background: var(--accent); color: white !important;
  font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.nav-cta:hover {
  transform: translateY(-1px);
  background: var(--accent-deep);
  box-shadow: 0 10px 24px -10px rgba(0,103,192,.45);
}
.nav-cta, .nav-cta:visited, .nav-cta:active, .nav-cta:focus { color: white !important; }

/* ============ Footer ============ */
.footer { padding: 30px 0 50px; color: var(--muted); font-size: 14px; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.footer-copy { font-family: var(--mono); font-size: 12px; color: var(--muted-2); }
.footer-links { display: flex; flex-wrap: wrap; gap: 22px; font-size: 14px; }
.footer-links a:hover { color: var(--ink); }

@media (max-width: 800px) {
  .nav .nav-cluster.sections { display: none; }
}
@media (max-width: 640px) {
  .shell { width: min(var(--max), calc(100% - 28px)); }
  .nav-panel {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 58px;
    width: auto;
  }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
