/* ===========================================================================
   CrashTactics.com — shared theme
   Palette: magenta (#db2777) + deep aubergine dark. Rising-curve motif.
   Fonts: "Space Grotesk" headings / "Inter" body.
   =========================================================================== */

:root {
  --magenta: #db2777;
  --magenta-bright: #f0479a;
  --magenta-soft: #f9a8d4;
  --ink-900: #0b0410;
  --ink-850: #12071b;
  --ink-800: #1a0a26;
  --ink-700: #241031;
  --ink-600: #34173f;
  --line: #3a1c47;
  --text: #f4ecf3;
  --text-dim: #c7b6c9;
  --text-faint: #94839a;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --shadow: 0 18px 50px -20px rgba(0,0,0,.8);
  --font-head: "Space Grotesk", "Segoe UI", Verdana, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 78% -8%, rgba(219,39,119,.20), transparent 60%),
    radial-gradient(900px 500px at -10% 12%, rgba(150,30,90,.16), transparent 55%),
    var(--ink-900);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--magenta-soft); text-decoration: none; }
a:hover { color: #fff; text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.45rem, 3.2vw, 2rem); margin: 2.2em 0 .55em; }
h3 { font-size: 1.22rem; margin: 1.7em 0 .4em; }
p { margin: 0 0 1.05em; }
strong { color: #fff; }
small { color: var(--text-faint); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }

/* ---- Skip link ---- */
.skip { position: absolute; left: -999px; top: 0; background: var(--magenta); color: #fff; padding: 10px 16px; z-index: 200; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,4,16,.86);
  backdrop-filter: blur(11px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 22px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-head); font-weight: 700; font-size: 1.16rem; color: #fff; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; display: block; }
.brand b { color: var(--magenta-bright); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--text-dim); padding: 8px 12px; border-radius: 8px; font-size: .93rem; font-weight: 500; }
.nav a:hover { color: #fff; background: var(--ink-700); text-decoration: none; }
.nav a[aria-current="page"] { color: #fff; background: var(--ink-700); }
.navtoggle { display: none; margin-left: auto; background: var(--ink-700); border: 1px solid var(--line); color: #fff; border-radius: 8px; padding: 8px 12px; font-size: 1rem; cursor: pointer; }

@media (max-width: 860px) {
  .navtoggle { display: block; }
  .nav { display: none; flex-direction: column; width: 100%; order: 3; gap: 2px; padding-bottom: 12px; }
  .nav.open { display: flex; }
  .nav a { padding: 11px 12px; }
}

/* ---- Hero ---- */
.hero { position: relative; overflow: hidden; padding: 64px 0 30px; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(219,39,119,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(219,39,119,.06) 1px, transparent 1px);
  background-size: 42px 42px;
  -webkit-mask-image: radial-gradient(700px 380px at 70% 0%, #000, transparent 75%);
  mask-image: radial-gradient(700px 380px at 70% 0%, #000, transparent 75%);
}
.hero .eyebrow { color: var(--magenta-soft); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-size: .8rem; margin-bottom: 14px; }
.hero p.lead { font-size: 1.18rem; color: var(--text-dim); max-width: 720px; }
.curve-deco { position: absolute; right: -40px; top: 20px; width: 460px; max-width: 50%; opacity: .8; z-index: -1; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: linear-gradient(135deg, var(--magenta), var(--magenta-bright));
  color: #fff; border: none; padding: 13px 22px; border-radius: 11px;
  font-weight: 600; font-size: 1rem; font-family: var(--font-body);
  box-shadow: 0 10px 26px -10px rgba(219,39,119,.8);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; color: #fff; box-shadow: 0 14px 32px -10px rgba(219,39,119,.9); }
.btn.ghost { background: transparent; border: 1px solid var(--line); box-shadow: none; color: var(--text); }
.btn.ghost:hover { border-color: var(--magenta); background: var(--ink-700); }
.btn.sm { padding: 9px 15px; font-size: .9rem; }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }

/* ---- Cards / panels ---- */
.panel {
  background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ---- Section heading ---- */
.section { padding: 30px 0; }
.section-tag { display: inline-block; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--magenta-soft); font-weight: 700; margin-bottom: 6px; }

/* ---- Operator ranking cards ---- */
.oplist { display: grid; gap: 16px; }
.opcard {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 18px; align-items: center;
  background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  transition: border-color .15s ease, transform .15s ease;
}
.opcard:hover { border-color: var(--magenta); transform: translateY(-2px); }
.opcard .rank { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; color: var(--magenta-bright); text-align: center; }
.opcard h3 { margin: 0 0 4px; font-size: 1.25rem; }
.opcard .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .9rem; color: var(--text-dim); margin-top: 6px; }
.opcard .meta b { color: var(--text); font-weight: 600; }
.opcard .score { text-align: center; }
.opcard .score .num { font-family: var(--font-head); font-size: 1.8rem; font-weight: 700; color: #fff; line-height: 1; }
.opcard .score small { display: block; color: var(--text-faint); font-size: .72rem; }
.opcard .cta { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 130px; }
@media (max-width: 720px) {
  .opcard { grid-template-columns: 44px 1fr; }
  .opcard .cta { grid-column: 1 / -1; flex-direction: row; }
  .opcard .score { display: none; }
}

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .03em; vertical-align: middle; }
.badge.good { background: rgba(52,211,153,.16); color: var(--good); border: 1px solid rgba(52,211,153,.3); }
.badge.warn { background: rgba(251,191,36,.14); color: var(--warn); border: 1px solid rgba(251,191,36,.3); }
.badge.bad  { background: rgba(251,113,133,.14); color: var(--bad); border: 1px solid rgba(251,113,133,.3); }
.badge.neutral { background: var(--ink-700); color: var(--text-dim); border: 1px solid var(--line); }

/* ---- Tables ---- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; min-width: 560px; }
caption { text-align: left; padding: 14px 16px 0; color: var(--text-faint); font-size: .85rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
thead th { background: var(--ink-700); color: #fff; font-family: var(--font-head); font-weight: 600; font-size: .85rem; letter-spacing: .02em; cursor: default; position: sticky; top: 0; }
table.sortable thead th { cursor: pointer; user-select: none; }
table.sortable thead th:hover { color: var(--magenta-soft); }
table.sortable thead th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; color: var(--magenta-soft); }
table.sortable thead th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; color: var(--magenta-soft); }
tbody tr:hover { background: rgba(219,39,119,.05); }
tbody tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
.edge-1 { color: var(--good); font-weight: 700; }
.edge-2 { color: #a7e8c4; font-weight: 600; }
.edge-3 { color: var(--warn); font-weight: 600; }
.edge-5 { color: var(--bad); font-weight: 700; }

/* ---- Prose ---- */
.prose { font-size: 1.05rem; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.prose li { margin-bottom: .5em; }
.prose h2 { border-top: 1px solid var(--line); padding-top: 1.1em; }
.prose h2:first-of-type { border-top: none; padding-top: 0; }
.prose blockquote { margin: 1.4em 0; padding: 4px 20px; border-left: 3px solid var(--magenta); color: var(--text-dim); font-style: italic; }
.prose code { background: var(--ink-700); padding: 2px 7px; border-radius: 6px; font-size: .9em; color: var(--magenta-soft); font-family: "SFMono-Regular", Consolas, monospace; }
.prose .formula { display: block; background: var(--ink-850); border: 1px solid var(--line); border-left: 3px solid var(--magenta); border-radius: var(--radius-sm); padding: 16px 18px; margin: 1.3em 0; font-family: "SFMono-Regular", Consolas, monospace; font-size: .95rem; color: var(--magenta-soft); overflow-x: auto; }

/* ---- Callouts ---- */
.callout { border-radius: var(--radius-sm); padding: 16px 18px; margin: 1.4em 0; border: 1px solid var(--line); background: var(--ink-800); }
.callout .h { font-family: var(--font-head); font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout.danger { border-color: rgba(251,113,133,.45); background: rgba(251,113,133,.08); }
.callout.danger .h { color: var(--bad); }
.callout.tip { border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.07); }
.callout.tip .h { color: var(--good); }
.callout.info { border-color: rgba(240,71,154,.4); background: rgba(219,39,119,.08); }
.callout.info .h { color: var(--magenta-soft); }
.callout.rg { border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.07); }
.callout.rg .h { color: var(--warn); }

/* ---- Pros / Cons ---- */
.procon { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 1.4em 0; }
@media (max-width: 600px) { .procon { grid-template-columns: 1fr; } }
.procon .col { border-radius: var(--radius-sm); padding: 16px 18px; border: 1px solid var(--line); }
.procon .pros { background: rgba(52,211,153,.06); border-color: rgba(52,211,153,.3); }
.procon .cons { background: rgba(251,113,133,.06); border-color: rgba(251,113,133,.3); }
.procon h4 { margin: 0 0 8px; }
.procon ul { list-style: none; padding: 0; margin: 0; }
.procon li { padding-left: 24px; position: relative; margin-bottom: 8px; font-size: .96rem; }
.procon .pros li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }
.procon .cons li::before { content: "✕"; position: absolute; left: 0; color: var(--bad); font-weight: 700; }

/* ---- Rating ---- */
.ratingbox { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; background: var(--ink-850); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin: 1.4em 0; }
.ratingbox .big { font-family: var(--font-head); font-size: 3rem; font-weight: 700; color: var(--magenta-bright); line-height: 1; }
.ratingbox .big small { font-size: 1.1rem; color: var(--text-faint); }
.stars { color: var(--magenta-soft); font-size: 1.3rem; letter-spacing: 2px; }
.scorebars { flex: 1; min-width: 240px; display: grid; gap: 7px; }
.scorebars .row { display: grid; grid-template-columns: 130px 1fr 42px; gap: 10px; align-items: center; font-size: .85rem; color: var(--text-dim); }
.scorebars .bar { height: 8px; background: var(--ink-700); border-radius: 999px; overflow: hidden; }
.scorebars .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--magenta), var(--magenta-bright)); border-radius: 999px; }

/* ---- Quick facts box ---- */
.factbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 1.4em 0; }
.factbox .cell { background: var(--ink-850); padding: 14px 16px; }
.factbox .cell .k { font-size: .73rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.factbox .cell .v { font-weight: 600; margin-top: 3px; color: #fff; }

/* ---- TOOL: simulator ---- */
.tool { background: linear-gradient(180deg, var(--ink-800), var(--ink-850)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tool .tabbar { display: flex; border-bottom: 1px solid var(--line); background: var(--ink-850); }
.tool .tabbar button { flex: 1; background: none; border: none; color: var(--text-dim); padding: 15px 14px; font-family: var(--font-head); font-weight: 600; font-size: 1rem; cursor: pointer; border-bottom: 3px solid transparent; }
.tool .tabbar button[aria-selected="true"] { color: #fff; border-bottom-color: var(--magenta); background: rgba(219,39,119,.07); }
.tool .pane { padding: 24px; }
.tool .pane[hidden] { display: none; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.field label { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: 5px; font-weight: 500; }
.field input, .field select {
  width: 100%; background: var(--ink-900); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: .98rem; font-family: var(--font-body);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(219,39,119,.2); }

.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin: 20px 0; }
.readout { background: var(--ink-900); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.readout .k { font-size: .73rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); }
.readout .v { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; color: #fff; line-height: 1.1; margin-top: 4px; }
.readout .v.hl { color: var(--magenta-bright); }
.readout .v.good { color: var(--good); }
.readout .v.bad { color: var(--bad); }
.readout .v.warn { color: var(--warn); }

.chartbox { background: var(--ink-900); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-top: 8px; }
canvas { display: block; width: 100%; height: auto; }

.sim-note { font-size: .85rem; color: var(--text-faint); margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; }

/* ---- Breadcrumb ---- */
.crumbs { font-size: .85rem; color: var(--text-faint); padding: 18px 0 0; }
.crumbs a { color: var(--text-dim); }
.crumbs span { margin: 0 7px; }

/* ---- Cards list of links ---- */
.linkcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 16px; }
.linkcard { display: block; background: linear-gradient(180deg, var(--ink-800), var(--ink-850)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; transition: border-color .15s ease, transform .15s ease; }
.linkcard:hover { border-color: var(--magenta); transform: translateY(-3px); text-decoration: none; }
.linkcard h3 { margin: 0 0 6px; color: #fff; }
.linkcard p { margin: 0; color: var(--text-dim); font-size: .92rem; }
.linkcard .tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--magenta-soft); font-weight: 700; }

/* ---- FAQ ---- */
.faq details { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--ink-850); overflow: hidden; }
.faq summary { cursor: pointer; padding: 16px 20px; font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; color: #fff; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--magenta-bright); font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .answer { padding: 16px 20px; color: var(--text-dim); }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---- RG strip ---- */
.rgstrip { background: var(--ink-850); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rgstrip .wrap { display: flex; align-items: center; gap: 16px; padding: 14px 20px; flex-wrap: wrap; font-size: .9rem; color: var(--text-dim); }
.rgstrip .pill { background: var(--magenta); color: #fff; font-weight: 700; border-radius: 999px; padding: 4px 12px; font-size: .8rem; }

/* ---- Author byline ---- */
.byline { display: flex; align-items: center; gap: 14px; margin: 18px 0 28px; padding: 16px; background: var(--ink-850); border: 1px solid var(--line); border-radius: var(--radius); }
.byline .av { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--magenta), var(--magenta-bright)); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; color: #fff; font-size: 1.1rem; flex-shrink: 0; }
.byline .who { font-size: .9rem; color: var(--text-dim); }
.byline .who b { color: #fff; display: block; font-size: 1rem; }

/* ---- Footer ---- */
footer.site { border-top: 1px solid var(--line); margin-top: 60px; background: var(--ink-850); padding: 44px 0 30px; }
footer.site .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
@media (max-width: 800px) { footer.site .cols { grid-template-columns: 1fr 1fr; } }
footer.site h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin: 0 0 12px; }
footer.site ul { list-style: none; padding: 0; margin: 0; }
footer.site li { margin-bottom: 8px; }
footer.site a { color: var(--text-dim); font-size: .92rem; }
footer.site a:hover { color: #fff; }
footer.site .legal { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--text-faint); }
footer.site .legal p { margin: 0 0 8px; }
.foot-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: #fff; margin-bottom: 10px; }
.foot-brand .mark { width: 28px; height: 28px; }

/* ---- Utility ---- */
.muted { color: var(--text-faint); }
.center { text-align: center; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
hr.div { border: none; border-top: 1px solid var(--line); margin: 2.4em 0; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.pill-tag { font-size: .8rem; background: var(--ink-700); border: 1px solid var(--line); color: var(--text-dim); padding: 4px 11px; border-radius: 999px; }
.toc { background: var(--ink-850); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 28px; }
.toc strong { display: block; margin-bottom: 8px; font-family: var(--font-head); }
.toc ul { margin: 0; padding-left: 1.1em; columns: 2; }
@media (max-width: 600px) { .toc ul { columns: 1; } }
.toc li { margin-bottom: 5px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .btn:hover, .opcard:hover, .linkcard:hover { transform: none; }
}

/* ---------- Mobile-only additions (≤ 480px) ---------- */
/* Prevent any child from causing horizontal scroll */
body { overflow-x: hidden; overflow-wrap: anywhere; }

@media (max-width: 480px) {
  /* Heading floor (h1 already uses clamp(); give it a hard minimum) */
  h1 { font-size: 1.7rem !important; }
  h2 { font-size: 1.3rem; }

  /* Operator card: drop score column, stack CTA full width */
  .opcard { grid-template-columns: 40px 1fr; gap: 10px; padding: 14px; }
  .opcard .score { display: none; }
  .opcard .cta { grid-column: 1 / -1; flex-direction: row; min-width: 0; }
  .opcard .cta .btn { flex: 1; justify-content: center; font-size: .88rem; padding: 10px 12px; }

  /* Scorebars: 130px label column causes overflow on 390px; collapse to 2-col */
  .scorebars .row { grid-template-columns: auto 1fr 38px; }

  /* Rating box: stack on tiny screens */
  .ratingbox { flex-direction: column; }
  .scorebars { min-width: 0; width: 100%; }

  /* Fact box already uses auto-fit minmax(150px) — safe, but reduce min */
  .factbox { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

  /* Readouts: 2 columns minimum on 390px */
  .readouts { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

  /* Controls in tool: single column */
  .controls { grid-template-columns: 1fr; }

  /* Footer: already collapses at 800px to 2-col; force 1-col at 480px */
  footer.site .cols { grid-template-columns: 1fr; }

  /* Btn-row: wrap gracefully */
  .btn-row { gap: 10px; }
  .btn-row .btn { flex: 1 1 auto; justify-content: center; }
}
