/*
 * cherryAD, typeset.
 *
 * One stylesheet for every page the exchange serves. It lives in a file rather
 * than a <style> block because the site sends `style-src 'self'` with no
 * unsafe-inline: an inline block is dropped by the browser and the page arrives
 * naked. Nothing here may be moved back into the HTML.
 *
 * The look is a printed instrument rather than a brochure — a hairline ledger
 * rule running down the page, labels hanging out in the margin the way
 * marginalia sits beside a contract, receipts with a torn top edge, and every
 * figure set in tabular numerals so columns of money line up.
 */

:root {
  color-scheme: dark;

  --ink: #130b13;
  --panel: #1c1019;
  --panel-2: #22111d;
  --rule: #3a2130;
  --edge: #63324c;

  --cherry: #ff7daf;
  --cherry-soft: #ff9fc5;
  --eyebrow: #ff91bd;

  --text: #fff7fb;
  --muted: #cfaebe;
  --faint: #9a8390;

  --good: #a8e6b8;
  --good-bg: #1f4a2c;
  --bad: #ffb0a0;
  --bad-bg: #4a2020;
  --warn-fg: #ffd9c6;
  --warn-bg: #3c1a10;
  --warn-edge: #a8563a;

  /* Latin serifs first, then the Korean serifs that ship with macOS and Windows,
     so a Korean headline stays a headline instead of dropping to the UI sans. */
  --display: "Iowan Old Style", Georgia, "Times New Roman", "Nanum Myeongjo", "AppleMyungjo", Batang, serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;

  font-family: var(--body);
  background: var(--ink);
  color: var(--text);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, #4e1637 0, transparent 38%),
    var(--ink);
  -webkit-font-smoothing: antialiased;
}

main {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 96px;
}

main.narrow { width: min(880px, calc(100% - 32px)); }

/* ----------------------------------------------------------- navigation -- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: -.02em;
  color: var(--text);
  text-decoration: none;
}

.wordmark b { color: var(--cherry); font-weight: inherit; }

.masthead nav {
  display: flex;
  gap: 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
}

.masthead nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.masthead nav a:hover,
.masthead nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--cherry);
}

/* ------------------------------------------------------------ typography -- */

h1 {
  font-family: var(--display);
  font-weight: 400;
  margin: 0 0 14px;
  font-size: clamp(38px, 7vw, 68px);
  line-height: 1.02;
  letter-spacing: -.03em;
  text-wrap: balance;
}

h1 em { font-style: italic; color: var(--cherry-soft); }

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(22px, 3.2vw, 30px);
  line-height: 1.14;
  letter-spacing: -.02em;
  margin: 0 0 10px;
  text-wrap: balance;
}

h3 {
  font-size: 15px;
  margin: 0 0 6px;
  letter-spacing: -.01em;
}

p { margin: 0 0 14px; }

.lead {
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.62;
}

.muted { color: var(--muted); line-height: 1.6; }
.faint { color: var(--faint); }
.small { font-size: 13px; line-height: 1.6; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

a { color: var(--cherry-soft); }
a:hover { color: var(--cherry); }

strong { color: var(--text); }

/* The pull line: the one sentence a section exists to make. */
.pull {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(19px, 2.4vw, 25px);
  line-height: 1.35;
  color: var(--text);
  max-width: 26ch;
  margin: 0;
}

/* ------------------------------------------------------- ledger sections -- */

.stack {
  position: relative;
  border-left: 1px solid var(--rule);
  padding: 0 0 0 26px;
  margin: 56px 0 0;
}

.eyebrow {
  position: relative;
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin: 0 0 14px;
}

/* the label reaches back and touches the ledger rule */
.stack > .eyebrow::before {
  content: "";
  position: absolute;
  left: -26px;
  top: .62em;
  width: 16px;
  height: 1px;
  background: var(--cherry);
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 26px 30px;
  margin-top: 22px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

.rule { border: 0; border-top: 1px solid var(--rule); margin: 26px 0; }

/* ------------------------------------------------------------- receipts -- */

/*
 * The receipt is the product: a handoff that someone confirmed. The torn top
 * edge is drawn, not imaged — it degrades to a plain edge where conic gradients
 * are unsupported.
 */
.receipt {
  position: relative;
  margin-top: 11px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-top: 0;
  padding: 20px 20px 18px;
}

.receipt::before {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  top: -10px;
  height: 10px;
  background: repeating-conic-gradient(from -45deg at 50% 100%, var(--panel-2) 0 90deg, transparent 0 180deg) 0 0 / 14px 10px;
}

.receipt dl { margin: 0; }

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--rule);
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.receipt-line dt { color: var(--muted); }
.receipt-line dd { margin: 0; color: var(--text); }

.receipt-line.total {
  border-bottom: 0;
  border-top: 1px solid var(--edge);
  margin-top: 6px;
  padding-top: 10px;
}

.receipt-line.total dt { color: var(--cherry-soft); }
.receipt-line.total dd { color: var(--cherry); font-weight: 700; }

/* The seal: what a person actually sees under the answer. */
.seal-block {
  border: 1px solid var(--edge);
  border-left: 3px solid var(--cherry);
  background: var(--panel);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.seal-block b { color: var(--text); font-weight: 700; }

/* --------------------------------------------------------------- cards --- */

.card {
  border: 1px solid var(--edge);
  background: rgba(34, 17, 29, .86);
  border-radius: 18px;
  padding: 20px;
  margin-top: 20px;
}

.card.flat { border-radius: 4px; background: var(--panel); }

.warn {
  border: 1px solid var(--warn-edge);
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.62;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 38px; }
.result { min-height: 330px; }

/* -------------------------------------------------------------- forms ---- */

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0 6px;
}

label .hint {
  display: block;
  color: var(--faint);
  font-size: 12px;
  margin-top: 3px;
  line-height: 1.5;
}

input, select, textarea, button {
  border-radius: 10px;
  border: 1px solid var(--edge);
  padding: 11px 13px;
  font: inherit;
}

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #180e16;
}

textarea { min-height: 84px; resize: vertical; line-height: 1.55; }

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cherry);
  outline-offset: 2px;
}

button {
  color: #1c0913;
  background: var(--cherry);
  border: 0;
  font-weight: 800;
  cursor: pointer;
}

button:hover { background: var(--cherry-soft); }

button.ghost {
  background: transparent;
  border: 1px solid var(--edge);
  color: #ffd6e6;
  font-weight: 600;
}

button.ghost:hover { border-color: var(--cherry); background: rgba(255, 125, 175, .08); }

button.wide { width: 100%; margin-top: 20px; padding: 14px; font-size: 15px; }

button[disabled] { opacity: .55; cursor: progress; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 200px; }
.row > button { flex: 0 0 auto; }

fieldset { border: 0; margin: 14px 0 0; padding: 0; }
legend { color: var(--muted); font-size: 13px; padding: 0; }

/* A choice made by reading three sentences, not a dropdown of jargon. */
.choice {
  display: block;
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 13px 15px;
  margin-top: 9px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.choice:hover { border-color: var(--cherry); }
.choice input { width: auto; margin-right: 9px; }
.choice b { color: var(--text); font-size: 14px; }
.choice .aside { display: block; margin: 4px 0 0 25px; }
.choice:has(input:checked) { border-color: var(--cherry); background: rgba(255, 125, 175, .07); }

/* --------------------------------------------------------------- data ---- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

th {
  color: var(--eyebrow);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

td.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

.status { margin-top: 10px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.status.bad { color: var(--bad); }
.status.good { color: var(--good); }

.empty { color: var(--faint); font-size: 13px; padding: 8px 0; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.on { background: var(--good-bg); color: var(--good); }
.pill.off { background: var(--bad-bg); color: var(--bad); }

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  color: #260712;
  background: var(--cherry-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.organic { border-left: 4px solid #f4d35e; padding-left: 14px; margin: 20px 0; }

.sponsored {
  border: 1px solid var(--cherry);
  border-radius: 14px;
  padding: 16px;
  background: #291120;
}

.seal { overflow-wrap: anywhere; color: var(--faint); font-family: var(--mono); font-size: 11px; }

pre.snippet {
  margin: 10px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: #180e16;
  color: var(--cherry-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

footer {
  margin-top: 64px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 13px;
  line-height: 1.7;
}

footer a { color: var(--muted); }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  main { padding-top: 20px; }
  .grid, .split { grid-template-columns: 1fr; }
  .stack { padding-left: 18px; margin-top: 42px; }
  .stack > .eyebrow::before { left: -18px; width: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
