/* Delta Starlink Cost — mobile-first, dark aviation */
:root {
  --bg: #0b0d10;
  --bg-elevated: #15181d;
  --bg-card: #111418;
  --border: rgba(226, 232, 240, 0.16);
  --text: #f1f3f5;
  --text-muted: #a7adb7;
  --accent: #d7dce3;
  --accent-dim: rgba(215, 220, 227, 0.1);
  --warn: #f0a83a;
  --green: #52c878;
  --danger: #ff6b6b;
  --delta-red: #ff596b;
  --cost: #ff596b;
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --max: 720px;
}

html[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --border: rgba(15, 23, 42, 0.14);
  --text: #15181d;
  --text-muted: #5f6875;
  --accent: #20252d;
  --accent-dim: rgba(32, 37, 45, 0.08);
  --cost: #c1122f;
  --delta-red: #c1122f;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, 0.04), transparent 55%),
    radial-gradient(800px 400px at 100% 20%, rgba(255, 89, 107, 0.06), transparent 50%),
    var(--bg);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--text);
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* Costs stay red; other figures use bold text color. */
.cost-value {
  color: var(--cost) !important;
  font-variant-numeric: tabular-nums;
}

/* Header */
.site-header {
  padding: 1rem 0 0.65rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #252a31, #101216);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
  color: var(--delta-red);
}

html[data-theme="light"] .brand-mark {
  background: linear-gradient(145deg, #ffffff, #f0f2f5);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.brand-name {
  font-weight: 650;
  letter-spacing: 0.02em;
  font-size: 1rem;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.68rem;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: 600 0.72rem var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

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

/* Counter-first hero */
.counter-hero {
  padding: 1.35rem 0 0.75rem;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(82, 200, 120, 0.1);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(82, 200, 120, 0.6);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(82, 200, 120, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(82, 200, 120, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(82, 200, 120, 0);
  }
}

.counter-card {
  background: linear-gradient(180deg, var(--bg-card), var(--bg));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.25rem 1rem 1.1rem;
  position: relative;
  /* Avoid overflow:hidden — Safari iOS can clip later siblings (emissions) unpredictably */
  overflow: visible;
}

.counter-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 89, 107, 0.45), transparent);
}

.counter-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.counter-total {
  font-family: var(--font-mono);
  font-size: clamp(2.1rem, 9.2vw, 3.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--cost);
  text-shadow:
    0 0 18px rgba(255, 42, 60, 0.55),
    0 0 40px rgba(255, 42, 60, 0.25);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  scrollbar-width: none;
}

html[data-theme="light"] .counter-total {
  text-shadow: 0 0 18px rgba(193, 18, 47, 0.2);
}

.counter-estimate-tag {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--warn);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.counter-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-top: 0.95rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.counter-meta strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 550;
}

.rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.rate-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.55rem;
  text-align: center;
}

.rate-pill span {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.rate-pill strong {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 3.4vw, 1.05rem);
  font-weight: 550;
  color: var(--cost);
}

/* Secondary emissions counter — quieter than $ */
.emissions-row {
  margin-top: 0.85rem;
  padding: 0.75rem 0.8rem 0.7rem;
  border: 1px solid rgba(226, 232, 240, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
  min-height: 4.5rem;
  display: block;
  visibility: visible;
  opacity: 1;
  position: relative;
  z-index: 1;
}

html[data-theme="light"] .emissions-row {
  background: rgba(15, 23, 42, 0.045);
  border-color: rgba(15, 23, 42, 0.18);
}

.emissions-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.emissions-total {
  font-family: var(--font-mono);
  font-size: clamp(1.15rem, 4.2vw, 1.45rem);
  font-weight: 550;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  opacity: 1;
  line-height: 1.2;
}

.emissions-rates {
  margin-top: 0.3rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.emissions-hint {
  opacity: 0.85;
}

/* Scenario picker */
.scenario-picker {
  margin: 1rem 0 1.1rem;
  padding: 0.85rem 0.9rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.scenario-picker-label {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--text);
}

.scenario-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  max-width: 28rem;
  padding: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.scenario-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex: 1 1 auto;
  text-align: center;
}

.scenario-btn:hover {
  color: var(--text);
}

.scenario-btn.is-active,
.scenario-btn[aria-checked="true"] {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(215, 220, 227, 0.35);
}

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

.scenario-custom-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warn);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(240, 168, 58, 0.12);
  white-space: nowrap;
}

.scenario-note {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Advanced tune panel */
.tune-panel {
  margin-top: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Safari iOS: overflow:hidden on <details> can hide/zero-height the open panel */
  overflow: visible;
}

.tune-panel:not([open]) {
  overflow: hidden;
}

.tune-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  min-height: 48px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tune-summary::-webkit-details-marker {
  display: none;
}

.tune-summary .chevron {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.tune-panel[open] .tune-summary .chevron {
  transform: rotate(180deg);
}

.tune-summary:hover {
  background: rgba(255, 255, 255, 0.02);
}

.tune-body {
  padding: 0 1.1rem 1.15rem;
  border-top: 1px solid var(--border);
}

.tune-lede {
  margin: 0.85rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.slider-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.slider-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.slider-controls input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--delta-red);
  touch-action: none;
}

.slider-controls input[type="range"]:focus {
  outline: none;
}

.slider-controls input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* WebKit / Safari iOS — without these, dark-mode tracks are often invisible */
.slider-controls input[type="range"]::-webkit-slider-runnable-track {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.22);
  border: 1px solid rgba(226, 232, 240, 0.18);
}

html[data-theme="light"] .slider-controls input[type="range"]::-webkit-slider-runnable-track {
  background: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.16);
}

.slider-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px; /* (22 - 8) / -2 → center on 8px track */
  border-radius: 50%;
  background: var(--delta-red);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

html[data-theme="light"] .slider-controls input[type="range"]::-webkit-slider-thumb {
  border-color: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
}

/* Firefox */
.slider-controls input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.22);
  border: 1px solid rgba(226, 232, 240, 0.18);
}

html[data-theme="light"] .slider-controls input[type="range"]::-moz-range-track {
  background: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.16);
}

.slider-controls input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--delta-red);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--text);
  min-width: 4.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Intro (below counter) */
.intro {
  padding-top: 0.5rem;
  text-align: center;
}

.intro h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.3rem, 4.4vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hero-lead {
  margin: 0 auto;
  max-width: 36rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero-lead strong {
  color: var(--text);
  font-weight: 650;
}

/* Chips / sections */
.section {
  padding: 1.35rem 0;
}

.section-title {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

.section-lede {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.section-lede strong {
  color: var(--text);
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: calc(50% - 0.25rem);
  flex: 1 1 auto;
}

.chip-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.chip-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  color: var(--text);
}

.chip-value strong {
  color: var(--text);
  font-weight: 650;
}

.chip-badge {
  font-family: var(--font-sans);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.chip-badge--assumed {
  background: rgba(240, 180, 41, 0.15);
  color: var(--warn);
}

.chip-badge--known {
  background: rgba(82, 200, 120, 0.14);
  color: var(--green);
}

/* Accordion / cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.accordion-btn:hover {
  background: rgba(255, 255, 255, 0.02);
}

.accordion-btn .chevron {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.2s ease;
  color: var(--text-muted);
  flex-shrink: 0;
}

.accordion-btn[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.accordion-panel {
  padding: 0 1.1rem 1.15rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.92rem;
}

.accordion-panel[hidden] {
  display: none;
}

.formula {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.calc-list {
  padding-left: 1.15rem;
  margin: 0.75rem 0;
}

.calc-list li {
  margin-bottom: 0.45rem;
}

.calc-list strong {
  color: var(--text);
  font-weight: 650;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Narrative */
.narrative-card {
  padding: 1.15rem 1.1rem 1.25rem;
}

.narrative h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.narrative h2 strong {
  color: var(--text);
  font-weight: 650;
}

.narrative p {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
}

.narrative p strong {
  color: var(--text);
  font-weight: 650;
}

.narrative p:last-child {
  margin-bottom: 0;
}

.callout {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 0 10px 10px 0;
  font-size: 0.9rem;
  color: var(--text);
}

.callout strong {
  font-weight: 650;
}

/* Footer */
.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer p {
  margin: 0.35rem 0;
}

.disclaimer {
  max-width: 34rem;
  margin-inline: auto;
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0.9;
}

/* Desktop tweaks */
@media (min-width: 640px) {
  .chip {
    min-width: auto;
  }

  .counter-card {
    padding: 1.65rem 1.75rem 1.35rem;
  }

  .rates {
    gap: 0.85rem;
  }

  .scenario-picker {
    padding-inline: 1rem;
  }

  .scenario-toggle {
    max-width: 26rem;
  }

  .slider-controls {
    grid-template-columns: 1fr 5.5rem;
  }
}
