/* Site shell styles. Colour, type, radius and spacing come only from the variables in tokens.css, so the
   marketing pages and the app look like one product and follow the same light/dark theme.
   Selectors are scoped to site classes so nothing leaks into the app mounted in #app-root. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
main:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { width: min(100% - var(--s4) * 2, 72rem); margin-inline: auto; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.skip-link {
  position: absolute; left: var(--s4); top: -5rem; z-index: 100;
  padding: var(--s2) var(--s4); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-contrast); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 2.75rem; padding: var(--s2) var(--s5);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-contrast);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-quiet { background: transparent; border-color: var(--border); color: var(--accent); }
.btn-quiet:hover { background: var(--surface-2); border-color: var(--border); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-bar { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; min-height: 4rem; padding-block: var(--s2); }
.brand { display: inline-flex; align-items: center; gap: var(--s3); color: var(--text); font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.brand-mark { flex: none; }
.bm-bg { fill: var(--accent); }
.bm-page { fill: var(--accent-contrast); }
.bm-fold { fill: var(--accent); opacity: 0.35; }
.bm-glyph { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.site-nav { margin-inline-start: var(--s4); }
.site-nav ul { display: flex; gap: var(--s1); margin: 0; padding: 0; list-style: none; }
.site-nav a { display: inline-block; padding: var(--s2) var(--s3); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.9375rem; font-weight: 500; text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { background: var(--surface-2); color: var(--text); }
.header-tools { display: flex; align-items: center; gap: var(--s2); margin-inline-start: auto; }
.lang-link {
  display: inline-flex; align-items: center; min-height: 2.5rem; padding-inline: var(--s3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.9375rem; font-weight: 500; text-decoration: none;
}
.lang-link:hover { background: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .i-moon { display: none; }
  :root:not([data-theme="light"]) .icon-btn .i-sun { display: block; }
}
@media (max-width: 719px) {
  .site-nav { order: 3; flex: 1 0 100%; margin: 0; }
  .site-nav ul { overflow-x: auto; }
}

/* Hero */
.hero { padding-block: calc(var(--s6) * 1.25) var(--s5); background: var(--surface); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--bg)); }
.hero .wrap { text-align: center; }
.hero h1 { max-width: 24ch; margin: 0 auto var(--s4); font-size: clamp(1.875rem, 4.8vw, 3.125rem); line-height: 1.1; letter-spacing: -0.025em; text-wrap: balance; }
.lead { max-width: 42rem; margin: 0 auto var(--s5); color: var(--text-muted); font-size: clamp(1.0625rem, 2vw, 1.25rem); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s3); margin: 0; padding: 0; list-style: none; }
.chips li { display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 0.9375rem; font-weight: 500; }
.chips .icon { color: var(--accent); }

/* The tool: a fixed-size frame so the app mounting later can never shift the page */
.tool { padding-bottom: var(--s5); }
.tool-frame { position: relative; height: clamp(32rem, 82vh, 50rem); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
#app-root { height: 100%; }
#app-root:empty::before { content: attr(data-loading); display: grid; place-items: center; height: 100%; color: var(--text-muted); }
#app-root[data-state="error"]:empty::before { content: attr(data-error); padding: var(--s5); text-align: center; color: var(--danger); }
:root:not(.js) #app-root { display: none; }
:root:not(.js) .tool-frame { height: auto; }
.noscript { margin: 0; padding: var(--s5); }

/* Advertising: space is reserved, the slot stays hidden until the visitor accepted ads (boot.js sets data-ads) */
.ad-slot { display: none; margin-block: var(--s5); }
html[data-ads="1"] .ad-slot { display: block; }
.ad-slot.is-unfilled { display: none !important; }
.ad-slot-top, .ad-slot-content { width: min(100% - var(--s4) * 2, 72rem); margin-inline: auto; }
.ad-slot-content { margin-block: var(--s6); }
.ad-label { display: block; margin-bottom: var(--s1); color: var(--text-muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ad-box { display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.ad-box ins { display: block; width: 100%; }
.ad-slot-top .ad-box { min-height: 100px; }
.ad-slot-content .ad-box { min-height: 280px; }
.ad-slot-sidebar .ad-box { min-height: 600px; }
.sidebar { display: none; }
@media (min-width: 1200px) {
  html[data-ads="1"] .sidebar { display: block; position: sticky; top: var(--s4); align-self: start; }
}

/* Content */
.content-grid { display: grid; grid-template-columns: minmax(0, 48rem); justify-content: center; gap: var(--s6); padding-block: var(--s5) var(--s6); }
@media (min-width: 1200px) {
  html[data-ads="1"] .content-grid.has-sidebar { grid-template-columns: minmax(0, 48rem) 18.75rem; }
}
.section { margin-block: var(--s6) 0; }
.section:first-child { margin-top: 0; }
.prose h2 { margin: 0 0 var(--s4); font-size: clamp(1.5rem, 2.8vw, 1.875rem); line-height: 1.2; letter-spacing: -0.015em; }
.prose h3 { margin: var(--s4) 0 var(--s2); font-size: 1.0625rem; line-height: 1.3; }
.prose p { margin: 0 0 var(--s4); }
.prose ul, .prose ol { margin: 0 0 var(--s4); padding-inline-start: 1.25rem; }
.prose li { margin-bottom: var(--s2); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-hover); }
.prose a.btn { color: var(--accent-contrast); text-decoration: none; }
.prose code { padding: 0.1em 0.35em; border-radius: var(--radius-sm); background: var(--surface-2); font-family: var(--font-mono); font-size: 0.875em; }
.lede { color: var(--text-muted); font-size: 1.125rem; }
.section h2 .icon-lg { width: 1.5rem; height: 1.5rem; margin-inline-end: var(--s2); vertical-align: -0.2em; color: var(--accent); }

.steps { display: grid; gap: var(--s4); margin: var(--s5) 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { counter-increment: step; margin: 0; padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.steps > li::before { content: counter(step); display: grid; place-items: center; width: 2rem; height: 2rem; margin-bottom: var(--s3); border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.steps h3 { margin: 0 0 var(--s2); }
.steps p { margin: 0; color: var(--text-muted); }
@media (min-width: 800px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}

.cards { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin: var(--s5) 0 0; padding: 0; list-style: none; }
.card { margin: 0; padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card > .icon { box-sizing: content-box; width: 1.375rem; height: 1.375rem; padding: var(--s2); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--accent); }
.card h3 { margin: var(--s3) 0 var(--s2); }
.card p { margin: 0; color: var(--text-muted); }

.panel { padding: var(--s5); border: 1px solid var(--border); border-inline-start: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.panel > :last-child, .callout > :last-child { margin-bottom: 0; }
.callout { padding: var(--s5); border-radius: var(--radius); background: var(--warning-bg); color: var(--warning-text); }
.callout h2 .icon-lg { color: inherit; }

.faq-item { margin-bottom: var(--s2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) var(--s5); font-weight: 600; list-style: none; cursor: pointer; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--accent); font-size: 1.5rem; font-weight: 400; line-height: 1; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { margin: 0; padding: 0 var(--s5) var(--s4); color: var(--text-muted); }

/* Legal and about pages */
.doc { width: min(100% - var(--s4) * 2, 48rem); padding-block: var(--s6); }
.doc-head { margin-bottom: var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--border); }
.doc h1 { margin: 0 0 var(--s2); font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.15; letter-spacing: -0.02em; }
.doc-meta { margin: 0; color: var(--text-muted); font-size: 0.9375rem; }
.doc .prose h2 { margin: var(--s6) 0 var(--s3); font-size: 1.375rem; }
.table-wrap { margin: 0 0 var(--s4); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { padding: var(--s2) var(--s3); border: 1px solid var(--border); text-align: start; vertical-align: top; }
th { background: var(--surface-2); }

.notfound { width: min(100% - var(--s4) * 2, 40rem); padding-block: calc(var(--s6) * 2); }
.notfound-code { margin: 0; color: var(--accent); font-size: 5rem; font-weight: 800; line-height: 1; }
.notfound h1, .notfound h2 { margin: var(--s3) 0; font-size: 1.75rem; line-height: 1.2; }
.notfound-block + .notfound-block { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--border); }

/* Footer */
.site-footer { margin-top: var(--s5); padding-block: var(--s6) var(--s5); border-top: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 0.9375rem; }
.footer-grid { display: grid; gap: var(--s5); }
@media (min-width: 720px) {
  .footer-grid { grid-template-columns: 1fr auto; align-items: start; }
}
.footer-name { margin: 0 0 var(--s1); color: var(--text); font-weight: 700; }
.footer-note { max-width: 32rem; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0; padding: 0; list-style: none; }
.footer-links a { color: var(--text); text-underline-offset: 3px; }
.footer-links a:hover { color: var(--accent); }
.footer-base { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--border); font-size: 0.875rem; }
.footer-base p { margin: 0; }

/* Consent notice */
.consent { position: fixed; inset-inline: 0; bottom: 0; z-index: 60; display: flex; justify-content: center; padding: var(--s3); pointer-events: none; }
.consent:focus { outline: none; }
.consent-card { width: min(100%, 46rem); max-height: calc(100vh - var(--s5)); overflow-y: auto; padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); pointer-events: auto; }
.consent p { margin: 0 0 var(--s4); }
.consent a { color: var(--accent); text-underline-offset: 3px; }
.consent-title { margin: 0 0 var(--s2); padding: 0; font-size: 1.0625rem; font-weight: 700; }
.consent-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.consent-actions .btn { flex: 1 1 9rem; }
.consent-options { display: grid; gap: var(--s3); margin: 0 0 var(--s4); padding: 0; border: 0; }
.consent-option { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }
.consent-option input { flex: none; width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; accent-color: var(--accent); }
.consent-hint { display: block; color: var(--text-muted); font-size: 0.9375rem; }

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