/* US Seller Fee & Net-Profit Calculator — Filly design spec (φ = 1.618) */
:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-alt: #F1F5F9;
  --ink: #0F172A;
  --ink-muted: #475569;
  --border: #CBD5E1;
  --brand: #1B365D;
  --accent: #1D4ED8;
  --accent-hover: #1E40AF;
  --good-bg: #E6F4EA;
  --good-ink: #137333;
  --warn-bg: #FEF7E0;
  --warn-ink: #92400E;
  --loss-bg: #FCE8E6;
  --loss-ink: #B91C1C;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  --radius: 10px;
  --space-6: 6px;
  --space-10: 10px;
  --space-16: 16px;
  --space-26: 26px;
  --space-42: 42px;
  --space-68: 68px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 1040px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.618;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 100;
  background: var(--brand);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  margin: 0;
  color: var(--brand);
}

h1 {
  font-size: clamp(1.62rem, 3vw, 2.618rem);
  font-weight: 700;
  line-height: 1.15;
}

h2 {
  font-size: 1.618rem;
  font-weight: 650;
  line-height: 1.25;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--ink);
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nums {
  font-variant-numeric: tabular-nums;
}

/* ---- Header ---- */
.site-header {
  padding: var(--space-16) 0 var(--space-10);
}

.header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-16);
}

.header-copy p {
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  max-width: 42rem;
}

.badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.badge::-webkit-details-marker {
  display: none;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good-ink);
  box-shadow: 0 0 0 3px var(--good-bg);
}

.fee-notes {
  margin-top: var(--space-10);
  padding: var(--space-16);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.fee-notes li + li {
  margin-top: 8px;
}

/* ---- Tabs ---- */
.tablist {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  margin: 0 0 var(--space-26);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  list-style: none;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}

.tab[aria-selected="true"] {
  background: var(--brand);
  color: #fff;
}

.tab:hover:not([aria-selected="true"]) {
  background: var(--surface-alt);
}

/* ---- Layout grid ---- */
.layout {
  display: grid;
  grid-template-columns: 1.618fr 1fr;
  gap: var(--space-26);
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-26);
}

.card-title {
  margin-bottom: var(--space-16);
}

.results-card {
  position: sticky;
  top: var(--space-26);
}

/* ---- Forms ---- */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-span {
  grid-column: 1 / -1;
}

label,
.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.money-field,
.select-field {
  position: relative;
  display: flex;
  align-items: center;
}

.money-prefix {
  position: absolute;
  left: 12px;
  color: var(--ink-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.percent-suffix {
  position: absolute;
  right: 12px;
  color: var(--ink-muted);
  font-weight: 500;
  pointer-events: none;
}

input[type="number"],
input[type="email"],
input[type="text"],
select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  line-height: 1.618;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-variant-numeric: tabular-nums;
}

input[type="number"].has-prefix,
input[type="text"].has-prefix {
  padding-left: 26px;
}

input[type="number"].has-suffix {
  padding-right: 28px;
}

input[type="number"]:hover,
input[type="email"]:hover,
input[type="text"]:hover,
select:hover {
  border-color: #94A3B8;
}

.subpanel {
  margin-top: var(--space-26);
  padding-top: var(--space-16);
  border-top: 1px solid var(--border);
}

.subpanel h3 {
  margin-bottom: var(--space-16);
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  display: inline-flex;
  align-items: center;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.choice span {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.choice input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.choice input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.platform-options[hidden] {
  display: none;
}

.overrides {
  margin-top: var(--space-16);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 4px 12px 4px;
}

.overrides summary {
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  padding: 10px 0;
}

.overrides .field-grid {
  padding-bottom: var(--space-16);
}

.reset-row {
  margin-top: var(--space-16);
}

.linkish {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linkish:hover {
  color: var(--accent-hover);
}

/* ---- Results ---- */
.hero-block {
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-16);
}

.hero-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-pill.profitable {
  background: var(--good-bg);
  color: var(--good-ink);
}

.status-pill.thin {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.status-pill.loss {
  background: var(--loss-bg);
  color: var(--loss-ink);
}

.hero-value {
  font-size: 2.618rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-value.profitable {
  color: var(--good-ink);
}

.hero-value.thin {
  color: var(--warn-ink);
}

.hero-value.loss {
  color: var(--loss-ink);
}

.metric-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
  margin-top: var(--space-16);
}

.metric {
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 10px 12px;
}

.metric dt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
  margin: 0 0 2px;
}

.metric dd {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.breakdown th {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.breakdown td {
  padding: 6px 0;
  border-bottom: 1px solid var(--surface-alt);
  vertical-align: top;
}

.breakdown td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
  padding-left: 12px;
}

.breakdown tr.total td {
  border-top: 2px solid var(--border);
  border-bottom: 0;
  padding-top: 10px;
  font-weight: 700;
  color: var(--ink);
}

.breakdown .section-head td {
  padding-top: var(--space-16);
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--brand);
  border-bottom: 0;
}

.extra-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
  margin-top: var(--space-16);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.extra-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.compare {
  margin-top: var(--space-16);
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.compare summary {
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 10px 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: var(--space-10);
}

.compare-item {
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 8px 10px;
}

.compare-item .name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.compare-item .val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.compare-item .val.profitable { color: var(--good-ink); }
.compare-item .val.thin { color: var(--warn-ink); }
.compare-item .val.loss { color: var(--loss-ink); }

/* ---- Waitlist CTA ---- */
.cta {
  margin-top: var(--space-42);
  padding: var(--space-26);
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cta h2 {
  color: #fff;
  font-size: clamp(1.25rem, 2vw, 1.618rem);
}

.cta p {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.86);
  max-width: 42rem;
}

.cta-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--space-16);
  align-items: center;
}

.cta-form input[type="email"] {
  flex: 1 1 240px;
  border: 0;
}

.btn {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 650;
  font-size: 1rem;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-hover);
  color: #fff;
}

.cta .btn {
  background: #fff;
  color: var(--brand);
}

.cta .btn:hover {
  background: var(--surface-alt);
  color: var(--brand);
}

.cta-note {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.78);
}

.cta a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Cross-sell ---- */
.cross-sell {
  margin-top: var(--space-26);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
}

.cross-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-16) var(--space-26);
  box-shadow: var(--shadow);
}

.cross-card p {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin: 6px 0 10px;
}

.cross-card a {
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.cross-card a:hover {
  text-decoration: underline;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

/* ---- Footer ---- */
.site-footer {
  margin-top: var(--space-42);
  padding: var(--space-26) 0 var(--space-68);
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.site-footer p + p {
  margin-top: 6px;
}

#privacy {
  margin-top: var(--space-26);
}

#privacy h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

/* ---- Mobile sticky summary pill ---- */
.mobile-pill {
  display: none;
}

/* ---- Privacy page tweaks ---- */
.prose {
  padding: var(--space-26) 0 var(--space-68);
}

.prose h1 {
  margin-bottom: var(--space-16);
}

.prose p + p,
.prose h2 {
  margin-top: var(--space-16);
}

/* ---- Responsive ---- */
@media (max-width: 819px) {
  .wrap {
    padding: 0 16px;
  }

  .header-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .layout,
  .field-grid,
  .cross-sell,
  .metric-pills,
  .extra-metrics,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 1.25rem;
  }

  .results-card {
    position: static;
  }

  .tab {
    font-size: 0.8125rem;
    padding: 10px 4px;
  }

  .cta,
  .card {
    padding: var(--space-16);
  }

  .mobile-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
  }

  #calculator {
    padding-bottom: 128px;
  }

  html {
    scroll-padding-bottom: 128px;
  }

  .layout .card:first-child {
    padding-bottom: calc(var(--space-26) + 32px);
  }

  .platform-options {
    padding-bottom: var(--space-26);
  }

  .mobile-pill .hero-value {
    font-size: 1.25rem;
    line-height: 1.2;
  }

  .mobile-pill .pill-meta {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  .site-footer {
    padding-bottom: 140px;
  }
}

@media (max-width: 419px) {
  .tablist {
    gap: 4px;
    padding: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.stack-gap {
  margin-top: var(--space-16);
}

.hint-gap {
  margin-top: var(--space-10);
}

.hint-pad {
  margin-bottom: var(--space-10);
}

.breakdown-caption {
  text-align: left;
  padding-bottom: 8px;
  caption-side: top;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

.option-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.option-row-3 .choice span {
  width: 100%;
  text-align: center;
  padding: 8px 6px;
  white-space: nowrap;
  line-height: 1.3;
  font-size: 0.75rem;
}

@media (max-width: 819px) {
  .tablist {
    margin-bottom: var(--space-16);
  }
  .card-title {
    margin-bottom: var(--space-10);
  }
  .field-grid {
    gap: var(--space-10);
  }
  /* Keep all three Offsite Ads options on one row at 390px so none wrap
     under the fixed summary pill, and leave clearance above the pill
     for the listing-fee toggle too. */
  .option-row-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 0;
  }
  .option-row-3 .choice span {
    width: 100%;
    padding: 8px 4px;
    font-size: 0.6875rem;
    white-space: nowrap;
  }
  .stack-gap {
    margin-top: var(--space-10);
  }
  input[type="number"],
  input[type="text"],
  input[type="email"],
  select {
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .subpanel {
    margin-top: var(--space-16);
    padding-top: var(--space-10);
  }
}
