/* QR Stabil — design tokens
   Concept: the QR code is a print proof. One bold element (the proof with crop marks);
   everything else is calm, legible and big enough for anyone to use. */
:root {
  --bg: #eef1f5;        /* cool desk grey */
  --paper: #ffffff;     /* the proof */
  --ink: #0f1b2d;       /* text */
  --ink-soft: #4a5568;  /* secondary text, AA on --bg and --paper */
  --line: #c9d1dc;      /* borders, crop marks */
  --action: #2348d6;    /* buttons, links, focus */
  --action-dark: #1a37a8;
  --ok: #1e7a4f;
  --warn: #9a5b00;
  --error: #b42318;

  --radius-control: 10px;
  --radius-proof: 4px;  /* paper has nearly square corners */
  --tap: 48px;          /* minimum touch target */

  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.125rem;          /* 18px base: comfortable for every age */
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--action); text-underline-offset: .18em; }
a:hover { color: var(--action-dark); }

:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(72rem, 100% - 2.5rem); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header { padding-block: 1rem; }
.site-header .wrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; }
.site-nav { display: flex; gap: .25rem; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 .8rem;
  border-radius: 999px; color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 1rem;
}
.site-nav a:hover { color: var(--ink); background: #e2e7ee; }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }

.lang { margin-left: auto; position: relative; }
@media (max-width: 600px) {
  .site-header .wrap { gap: .5rem 1rem; }
  .site-nav { order: 3; width: 100%; }
}
.lang summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .45rem;
  min-height: 40px; padding: 0 .8rem; border-radius: 999px; font-size: 1rem; color: var(--ink-soft);
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { color: var(--ink); background: #e2e7ee; }
.lang summary svg { width: 18px; height: 18px; }
.lang ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 13rem;
  list-style: none; margin: 0; padding: .4rem; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-control); box-shadow: 0 12px 32px rgba(15, 27, 45, .14);
}
.lang li a { display: block; padding: .55rem .75rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.lang li a:hover { background: var(--bg); }
.lang li a[aria-current="true"] { font-weight: 700; }

/* ---------- Page heading ---------- */
.page-head { padding-block: 1.5rem 1.25rem; max-width: 46rem; }
.page-head h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 .6rem; }
.page-head p { margin: 0; color: var(--ink-soft); font-size: 1.15rem; max-width: 40rem; }

/* ---------- Generator layout ---------- */
.studio {
  display: grid; gap: 1.5rem 3rem; align-items: start;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "type" "content" "proof" "options";
  padding-bottom: 3rem;
}
@media (min-width: 900px) {
  .studio {
    grid-template-columns: minmax(0, 1fr) 22rem;
    grid-template-rows: auto auto 1fr; /* spare height goes below the options, not between fields */
    grid-template-areas: "type proof" "content proof" "options proof";
  }
  .proof-col { position: sticky; top: 1.25rem; }
}
.area-type { grid-area: type; }
.area-content { grid-area: content; }
.area-options { grid-area: options; }
.proof-col { grid-area: proof; }

/* Type switcher: three big choices */
.choices { border: 0; padding: 0; margin: 0; }
.choices legend { font-weight: 700; margin-bottom: .6rem; padding: 0; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  min-height: 84px; padding: .75rem .5rem; text-align: center; font-weight: 600; font-size: 1rem;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius-control);
  transition: border-color .12s, box-shadow .12s;
}
.choice svg { width: 26px; height: 26px; color: var(--ink-soft); }
.choice input:hover + span { border-color: #9aa7b8; }
.choice input:checked + span { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action); }
.choice input:checked + span svg { color: var(--action); }
.choice input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 3px; }

/* Fields */
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field > span { font-weight: 700; }
.field small { color: var(--ink-soft); font-size: .95rem; }
input[type="text"], input[type="email"], textarea, select {
  font: inherit; color: var(--ink); width: 100%;
  min-height: var(--tap); padding: .7rem .9rem;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius-control);
}
textarea { min-height: 7.5rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7a8597; }
input[type="text"]:hover, textarea:hover, select:hover { border-color: #9aa7b8; }
input[type="text"]:focus, input[type="email"]:focus, textarea:focus, select:focus { border-color: var(--action); outline: none; box-shadow: 0 0 0 3px rgba(35, 72, 214, .25); }
.big-input { font-size: 1.3rem; min-height: 60px; }
.two-col { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .two-col { grid-template-columns: 1fr 1fr; } }

.messages { margin: 0; padding: 0; list-style: none; }
.messages li { color: var(--error); font-weight: 600; display: flex; gap: .5rem; align-items: flex-start; }
.messages li::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; margin-top: .15rem; border-radius: 50%; background: var(--error); color: #fff; font-size: .85rem; font-weight: 800; }

/* Options (colours and size), folded */
.options { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-control); }
.options > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  min-height: 56px; padding: 0 1.1rem; font-weight: 700;
}
.options > summary::-webkit-details-marker { display: none; }
.options > summary::after { content: ""; width: 10px; height: 10px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
.options[open] > summary::after { transform: rotate(-135deg) translateY(-3px); }
.options-body { padding: .25rem 1.1rem 1.1rem; }

.swatches { border: 0; padding: 0; margin: 0 0 1rem; }
.swatches legend { font-weight: 700; padding: 0; margin-bottom: .5rem; }
.swatch-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.swatch { position: relative; width: var(--tap); height: var(--tap); }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
/* preset colours as classes: the CSP forbids inline style attributes */
.sw-000000 { --c: #000000; } .sw-1a2b6d { --c: #1a2b6d; } .sw-0f5132 { --c: #0f5132; } .sw-7a1020 { --c: #7a1020; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--action); }
.swatch input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 4px; }
.color-pick { justify-self: start; display: inline-flex; align-items: center; gap: .5rem; min-height: var(--tap); padding: 0 .9rem 0 .4rem; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); cursor: pointer; font-size: 1rem; }
.color-pick:hover { border-color: #9aa7b8; }
input[type="color"] { -webkit-appearance: none; appearance: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0,0,0,.2); border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: 1px solid rgba(0,0,0,.2); border-radius: 50%; }

/* ---------- The proof (the one bold element) ---------- */
.proof-frame { position: relative; padding: 22px; max-width: 26rem; margin-inline: auto; }
.crop { position: absolute; width: 18px; height: 18px; border-color: var(--ink); border-style: solid; border-width: 0; opacity: .55; }
.crop.tl { top: 0; left: 0; border-top-width: 1.5px; border-left-width: 1.5px; }
.crop.tr { top: 0; right: 0; border-top-width: 1.5px; border-right-width: 1.5px; }
.crop.bl { bottom: 0; left: 0; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.crop.br { bottom: 0; right: 0; border-bottom-width: 1.5px; border-right-width: 1.5px; }
.proof {
  position: relative; background: var(--paper); border-radius: var(--radius-proof);
  box-shadow: 0 1px 2px rgba(15, 27, 45, .08), 0 18px 40px -12px rgba(15, 27, 45, .28);
  padding: 1rem; aspect-ratio: 1;
}
/* the qrcode library writes inline pixel sizes; the proof must stay fluid */
.proof canvas { display: block; width: 100% !important; height: auto !important; image-rendering: pixelated; transition: opacity .2s; }
.proof-empty {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; text-align: center;
  color: var(--ink-soft); font-weight: 600; font-size: 1.05rem; pointer-events: none;
}
.proof-empty span { background: rgba(255,255,255,.92); padding: .5rem .75rem; border-radius: 8px; }
[data-state="ready"] .proof-empty { display: none; }
[data-state="empty"] canvas, [data-state="error"] canvas { opacity: .14; }

.status { min-height: 1.6em; margin: .9rem 0 .2rem; font-size: 1rem; font-weight: 600; display: flex; gap: .5rem; align-items: flex-start; }
[data-state="ready"] .status { color: var(--ok); }
[data-state="ready"] .status::before { content: ""; flex: none; width: .65rem; height: .65rem; margin-top: .45rem; border-radius: 50%; background: var(--ok); }
.warning { color: var(--warn); font-size: .98rem; margin: 0 0 .6rem; }
.warning:empty { display: none; }

.actions { display: grid; gap: .6rem; margin-top: .6rem; }
.btn {
  font: inherit; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 56px; padding: 0 1.25rem; border-radius: var(--radius-control); cursor: pointer; text-decoration: none;
  border: 2px solid transparent; transition: background .12s, border-color .12s;
}
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--action); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--action-dark); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-soft); }
.btn:disabled { cursor: not-allowed; background: #dde3ea; color: #6b7686; border-color: transparent; }
.proof-note { font-size: .95rem; color: var(--ink-soft); margin: 1rem 0 0; }

/* ---------- Below the tool ---------- */
.band { background: var(--paper); border-block: 1px solid var(--line); padding-block: 3rem; }
.band-inner { display: grid; gap: 1.5rem 3rem; }
@media (min-width: 900px) { .band-inner { grid-template-columns: 1fr 1fr; align-items: center; } }
.band h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -0.01em; }
.band p { margin: 0; color: var(--ink-soft); max-width: 36rem; }
.band .btn { justify-self: start; }

.compare { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.compare li { display: grid; grid-template-columns: 2rem 1fr; gap: .25rem .75rem; align-items: start; }
.compare svg { width: 28px; height: 28px; }

.prose { padding-block: 3rem 4rem; max-width: 46rem; }
.prose h2 { font-size: 1.6rem; margin: 0 0 .75rem; }
.prose > p { color: var(--ink-soft); }
.faq { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 60px; font-weight: 700; padding-block: .75rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; font-weight: 400; color: var(--ink-soft); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 1.25rem; color: var(--ink-soft); }

/* ---------- Editable codes page ---------- */
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.promises li { display: grid; grid-template-columns: 1.6rem 1fr; gap: .75rem; }
.promises li::before { content: ""; width: 1.4rem; height: 1.4rem; margin-top: .15rem; border-radius: 50%; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 70% no-repeat; }
.pledge { margin-top: 1.5rem; padding: 1rem 1.25rem; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius-control); }

.packs { list-style: none; margin: 1.25rem 0; padding: 0; display: grid; gap: .75rem; }
@media (min-width: 720px) { .packs { grid-template-columns: repeat(3, 1fr); } }
.pack { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 1.25rem; }
.pack h3 { margin: 0 0 .4rem; font-size: 1.05rem; color: var(--ink-soft); font-weight: 600; }
.pack .price { margin: 0; font-size: 2.2rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.pack .price span { font-size: 1rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.pack .per { margin: .35rem 0 0; color: var(--ink-soft); font-size: 1rem; }

.waitlist { margin-top: 2.5rem; padding: 1.5rem; background: var(--paper); border: 2px solid var(--action); border-radius: var(--radius-control); }
.waitlist h2 { margin-top: 0; }
.waitlist fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.waitlist legend { font-weight: 700; padding: 0; margin-bottom: .5rem; }
.radio-line { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); cursor: pointer; }
.radio-line input { width: 22px; height: 22px; accent-color: var(--action); }
.section { margin-block: 2.5rem; }
.narrow { max-width: 50rem; }
.section h2 { font-size: 1.6rem; margin: 0 0 1rem; }
.muted { color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer { padding-block: 2rem 3rem; color: var(--ink-soft); font-size: .95rem; }
.site-footer p { margin: .25rem 0; }

/* ---------- Motion & a11y ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Notice pages (after signup) ---------- */
.notice { max-width: 34rem; margin: 3rem auto 4rem; padding: 2.5rem 2rem; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-control); }
.notice-icon { width: 64px; height: 64px; margin: 0 auto 1rem; color: var(--action); }
.notice-icon svg { width: 100%; height: 100%; }
.notice h1 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem); margin: 0 0 .75rem; letter-spacing: -0.01em; }
.notice-body { font-size: 1.15rem; margin: 0 0 1rem; }
.notice .btn { margin-top: 1rem; }
.form-error { color: var(--error); font-weight: 600; margin: 0 0 1rem; }
.form-error:empty { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
