/* ==========================================================================
   utm.dk  |  Base stylesheet
   Tokens first. Everything else references tokens, never raw values.
   ========================================================================== */

:root {
  /* Color */
  --paper: #faf8f3;        /* page background */
  --paper-2: #f1eee5;      /* alt section background */
  --ink: #141414;          /* primary text, dark surfaces */
  --ink-2: #4a4a46;        /* secondary text */
  --ink-3: #75736b;        /* muted text, captions */
  --line: #dedad0;         /* borders, dividers */
  --marker: #ffe14d;       /* highlighter: the brand accent */
  --marker-soft: #fff3b0;
  --clean: #0f6e5a;        /* "clean data" signal */
  --clean-soft: #e3f1ec;
  --noise: #b4361f;        /* "messy data" signal */
  --noise-soft: #f8e6e1;
  --on-ink: #faf8f3;       /* text on dark surfaces */

  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1.0625rem;
  --fs-lg: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  --fs-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-2xl: clamp(2rem, 1.5rem + 2.2vw, 3rem);
  --fs-3xl: clamp(2.4rem, 1.6rem + 3.6vw, 4.25rem);

  /* Space and shape */
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --section: clamp(3rem, 2rem + 4vw, 7rem);
  --radius: 10px;
  --radius-sm: 6px;
  --max: 1120px;
  --max-text: 680px;
  --shadow: 0 1px 2px rgb(20 20 20 / 0.06), 0 8px 24px rgb(20 20 20 / 0.06);
}

/* --------------------------------------------------------------------------
   Reset and base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--noise); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.5em; font-weight: 750; }
h1 { font-size: var(--fs-3xl); letter-spacing: -0.035em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -0.03em; }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.2em; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.9em; }
mark { background: var(--marker); color: var(--ink); padding: 0 0.15em; border-radius: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--ink); color: var(--on-ink); padding: 0.5rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.wrap--text { max-width: calc(var(--max-text) + 2 * var(--gutter)); }
.section { padding: var(--section) 0; }
.section--alt { background: var(--paper-2); }
.section--ink { background: var(--ink); color: var(--on-ink); }
.section__head { max-width: var(--max-text); margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.5rem); }
.section__head p { color: var(--ink-2); font-size: var(--fs-lg); }
.section--ink .section__head p,
.section--ink .lead { color: #c9c6bd; }

.eyebrow {
  display: inline-block; font-family: var(--font-sans); font-size: 0.75rem; font-weight: 650;
  color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 1rem;
}
/* Monospace is reserved for examples (UTM strings, URLs, report rows) and for numbering.
   .eyebrow--code: an eyebrow that is itself a UTM string. Part labels in the TOC keep mono too. */
.eyebrow--code, .toc__part > .eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0.02em; text-transform: none;
}
.section--ink .eyebrow { color: #a9a69d; }
.lead { font-size: var(--fs-lg); color: var(--ink-2); }

.grid { display: grid; gap: clamp(1rem, 0.5rem + 1.5vw, 1.5rem); }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) and (max-width: 959px) {
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------------------
   Header and footer
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(250 248 243 / 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4rem; }
.logo { font-family: var(--font-mono); font-weight: 700; font-size: 1.125rem; text-decoration: none; letter-spacing: -0.02em; white-space: nowrap; }
.logo__q { background: var(--marker); padding: 0 0.2em; margin-right: 0.05em; border-radius: 3px; }
.nav { display: flex; align-items: center; gap: 1.5rem; font-size: var(--fs-sm); }
.nav a:not(.btn) { text-decoration: none; color: var(--ink-2); }
.nav a:not(.btn):hover { color: var(--ink); }
@media (max-width: 759px) { .nav a:not(.btn) { display: none; } }

.site-footer { border-top: 1px solid var(--line); padding: 3rem 0; font-size: var(--fs-sm); color: var(--ink-2); }
.site-footer .wrap { display: grid; gap: 2rem; }
@media (min-width: 720px) { .site-footer .wrap { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { font-size: var(--fs-sm); color: var(--ink); margin-bottom: 0.75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.site-footer li a { display: inline-block; padding-block: 0.4rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer__note { font-size: var(--fs-xs); color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 650; font-size: var(--fs-sm); line-height: 1;
  padding: 0.95rem 1.4rem; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--ink); color: var(--on-ink); text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn--marker { background: var(--marker); color: var(--ink); border-color: var(--marker); }
.btn--marker:hover { background: #ffd71a; border-color: #ffd71a; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--on-ink); }
.btn--sm { padding: 0.65rem 1rem; }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { padding: clamp(3.5rem, 2rem + 6vw, 7rem) 0 clamp(3rem, 2rem + 4vw, 5rem); }
.hero h1 { max-width: 15ch; }
.hero .lead { max-width: 56ch; margin-bottom: 2rem; }
.hero__url { margin-top: clamp(2.5rem, 2rem + 3vw, 4rem); }

/* A URL rendered as an object. The site's signature element. */
.url {
  font-family: var(--font-mono); font-size: clamp(0.8rem, 0.7rem + 0.5vw, 1rem); line-height: 1.9;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.25rem; box-shadow: var(--shadow);
  overflow-wrap: anywhere; word-break: break-word;
}
.url__base { color: var(--ink-3); }
.url__sep { color: var(--ink-3); }
.url__key { color: var(--ink-2); }
.url__val { background: var(--marker); color: var(--ink); padding: 0.05em 0.2em; border-radius: 3px; font-weight: 600; }
.url-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 0.9rem; font-size: var(--fs-xs); color: var(--ink-3); }
.url-legend b { color: var(--ink); font-weight: 600; font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   Messy vs clean demo (the epicenter)
   -------------------------------------------------------------------------- */
.demo { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 900px) { .demo { grid-template-columns: 5fr 7fr; gap: 3rem; } }
.demo__copy p { color: var(--ink-2); }

.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 4px; background: #fff; margin-bottom: 1rem; }
.toggle button {
  font: inherit; font-size: var(--fs-sm); font-weight: 600; border: 0; background: transparent;
  padding: 0.5rem 1rem; border-radius: 999px; cursor: pointer; color: var(--ink-2);
}
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }

.report { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.report__bar { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); }
.report table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.report th, .report td { text-align: left; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); }
.report th { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.report td:first-child { font-family: var(--font-mono); font-size: 0.85rem; }
.report td.num, .report th.num { text-align: right; font-variant-numeric: tabular-nums; }
.report tr:last-child td { border-bottom: 0; }
.report tfoot td { font-weight: 700; background: var(--paper); }
.report .flag { display: inline-block; font-family: var(--font-sans); font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; margin-left: 0.4rem; vertical-align: 1px; }
.flag--noise { background: var(--noise-soft); color: var(--noise); }
.flag--clean { background: var(--clean-soft); color: var(--clean); }
.report [data-view="clean"] { display: none; }
.report.is-clean [data-view="messy"] { display: none; }
.report.is-clean [data-view="clean"] { display: table-row-group; }
.report__note { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 0.75rem; }

.verdict { margin-top: 1.25rem; padding: 1rem 1.25rem; border-radius: var(--radius); font-size: var(--fs-sm); }
.verdict--noise { background: var(--noise-soft); color: #6f1f11; }
.verdict--clean { background: var(--clean-soft); color: #0a4a3c; display: none; }
.is-clean-view .verdict--noise { display: none; }
.is-clean-view .verdict--clean { display: block; }

/* --------------------------------------------------------------------------
   Cards (consequences)
   -------------------------------------------------------------------------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.card h3 { margin-bottom: 0.4em; }
.card p { color: var(--ink-2); font-size: var(--fs-sm); margin: 0; }
.card__tag { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--noise); margin-bottom: 0.75rem; display: block; }

/* --------------------------------------------------------------------------
   Principles
   -------------------------------------------------------------------------- */
.principles { display: grid; gap: 1px; background: #2c2c2a; border: 1px solid #2c2c2a; border-radius: var(--radius); overflow: hidden; }
@media (min-width: 820px) { .principles { grid-template-columns: repeat(2, 1fr); } }
.principle { background: var(--ink); padding: clamp(1.5rem, 1rem + 2vw, 2.25rem); }
.principle__n { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--marker); }
.principle h3 { font-size: var(--fs-xl); margin: 0.4rem 0 0.5rem; }
.principle p { color: #c9c6bd; font-size: var(--fs-sm); }
.dodont { display: grid; gap: 0.4rem; margin-top: 1.25rem; font-family: var(--font-mono); font-size: 0.8rem; }
.dodont div { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); background: #1f1f1e; overflow-wrap: anywhere; }
.dodont .x { color: #ff8a73; }
.dodont .ok { color: #7fd8bf; }
.dodont span:first-child { flex: none; font-weight: 700; }

/* --------------------------------------------------------------------------
   Ebook
   -------------------------------------------------------------------------- */
.book { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 900px) { .book { grid-template-columns: 5fr 7fr; gap: 4rem; } }

.cover {
  aspect-ratio: 3 / 4; max-width: 340px; width: 100%; margin: 0 auto;
  background: var(--ink); color: var(--on-ink); border-radius: 4px 12px 12px 4px;
  padding: 2rem 1.75rem; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: inset 6px 0 0 rgb(255 255 255 / 0.06), 0 2px 4px rgb(0 0 0 / 0.12), 0 24px 48px rgb(0 0 0 / 0.18);
  transform: rotate(-2deg);
}
.cover__top { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: #a9a69d; }
.cover__title { font-size: clamp(2rem, 1.6rem + 1.4vw, 2.6rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 0; }
.cover__title mark { padding: 0 0.1em; }
.cover__sub { font-size: 0.9rem; color: #c9c6bd; margin-top: 0.75rem; line-height: 1.4; }
.cover__url { font-family: var(--font-mono); font-size: 0.7rem; color: #a9a69d; line-height: 1.6; overflow-wrap: anywhere; }
.cover__url b { color: var(--marker); font-weight: 500; }

.parts { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: 0; border-top: 1px solid var(--line); }
.parts li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.parts .n { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); padding-top: 0.2rem; }
.parts strong { display: block; }
.parts span { color: var(--ink-2); font-size: var(--fs-sm); }

/* Full TOC */
.toc { counter-reset: none; }
.toc__part { border-top: 2px solid var(--ink); padding-top: 1.5rem; margin-top: 2.5rem; }
.toc__part:first-child { margin-top: 0; }
.toc__part > .eyebrow { margin-bottom: 0.25rem; }
.toc__part > h3 { font-size: var(--fs-xl); margin-bottom: 1rem; }
.toc details { border-bottom: 1px solid var(--line); }
.toc summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 2.5rem 1fr auto; gap: 0.75rem;
  padding: 0.9rem 0; font-weight: 650; align-items: baseline;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary .ch { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); font-weight: 400; }
.toc summary::after { content: "+"; font-family: var(--font-mono); color: var(--ink-3); }
.toc details[open] summary::after { content: "\2212"; }
.toc ul { margin: 0 0 1rem 3.25rem; padding: 0; color: var(--ink-2); font-size: var(--fs-sm); }
.toc li { margin-bottom: 0.3rem; }
@media (max-width: 519px) { .toc ul { margin-left: 1.2rem; } }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.25rem, 1rem + 1.5vw, 2rem); box-shadow: var(--shadow); color: var(--ink); }
.form-card h3 { font-size: var(--fs-xl); }
.form-card > p { color: var(--ink-2); font-size: var(--fs-sm); }
.field { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.field label { font-size: var(--fs-sm); font-weight: 600; }
.field .opt { font-weight: 400; color: var(--ink-3); }
.field input {
  font: inherit; font-size: 1rem; padding: 0.8rem 0.9rem; border: 1px solid #c9c5b9; border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); width: 100%;
}
.field input:focus { outline: 2px solid var(--ink); outline-offset: 1px; background: #fff; }
.field input[aria-invalid="true"] { border-color: var(--noise); }
.field__error { color: var(--noise); font-size: var(--fs-xs); min-height: 1em; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 1.25rem; }
.check input { width: 1.35rem; height: 1.35rem; margin-top: 0.05rem; accent-color: var(--ink); }
.form-legal { font-size: var(--fs-xs); color: var(--ink-3); margin: 1rem 0 0; }
.form-status { font-size: var(--fs-sm); margin-top: 0.75rem; }

/* --------------------------------------------------------------------------
   Misc blocks
   -------------------------------------------------------------------------- */
.checklist { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.checklist li { position: relative; padding-left: 1.75rem; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 0.85rem; height: 0.85rem; border-radius: 3px; background: var(--marker); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); }

.author { display: grid; gap: 1.5rem; align-items: center; }
@media (min-width: 720px) { .author { grid-template-columns: auto 1fr; gap: 2.5rem; } }
.author__img {
  width: 140px; height: 140px; border-radius: 50%; background: var(--paper-2); border: 1px dashed #b9b5a8;
  display: grid; place-items: center; font-size: var(--fs-xs); color: var(--ink-3); text-align: center;
}

.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); color: var(--ink-3); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0 0 1.1rem; color: var(--ink-2); }

.cta-band { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 900px) { .cta-band { grid-template-columns: 1fr 1fr; gap: 4rem; } }

.placeholder { outline: 1px dashed var(--noise); outline-offset: 2px; }

/* Long-form pages (privacy, thank you) */
.prose { max-width: var(--max-text); }
.prose h2 { font-size: var(--fs-xl); margin-top: 2.5rem; }
.prose p, .prose li { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .cover { transition: none; transform: none; }
}

/* Keep the cover in view while scrolling the TOC */
@media (min-width: 900px) { .book > :first-child { position: sticky; top: 6rem; } }
.h1--title { font-size: clamp(2.2rem, 1.6rem + 2.8vw, 3.75rem); white-space: nowrap; }

/* --------------------------------------------------------------------------
   Ebook landing: intro + list left, form right on desktop.
   On phones the form moves up right after the intro, the list follows it.
   -------------------------------------------------------------------------- */
.cta-band--offer { align-items: start; }
@media (max-width: 899px) { .offer__form { order: 1; } .offer__list { order: 2; } }
@media (min-width: 900px) {
  .cta-band--offer { grid-template-areas: "intro form" "list form"; grid-template-rows: auto 1fr; row-gap: 1.5rem; }
  .offer__intro { grid-area: intro; }
  .offer__list { grid-area: list; }
  .offer__form { grid-area: form; }
}

/* --------------------------------------------------------------------------
   Phone tuning
   -------------------------------------------------------------------------- */
@media (max-width: 599px) {
  .hero { padding-block: 2.5rem 3rem; }
  .hero .lead { margin-bottom: 1.5rem; }
  .hero .btn-row .btn, .book .btn-row .btn { width: 100%; }
  .hero__url { margin-top: 2rem; }
  .url { padding: 0.85rem 1rem; }
  .section__head { margin-bottom: 1.75rem; }
  .card { padding: 1.25rem; }
  .grid { gap: 0.75rem; }
  .cover { max-width: 210px; padding: 1.4rem 1.25rem; }
  .cover__title { font-size: 1.75rem; }
  .cover__sub { font-size: 0.8rem; }
  .book { gap: 2rem; }
  .book--toc .cover { display: none; }
  .book--toc > :first-child { display: none; }
  .parts li { grid-template-columns: 3.5rem 1fr; gap: 0.75rem; padding: 0.85rem 0; }
  .author__img { width: 96px; height: 96px; }
  .author .lead { font-size: var(--fs-base); }
  .author a { display: inline-block; padding-block: 0.4rem; }
  .form-card { padding: 1.25rem; }
  .report th, .report td { padding: 0.55rem 0.75rem; }
  .report__bar { padding: 0.6rem 0.75rem; }
  .site-footer { padding-block: 2.25rem; }
}

/* Consent text sits directly above the submit button, so it is read before the click. */
.form-consent { font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-2); margin: 0.25rem 0 1rem; }
.form-card > .form-consent { font-size: var(--fs-xs); }

/* Spam trap field: off screen for people, visible to bots. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
