:root {
  --ink: #1c1915;
  --muted: #4a453f;
  --green: #0e5640;
  --green-deep: #14352c;
  --paper: #fbf9f5;
  --bg: #e7e2d8;
  --line: #ddd6c8;
  --card: #fffcf8;
  --danger: #8c2f2a;
  --soft: #eef6f2;
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Figtree", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(900px 320px at 0% -10%, #f8f4ec 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

h1, h2, .serif { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; }

h1 {
  margin: 0.2rem 0 0.75rem;
  font-size: clamp(2rem, 4.4vw, 3.35rem);
  line-height: 1.12;
  max-width: 20ch;
}

h2 { margin: 0 0 0.75rem; font-size: 1.55rem; line-height: 1.2; }

.h-small {
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: 0;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

p { margin: 0 0 0.75rem; }

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

a:hover { color: var(--green-deep); }

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: #fff;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  z-index: 5;
}

.skip:focus { top: 0.75rem; }

.kicker {
  margin: 0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  max-width: 68ch;
  font-size: 1.125rem;
  color: var(--muted);
}

.hero { margin-bottom: 1.5rem; }

.steps-section { margin-bottom: 1.5rem; }

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0;
  margin: 0;
}

.steps li {
  counter-increment: step;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1rem 1.05rem;
  color: var(--ink);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--serif);
  color: var(--green);
  font-size: 1.3rem;
  margin-bottom: 0.35rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.15rem 1.15rem 1.25rem;
  box-shadow: 0 16px 40px rgba(40, 32, 20, 0.05);
}

fieldset {
  border: 0;
  margin: 0 0 0.95rem;
  padding: 0;
}

legend {
  font-weight: 700;
  padding: 0;
  margin-bottom: 0.4rem;
}

.segment {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #efeae1;
  border-radius: 999px;
}

.segment label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.segment label:has(input:checked) {
  background: #fff;
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.08);
}

.segment label:has(input:focus-visible) {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.field { margin-bottom: 0.9rem; }

label { font-weight: 600; }

.price-input {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #d5cec2;
  border-radius: 12px;
  padding: 0.45rem 0.8rem;
  background: #fff;
  margin-top: 0.35rem;
}

.price-input:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(14, 86, 64, 0.16);
}

.price-input span {
  color: var(--muted);
  font-weight: 600;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.price-input-small span { font-size: 1.05rem; }

.price-input input {
  border: 0;
  width: 100%;
  background: transparent;
  font: inherit;
  font-size: 1.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 0.15rem 0;
}

.price-input-small input { font-size: 1.2rem; }

input:focus { outline: none; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0 0; }

.error { color: var(--danger); font-weight: 600; margin: 0.35rem 0 0; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  width: 100%;
  background: var(--green);
  color: #fff;
}

.button-primary:hover { background: var(--green-deep); color: #fff; }

.button-light {
  background: #f6f3ec;
  color: var(--green-deep);
}

.button-light:hover { background: #fff; color: var(--green-deep); }

.button-ghost {
  background: transparent;
  color: #f6f3ec;
  border-color: rgba(246, 243, 236, 0.55);
}

.button-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

button:focus-visible,
.button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.assumptions {
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.assumptions ul { margin: 0.5rem 0 0; padding-left: 1.15rem; }

.assumptions li { margin: 0.35rem 0; }

.assumptions summary { cursor: pointer; font-weight: 700; color: var(--green); }

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.count { margin: 0; color: var(--muted); font-weight: 600; }

.blurb { color: var(--muted); }

.alert {
  background: #f8ece8;
  border: 1px solid #e4c7c1;
  color: var(--danger);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}

#result-errors {
  background: #f8ece8;
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  color: var(--danger);
  margin-bottom: 0.8rem;
}

.mobile-sort { margin-bottom: 0.8rem; }

.mobile-sort select,
#tier-fields select {
  width: 100%;
  min-height: 44px;
  margin-top: 0.35rem;
  border-radius: 10px;
  border: 1px solid #d5cec2;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0.45rem 0.65rem;
}

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  padding: 0 0 0.65rem;
}

th, td {
  padding: 0.8rem 0.7rem;
  vertical-align: top;
  text-align: left;
}

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.rank, td.rank { width: 8%; }
th.platform { width: 34%; }
th[data-sort="platformFee"],
th[data-sort="paymentFee"],
th[data-sort="other"] { width: 14%; }
th[data-sort="net"] { width: 16%; }

thead th {
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

th button {
  font: inherit;
  font-weight: 700;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
  white-space: normal;
  line-height: 1.2;
}

th.num button { text-align: right; }

th.platform, td.platform {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
  text-align: left;
  box-shadow: 8px 0 12px -12px rgba(28, 25, 21, 0.45);
}

thead th.platform { z-index: 2; background: #f6f3ec; }

tbody tr + tr td,
tbody tr + tr th { border-top: 1px solid var(--line); }

tr.is-best { background: var(--soft); }

tr.is-best th.platform,
tr.is-best td.platform { background: var(--soft); }

td.net, .card-net {
  font-weight: 700;
  color: var(--green);
  font-size: 1.05rem;
}

tr.is-negative td.net, .result-card.is-negative .card-net { color: var(--danger); }

.name-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.pname { font-weight: 700; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}

.category, .basis, .meta-line {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  font-weight: 450;
}

.tag {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  background: #f1ece3;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}

details a { overflow-wrap: anywhere; }

details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--green);
  margin-top: 0.45rem;
}

details summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.detail-label {
  margin: 0.75rem 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

details ul { margin: 0.2rem 0 0.4rem; padding-left: 1.1rem; }

details li { margin: 0.25rem 0; }

.formula, .footnote {
  color: var(--muted);
  font-size: 0.92rem;
}

.footnote { margin-top: 0.8rem; }

.card-list { display: none; gap: 0.75rem; }

.result-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem 1rem;
  background: #fff;
}

.result-card.is-best { box-shadow: inset 3px 0 0 var(--green); }

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.card-net {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
}

.fee-dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  margin: 0.75rem 0 0.2rem;
}

.fee-dl dt { color: var(--muted); }
.fee-dl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.cta {
  margin-top: 1.25rem;
  background: var(--green-deep);
  color: #f6f3ec;
  border-radius: 20px;
  padding: 1.4rem 1.3rem 1.3rem;
}

.cta h2, .cta p { color: #f6f3ec; }

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.cta-note { margin: 0.8rem 0 0; color: rgba(246, 243, 236, 0.82); font-size: 0.9rem; }

.disclaimer, .sources {
  margin-top: 1.25rem;
}

.disclaimer {
  background: #f4efe4;
  border-left: 3px solid #8a6a32;
  border-radius: 0 14px 14px 0;
  padding: 1rem 1.1rem;
}

.sources ul { padding-left: 1.15rem; }

.sources li { margin: 0.45rem 0; }

.sources a { overflow-wrap: anywhere; }

.site-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer #last-updated { color: var(--ink); font-weight: 600; }

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

#results[data-state="loading"] .table-scroll,
#results[data-state="loading"] .card-list,
#results[data-state="loading"] .formula,
#results[data-state="empty"] .table-scroll,
#results[data-state="empty"] .card-list,
#results[data-state="empty"] .formula,
#results[data-state="error"] .table-scroll,
#results[data-state="error"] .card-list,
#results[data-state="error"] .formula,
#results .mobile-sort,
#results .count { display: none; }

#results[data-state="ready"] .table-scroll { display: block; }
#results[data-state="ready"] .formula { display: block; }
#results[data-state="ready"] .count { display: block; }

@media (max-width: 959px) {
  .layout, .steps { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  #results[data-state="ready"] .table-scroll { display: none; }
  #results[data-state="ready"] .card-list { display: grid; }
  #results[data-state="ready"] .mobile-sort { display: block; }
}

@media (min-width: 960px) {
  .calc-card { position: sticky; top: 1rem; }
}

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


/* Trust strip near results */
.trust-strip {
  margin: 0.35rem 0 0.9rem;
  padding: 0.85rem 0.95rem;
  background: var(--soft);
  border: 1px solid #cfe3d9;
  border-radius: 14px;
}

.trust-kicker {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trust-body { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.95rem; }

.trust-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.trust-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #c5d9ce;
  color: var(--green-deep);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.trust-chip:hover {
  background: var(--green);
  border-color: var(--green);
  color: #f6f3ec;
}

.trust-footnote {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Affiliate badge next to CTA buttons */
.cta-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.affiliate-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(246, 243, 236, 0.72);
}

.cta-actions-light .affiliate-badge,
.crosslist-worth .affiliate-badge {
  color: var(--muted);
}

.button-ghost-dark {
  background: transparent;
  color: var(--green-deep);
  border: 1px solid #9fb9ad;
}

.button-ghost-dark:hover {
  background: var(--soft);
  color: var(--green);
}

/* FAQ */
.faq {
  margin-top: 1.25rem;
}

.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  margin: 0.55rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--green-deep);
}

.faq details[open] summary { margin-bottom: 0.45rem; }

.faq details p { margin: 0; color: var(--muted); }

.faq code {
  font-size: 0.9em;
  background: var(--soft);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

.platform-jumps {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Crosslisting worth-it strip */
.crosslist-worth {
  margin-top: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.3rem 1.2rem 1.2rem;
}

.compare-scroll { overflow-x: auto; margin: 0.6rem 0 0.75rem; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.compare-table th,
.compare-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.compare-table thead th {
  background: var(--soft);
  color: var(--green-deep);
  font-size: 0.95rem;
}

.compare-table tbody th {
  width: 22%;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  position: static;
}

.compare-footnote {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.crosslist-worth .cta-actions { margin-top: 0.2rem; }

/* Platform highlight — space-separated tokens on body[data-highlight-platform]
   support single landings and dual vs pages (e.g. "ebay poshmark"). */
body[data-highlight-platform] tr[data-platform].is-focus,
body[data-highlight-platform] .result-card[data-platform].is-focus {
  box-shadow: inset 3px 0 0 var(--green);
}

body[data-highlight-platform~="ebay"] tr[data-platform="ebay"],
body[data-highlight-platform~="poshmark"] tr[data-platform="poshmark"],
body[data-highlight-platform~="mercari"] tr[data-platform="mercari"],
body[data-highlight-platform~="depop"] tr[data-platform="depop"],
body[data-highlight-platform~="whatnot"] tr[data-platform="whatnot"],
body[data-highlight-platform~="vinted"] tr[data-platform="vinted"] {
  background: #eef7f2;
}

body[data-highlight-platform~="ebay"] tr[data-platform="ebay"] th.platform,
body[data-highlight-platform~="ebay"] tr[data-platform="ebay"] td.platform,
body[data-highlight-platform~="poshmark"] tr[data-platform="poshmark"] th.platform,
body[data-highlight-platform~="poshmark"] tr[data-platform="poshmark"] td.platform,
body[data-highlight-platform~="mercari"] tr[data-platform="mercari"] th.platform,
body[data-highlight-platform~="mercari"] tr[data-platform="mercari"] td.platform,
body[data-highlight-platform~="depop"] tr[data-platform="depop"] th.platform,
body[data-highlight-platform~="depop"] tr[data-platform="depop"] td.platform,
body[data-highlight-platform~="whatnot"] tr[data-platform="whatnot"] th.platform,
body[data-highlight-platform~="whatnot"] tr[data-platform="whatnot"] td.platform,
body[data-highlight-platform~="vinted"] tr[data-platform="vinted"] th.platform,
body[data-highlight-platform~="vinted"] tr[data-platform="vinted"] td.platform {
  background: #eef7f2;
}

body[data-highlight-platform~="ebay"] .result-card[data-platform="ebay"],
body[data-highlight-platform~="poshmark"] .result-card[data-platform="poshmark"],
body[data-highlight-platform~="mercari"] .result-card[data-platform="mercari"],
body[data-highlight-platform~="depop"] .result-card[data-platform="depop"],
body[data-highlight-platform~="whatnot"] .result-card[data-platform="whatnot"],
body[data-highlight-platform~="vinted"] .result-card[data-platform="vinted"] {
  border-color: #9ec9b4;
  background: #f3faf6;
}

.cta-note strong { color: #fff; }
