/* Listmargin — eBay fee calculator
   Design note: the receipt is the signature. Everything else stays quiet.
   Ground is a cool desk grey; the receipt is warm thermal paper sitting on it.
   Sticker orange appears three times only: the mark, the profit rule, the buttons. */

:root {
  --desk: #e8ecef;
  --desk-deep: #dde3e8;
  --receipt: #fffdfb;
  --ink: #14181d;
  --ink-soft: #3d4650;
  --muted: #6b7480;
  --rule: #d3d9df;
  --rule-soft: #e7ebee;
  --sticker: #ff5a1f;
  --gain: #12704a;
  --loss: #c0303a;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;

  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --radius: 4px;
}

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

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

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  /* faint desk texture so the receipt reads as an object on a surface */
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.7) 0, transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(255,255,255,.45) 0, transparent 40%);
  background-attachment: fixed;
}

:focus-visible {
  outline: 2px solid var(--sticker);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--gap);
  border-bottom: 1px solid var(--rule);
  background: rgba(255,255,255,.55);
  backdrop-filter: saturate(1.4) blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: -.015em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark__mark {
  width: 13px; height: 13px;
  background: var(--sticker);
  border-radius: 2px;
  transform: rotate(-8deg);
}

.masthead__nav { display: flex; gap: 1.4rem; }
.masthead__nav a {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: lowercase;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.masthead__nav a:hover { color: var(--ink); border-bottom-color: var(--sticker); }

@media (max-width: 640px) { .masthead__nav a:nth-child(3) { display: none; } }

/* ---------- hero / calculator ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(300px, 360px);
  gap: var(--gap);
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.75rem) var(--gap) clamp(2.5rem, 5vw, 4rem);
}

.eyebrow {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--sticker);
  margin: 0 0 1rem;
}

.hero h1 {
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(2.1rem, 4.4vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -.022em;
  margin: 0 0 1.1rem;
  text-wrap: balance;
}

.lede { margin: 0 0 1.6rem; color: var(--ink-soft); max-width: 44ch; }

.hero__facts { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.hero__facts li {
  font-size: .89rem;
  color: var(--ink-soft);
  padding-left: 1.1rem;
  position: relative;
  max-width: 46ch;
}
.hero__facts li::before {
  content: "";
  position: absolute; left: 0; top: .62em;
  width: 6px; height: 6px;
  background: var(--sticker);
  border-radius: 1px;
}
.hero__facts strong { color: var(--ink); font-weight: 600; }

/* ---------- input panel ---------- */

.panel {
  background: rgba(255,255,255,.62);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.5rem;
}

.panel__title {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .9rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule-soft);
}
.panel__title + .field-row, .panel__title + .field { margin-top: 0; }
.panel .panel__title:not(:first-child) { margin-top: 1.7rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.field { display: block; margin-bottom: .9rem; }
.field-row .field { margin-bottom: 0; }

.field__label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: .35rem;
}

.field__input {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0 .7rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field__input:focus-within {
  border-color: var(--sticker);
  box-shadow: 0 0 0 3px rgba(255,90,31,.13);
}
.field__input i {
  font-style: normal;
  font-family: var(--mono);
  font-size: .84rem;
  color: var(--muted);
  flex: none;
}
.field__input i.suffix { order: 2; }

.field__input input,
.field__input select {
  flex: 1 1 0;
  width: 100%;
  min-width: 0; /* number inputs carry an intrinsic size and will overflow the panel without this */
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  padding: .58rem .35rem;
}
.field__input input:focus, .field__input select:focus { outline: none; }
.field__input input::-webkit-outer-spin-button,
.field__input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field__input input[type=number] { -moz-appearance: textfield; }

.field__input--select { padding-right: .35rem; position: relative; }
.field__input--select::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
  flex: none;
  margin-right: .4rem;
}
.field__input--select select {
  appearance: none;
  font-family: var(--sans);
  font-size: .88rem;
  cursor: pointer;
  padding-right: .2rem;
}

.field__hint {
  display: block;
  font-size: .74rem;
  line-height: 1.4;
  color: var(--muted);
  margin-top: .35rem;
}

/* segmented control — the rate table is a binary choice, so it gets a primary control */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  background: var(--desk-deep);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.segmented button {
  font-family: var(--sans);
  font-size: .84rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-radius: 2px;
  padding: .45rem .4rem;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.segmented button span {
  display: block;
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .04em;
  color: var(--muted);
  margin-top: 1px;
}
.segmented button:hover { background: rgba(255,255,255,.55); }
.segmented button[aria-checked="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20,24,29,.1);
}
.segmented button[aria-checked="true"] span { color: var(--sticker); }

.more { margin-top: 1.4rem; border-top: 1px solid var(--rule-soft); padding-top: .9rem; }
.more summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .05em;
  color: var(--muted);
}
.more summary::-webkit-details-marker { display: none; }
.more summary:hover { color: var(--ink); }
.more__chev {
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s ease;
}
.more[open] .more__chev { transform: rotate(-135deg) translateY(-2px); }
.more__body { padding-top: 1.1rem; }

/* ---------- the receipt (signature) ---------- */

.receipt-wrap { position: sticky; top: 5.2rem; }

.receipt {
  background: var(--receipt);
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.4rem 1.3rem .3rem;
  font-family: var(--mono);
  font-size: .82rem;
  box-shadow: 0 1px 2px rgba(20,24,29,.05), 0 12px 28px -14px rgba(20,24,29,.28);
}

/* torn thermal-paper edge */
.receipt__tear {
  height: 12px;
  background: var(--receipt);
  filter: drop-shadow(0 8px 12px rgba(20,24,29,.14));
  -webkit-mask-image: repeating-linear-gradient(-45deg, #000 0 6px, transparent 6px 12px);
  mask-image: repeating-linear-gradient(-45deg, #000 0 6px, transparent 6px 12px);
  -webkit-mask-size: 12px 12px;
  mask-size: 12px 12px;
  border-left: 1px solid transparent;
}

.receipt__head { text-align: center; padding-bottom: .9rem; border-bottom: 1px dashed var(--rule); }
.receipt__title {
  margin: 0;
  font-family: var(--cond);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.receipt__sub { margin: .25rem 0 0; font-size: .7rem; color: var(--muted); line-height: 1.35; }

.receipt__block { padding: .85rem 0; border-bottom: 1px dashed var(--rule); }

.receipt__legend {
  margin: 0 0 .5rem;
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  padding: .16rem 0;
  color: var(--ink-soft);
}
/* display:flex would otherwise beat the [hidden] attribute and leak $0.00 rows */
.line[hidden] { display: none; }
.line span { min-width: 0; }
.line b { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.line--neg b { color: var(--loss); }
.line--sum {
  margin-top: .45rem;
  padding-top: .45rem;
  border-top: 1px solid var(--ink);
  color: var(--ink);
}
.line--sum span { font-weight: 600; }
.line--sum b { font-weight: 600; }
.line em { font-style: normal; font-size: .74rem; color: var(--muted); display: block; }
.line--sub { padding-left: .9rem; font-size: .76rem; color: var(--muted); }
.line--sub b { color: var(--ink-soft); font-weight: 400; }

.receipt__profit { padding: 1rem 0 1.1rem; text-align: center; }
.receipt__figure {
  margin: .1rem 0 .55rem;
  font-family: var(--cond);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--gain);
  display: inline-block;
  border-bottom: 3px solid var(--sticker);
  padding-bottom: .12rem;
  transition: color .18s ease;
}
.receipt--loss .receipt__figure { color: var(--loss); }

.receipt__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .4rem;
  margin: 0;
  padding-top: .7rem;
  border-top: 1px dashed var(--rule);
}
.receipt__stats div { text-align: center; }
.receipt__stats dt { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.receipt__stats dd { margin: .15rem 0 0; font-size: .88rem; font-weight: 500; font-variant-numeric: tabular-nums; }

.receipt__check {
  padding: .9rem 0 1rem;
  border-top: 1px dashed var(--rule);
}
.receipt__check[hidden] { display: none; }
.check__line {
  margin: 0;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--ink);
}
.check__line b { font-weight: 600; }
.check__note {
  margin: .35rem 0 0;
  font-size: .7rem;
  line-height: 1.45;
  color: var(--muted);
}

.receipt__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .8rem 0 1rem;
  border-top: 1px dashed var(--rule);
}
.receipt__foot p { margin: 0; font-size: .64rem; color: var(--muted); line-height: 1.35; }

.copy {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .05em;
  color: var(--ink);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .4rem .6rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.copy:hover { border-color: var(--sticker); background: rgba(255,90,31,.06); }
.copy[data-done="1"] { border-color: var(--gain); color: var(--gain); }

/* ---------- prose sections ---------- */

.prose {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4rem) var(--gap);
  border-top: 1px solid var(--rule);
}
.prose h2 {
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -.015em;
  margin: 0 0 1rem;
}
.prose h3 {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 1.18rem;
  margin: 2.2rem 0 .7rem;
}
.prose p { color: var(--ink-soft); margin: 0 0 1rem; }
.prose b { color: var(--ink); font-weight: 600; }

.defs { margin: 1.5rem 0; display: grid; gap: 1rem; }
.defs dt {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--rule);
}
.defs dd { margin: .5rem 0 0; color: var(--ink-soft); font-size: .93rem; }

.callout {
  border-left: 3px solid var(--sticker);
  padding: .2rem 0 .2rem 1rem;
  margin: 1.5rem 0 0;
  font-size: .93rem;
}

.table-note { font-size: .9rem; }

.table-toggle { display: flex; gap: .4rem; margin: 1.4rem 0 1rem; flex-wrap: wrap; }
.table-toggle button {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .04em;
  padding: .45rem .8rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: rgba(255,255,255,.6);
  color: var(--muted);
  cursor: pointer;
}
.table-toggle button[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: rgba(255,255,255,.6); }
.fees { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 480px; }
.fees th, .fees td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.fees th {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fff;
  border-bottom: 1px solid var(--rule);
  /* not sticky: it would scroll under the sticky masthead and read as a smear */
}
.fees tr:last-child td { border-bottom: 0; }
.fees td:last-child { font-family: var(--mono); font-size: .78rem; white-space: pre-line; color: var(--ink-soft); }
.fees .tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .1rem .35rem;
  border: 1px solid var(--sticker);
  color: var(--sticker);
  border-radius: 2px;
  margin-left: .4rem;
  vertical-align: 1px;
}

.snippet {
  background: var(--ink);
  color: #dfe5ea;
  font-family: var(--mono);
  font-size: .74rem;
  line-height: 1.6;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.2rem 0 .9rem;
}
.copy--wide { padding: .55rem 1rem; font-size: .74rem; }

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--rule);
  padding: 2.5rem var(--gap) 3rem;
  max-width: 760px;
  margin: 0 auto;
}
.footer p { margin: 0 0 .6rem; font-size: .8rem; color: var(--muted); max-width: 60ch; }
.footer__brand {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink) !important;
  letter-spacing: -.01em;
}
.footer__meta { font-family: var(--mono); font-size: .7rem; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
  .hero__intro { grid-column: 1 / -1; }
  .receipt-wrap { position: static; }
}

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .receipt-wrap { position: static; }
  .field-row { grid-template-columns: 1fr; gap: .9rem; }
  .field-row + .field, .field-row + .field-row { margin-top: .9rem; }
  .receipt__stats { grid-template-columns: 1fr; gap: .55rem; }
  .receipt__stats div { display: flex; justify-content: space-between; align-items: baseline; }
  .receipt__stats dd { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
