/* Base styles. No external fonts or scripts: nothing leaves the visitor's browser
   except requests to this site (and the optional analytics script, if enabled). */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d2125;
  --muted: #59616a;
  --accent: #1d6b58;
  --accent-hover: #155343;
  --accent-ink: #ffffff;
  --border: #e2ded4;
  --note-bg: #fff5d9;
  --note-border: #e8cf86;
  --warn-bg: #fdecea;
  --warn-border: #e6a9a1;
  --code-bg: #f1eee7;
  --input-border: #8a8f96;
  --focus: #2f6fd6;
  --radius: 10px;
  --measure: 70ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417;
    --surface: #1a1d21;
    --text: #e8e6e1;
    --muted: #a5abb2;
    --accent: #5cc4a8;
    --accent-hover: #7fd6bf;
    --accent-ink: #0e1a16;
    --border: #2c3138;
    --note-bg: #2b2513;
    --note-border: #6b5a22;
    --warn-bg: #2e1916;
    --warn-border: #7a3a32;
    --code-bg: #23272c;
    --input-border: #6b737d;
    --focus: #8ab4ff;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121417;
  --surface: #1a1d21;
  --text: #e8e6e1;
  --muted: #a5abb2;
  --accent: #5cc4a8;
  --accent-hover: #7fd6bf;
  --accent-ink: #0e1a16;
  --border: #2c3138;
  --note-bg: #2b2513;
  --note-border: #6b5a22;
  --warn-bg: #2e1916;
  --warn-border: #7a3a32;
  --code-bg: #23272c;
  --input-border: #6b737d;
  --focus: #8ab4ff;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

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

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.staging-banner {
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem 1rem;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: 1rem;
}

/* Layout */

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
}

main {
  padding: 2rem 0 3rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem 0 2.5rem;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

/* Type */

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
  margin: 0.5rem 0 1rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

.lede {
  font-size: 1.2rem;
  color: var(--muted);
}

.eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

.meta {
  font-size: 0.9rem;
  color: var(--muted);
}

code,
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Boxes */

.disclosure,
.note,
.warn,
.card {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.disclosure {
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  font-size: 0.97rem;
}

.disclosure strong:first-child {
  display: block;
  margin-bottom: 0.25rem;
}

.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}

.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
}

.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}

.grid-2 > .card {
  margin: 0;
}

.grid-2 .card h2 {
  font-size: 1.2rem;
}

.disclosure > :last-child,
.note > :last-child,
.warn > :last-child,
.card > :last-child {
  margin-bottom: 0;
}

/* Steps */

ol.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.25rem 3rem;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
}

ol.steps > li > h3 {
  margin-top: 0.15rem;
}

/* Tables */

.table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

thead th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

caption {
  caption-side: bottom;
  text-align: left;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Buttons and affiliate links */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.3;
}

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

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background: transparent;
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.affiliate-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1.25rem 0;
}

.affiliate-tag {
  font-size: 0.95rem;
  color: var(--text);
}

.affiliate-tag::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--note-border);
  margin-right: 0.4em;
  vertical-align: middle;
}

/* Offer card: built around a paid-link button by tools/build.mjs */

.offer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  margin: 1.75rem 0;
}

.offer-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
}

.offer-card-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.offer-card-blurb {
  margin: 0.5rem 0 0.75rem;
}

.offer-card-facts {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: grid;
  gap: 0.35rem;
}

.offer-card-facts li {
  position: relative;
  padding-left: 1.6rem;
}

.offer-card-facts li::before {
  content: "✓";
  position: absolute;
  left: 0.2rem;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}

.offer-card-note,
.offer-card-source {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.offer-card .affiliate-cta {
  margin: 1rem 0 0.75rem;
}

.offer-card .btn,
.offer-card .btn-secondary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
}

.offer-card .btn:hover,
.offer-card .btn-secondary:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
}

/* Forms */

form.stack {
  display: grid;
  gap: 1rem;
  max-width: 34rem;
}

label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

textarea {
  min-height: 9rem;
  resize: vertical;
}

.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
}

.check input {
  margin-top: 0.35rem;
  width: 1.1rem;
  height: 1.1rem;
}

.check label {
  font-weight: 400;
  margin: 0;
}

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

.hidden {
  position: absolute !important;
  left: -9999px !important;
}

/* Misc */

.grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}

.figure {
  margin: 1.5rem 0;
}

.figure figcaption {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.sources {
  font-size: 0.9rem;
}

.sources li {
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
