/* TakeRate — hand-written, no framework, no build step. */

:root {
  --ink: #0b1220;
  --ink-2: #1c2740;
  --muted: #5d6b82;
  --faint: #8a97ab;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --bg: #f6f8fb;
  --card: #ffffff;
  --accent: #0d7a6f;
  --accent-2: #0a5f56;
  --accent-soft: #e7f4f1;
  --mint: #7fe3cf;
  --warn-bg: #fff8e6;
  --warn-line: #f0d79a;
  --warn-ink: #7a5200;
  --neg: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 18, 32, .04), 0 8px 24px -12px rgba(11, 18, 32, .12);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.22; letter-spacing: -.018em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.85rem, 4.2vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.5rem); margin-top: 2.2em; font-weight: 650; }
h3 { font-size: 1.06rem; font-weight: 650; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 760px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 22px;
  height: 60px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-weight: 700; font-size: 1.06rem; letter-spacing: -.03em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand .mark { color: var(--accent); font-size: .8em; transform: translateY(-.25em); }
.site-nav { display: flex; gap: 18px; margin-left: auto; font-size: .875rem; }
.site-nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); }
@media (max-width: 720px) {
  .site-nav { gap: 12px; font-size: .8rem; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a:nth-child(4), .site-nav a:nth-child(5) { display: none; }
}

/* ---------- hero ---------- */
.hero { padding: 46px 0 30px; }
.hero h1 { max-width: 17em; }
.hero .lede { font-size: 1.1rem; color: var(--muted); max-width: 44em; margin-bottom: 0; }
.eyebrow {
  font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 10px;
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 820px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

a.card-link {
  display: flex; flex-direction: column; gap: 4px;
  color: inherit; text-decoration: none;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.card-link:hover { border-color: #c9d6e5; transform: translateY(-1px); box-shadow: var(--shadow); color: inherit; }
a.card-link .name { font-weight: 650; display: flex; align-items: center; gap: 8px; }
a.card-link .name .go { margin-left: auto; color: var(--faint); font-weight: 400; }
a.card-link .sub { font-size: .84rem; color: var(--muted); }
a.card-link .meta { font-size: .74rem; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- calculator ---------- */
.calc { margin: 22px 0 8px; padding: 0; overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 10px 10px 0; border-bottom: 1px solid var(--line-2); margin-bottom: 0; }
.tabs button {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .875rem; font-weight: 600; color: var(--muted);
  padding: 9px 14px; border-radius: 9px 9px 0 0; border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--ink); }

.panel { padding: 20px 22px 22px; }
.panel[hidden] { display: none; }

.currency-note { font-size: .78rem; color: var(--faint); margin: 0 0 14px; }

.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 720px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 430px) { .fields { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.field input, .field select {
  font: inherit; font-size: .95rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; width: 100%; min-width: 0;
  font-variant-numeric: tabular-nums;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 122, 111, .13);
}
.field .help { font-size: .72rem; color: var(--faint); }

.switch {
  display: flex; align-items: center; gap: 9px;
  grid-column: 1 / -1; font-size: .85rem; color: var(--ink-2);
  padding: 9px 12px; background: var(--line-2); border-radius: 9px;
  cursor: pointer;
}
.switch input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.switch .extra { color: var(--faint); font-size: .78rem; }

/* result */
.result {
  margin-top: 18px; padding: 20px 22px;
  background: linear-gradient(160deg, #0f1a2c 0%, #12233a 100%);
  border-radius: 12px; color: #fff;
}
.result-label { font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: #9fb0c9; font-weight: 600; }
.result-value {
  font-size: clamp(2rem, 6vw, 2.9rem); font-weight: 700; letter-spacing: -.03em;
  line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums;
  color: #fff;
}
.result-value.pos { color: var(--mint); }
.result-value.neg { color: #ffb4a8; }
.result-sub { font-size: .875rem; color: #b7c5da; font-variant-numeric: tabular-nums; }
.result-sub .sep { opacity: .5; margin: 0 7px; }

/* breakdown */
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table-wrap { overflow-x: auto; margin: 16px 0 0; }
table.breakdown th, table.breakdown td { padding: 8px 2px; border-bottom: 1px solid var(--line-2); text-align: left; }
table.breakdown th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 650; }
table.breakdown td.r, table.breakdown th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.breakdown tr.revenue td { color: var(--muted); }
table.breakdown tr.fee td { color: var(--ink-2); }
table.breakdown tr.fee td.r { color: var(--neg); }
table.breakdown tr.sub td { color: var(--muted); }
table.breakdown tr.total td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); padding-top: 10px; }
table.breakdown tr.total td.r { font-size: 1.02rem; }
table.breakdown .note { display: block; font-size: .74rem; color: var(--faint); line-height: 1.45; margin-top: 1px; }

.hint { font-size: .82rem; color: var(--muted); margin: 12px 0 0; }
.hint strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.btn {
  appearance: none; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--ink-2); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 9px; transition: border-color .12s, background .12s;
}
.btn:hover { border-color: #c3d0e0; background: #fbfcfe; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.calc-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.calc-actions .status { font-size: .8rem; color: var(--accent); }

/* ---------- fee schedule / prose tables ---------- */
.fee-table { font-size: .88rem; }
.fee-table th, .fee-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.fee-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); background: #fafcfe; border-bottom: 1px solid var(--line); }
.fee-table td.amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.fee-table td .note { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 2px; }
.fee-table tbody tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.formula {
  background: #0f1a2c; color: #dbe6f5; border-radius: 12px;
  padding: 16px 18px; font-family: var(--mono); font-size: .82rem; line-height: 1.75;
  overflow-x: auto; margin: 14px 0;
}
.formula .c { color: #7f97b8; }
.formula .k { color: var(--mint); }

/* ---------- banners ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 11px; padding: 12px 15px; font-size: .84rem; line-height: 1.55;
  margin: 18px 0;
}
.banner.draft { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.banner.info { background: var(--accent-soft); border: 1px solid #cbe7e1; color: #0a4d45; }
.banner strong { font-weight: 700; }
.banner .ico { flex: none; font-size: 1rem; line-height: 1.4; }

/* ---------- region pills ---------- */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }
.pill {
  font-size: .8rem; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); text-decoration: none;
}
.pill:hover { border-color: #c3d0e0; color: var(--ink); }
.pill[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- faq ---------- */
.faq { border-top: 1px solid var(--line); margin-top: 12px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: 15px 30px 15px 0; position: relative;
  font-weight: 600; font-size: .95rem; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 13px;
  font-size: 1.15rem; font-weight: 400; color: var(--faint);
}
.faq details[open] summary::after { content: "–"; }
.faq .answer { padding: 0 0 16px; color: var(--muted); font-size: .92rem; }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- misc blocks ---------- */
.crumbs { font-size: .8rem; color: var(--faint); padding: 20px 0 0; }
.crumbs a { color: var(--faint); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { margin: 0 7px; opacity: .6; }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 26px 0; }
.stat-strip div { background: #fff; padding: 14px 16px; }
.stat-strip .k { font-size: .72rem; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.stat-strip .v { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.sources { font-size: .85rem; color: var(--muted); }
.sources ul { padding-left: 20px; margin: 8px 0 0; }
.sources li { margin-bottom: 5px; }
.verified { font-size: .78rem; color: var(--faint); margin-top: 14px; font-variant-numeric: tabular-nums; }

.callout {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 20px 0; font-size: .92rem;
}
.callout p:last-child { margin-bottom: 0; }

.prose h2 { margin-top: 1.9em; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: .45em; }

/* ---------- footer ---------- */
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); background: #fff; }
.site-footer .wrap { padding-top: 36px; padding-bottom: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin: 0 0 10px; }
.site-footer a { display: block; font-size: .86rem; color: var(--muted); text-decoration: none; padding: 2px 0; }
.site-footer a:hover { color: var(--ink); }
.site-footer .blurb { font-size: .86rem; color: var(--muted); max-width: 30em; }
.legal { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line-2); font-size: .76rem; color: var(--faint); display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

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

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

/* ---------- ad slots (render only when adsense.client is set) ---------- */
.ad-slot {
  margin: 26px 0;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.ad-slot:empty { display: none; }

/* ---------- embeddable widget ---------- */
.embed-page { background: #fff; }
.embed-shell { max-width: 720px; margin: 0 auto; padding: 14px; }
.embed-title {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 2px 4px 12px;
}
.embed-brand { font-weight: 700; letter-spacing: -.03em; color: var(--ink); font-size: .95rem; }
.embed-sub { font-size: .82rem; color: var(--faint); }
.embed-page .calc { margin: 0; }
.embed-page .panel { padding: 16px 18px 18px; }
.embed-page .result-value { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.embed-page .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .embed-page .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.embed-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 4px 4px; font-size: .76rem; color: var(--faint);
}
.embed-foot a { color: var(--muted); }

/* ---------- code / widget page ---------- */
.embed-url {
  font-family: var(--mono); font-size: .76rem; color: var(--faint);
  word-break: break-all; margin: 0 0 10px;
}
.codeblock {
  font-family: var(--mono); font-size: .74rem; line-height: 1.6;
  background: #0f1a2c; color: #cfe0f5; border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; margin: 0 0 12px;
  white-space: pre-wrap; word-break: break-word;
}
