/* Shared design system for every page under public/ (served at /auth.css, no build step, no external resources).
   Light and dark through prefers-color-scheme. Accent is a blue that recalls Hermes (owner's choice) without copying its brand colour; the pages say the service is independent.
   Contrast (WCAG AA, checked): text >= 6.1:1, accent text >= 4.9:1 light / 6.3:1 dark, --on-accent on --accent 5.8:1 / 8.6:1,
   input borders (--border-strong) >= 3.7:1. */
:root {
  --bg: #f3f6f9; --surface: #ffffff; --fg: #121c26; --muted: #4a5868;
  --border: #c9d4df; --border-strong: #6b7a8a;
  --accent: #006aa6; --on-accent: #ffffff; --accent-soft: #e1eef7; --accent-hover: #00527f;
  --ok: #17663a; --ok-bg: #e3f4ea; --err: #b3261e; --err-bg: #fbe9e7; --warn: #7a4f00; --warn-bg: #fff1d6;
  --code-bg: #e8eef4; --ink: #0e1a26; --on-ink: #e3ecf4; --ink-muted: #9fb0c2; --ink-accent: #4cb8f0;
  --focus: #006aa6; --shadow: 0 1px 2px rgb(14 26 38 / .06), 0 8px 24px rgb(14 26 38 / .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-sm: .875rem; --fs-base: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;
  --fs-3xl: clamp(2.2rem, 1.2rem + 4.6vw, 3.6rem);
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2.5rem; --s-7: 4.5rem;
  --r-sm: 6px; --r-md: 10px; --r-lg: 18px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c131b; --surface: #131e29; --fg: #e3ecf4; --muted: #9fb0c2;
    --border: #2a3a4a; --border-strong: #607a92;
    --accent: #5cbdf2; --on-accent: #04182a; --accent-soft: #12324a; --accent-hover: #8fd2f7;
    --ok: #72dca0; --ok-bg: #12301f; --err: #ff9a90; --err-bg: #3b1916; --warn: #f2c25c; --warn-bg: #3a2d0d;
    --code-bg: #1a2a39; --ink: #08101a; --focus: #5cbdf2; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: var(--fs-base)/1.6 var(--font); overflow-wrap: break-word; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--s-3); letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s-3); }
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { color: var(--accent-hover); }
ul, ol { padding-left: 1.3rem; margin: 0 0 var(--s-3); }
code, pre, kbd { font-family: var(--mono); }
code { background: var(--code-bg); padding: .08em .35em; border-radius: var(--r-sm); font-size: .9em; }
pre { background: var(--ink); color: var(--on-ink); padding: var(--s-4); border-radius: var(--r-md); overflow-x: auto; font-size: var(--fs-sm); line-height: 1.55; margin: var(--s-3) 0; }
pre code { background: none; padding: 0; font-size: inherit; }
.muted { color: var(--muted); font-size: var(--fs-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-3); top: -4rem; background: var(--accent); color: var(--on-accent); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); z-index: 10; }
.skip:focus { top: var(--s-3); }
.skip, .skip:hover { color: var(--on-accent); }

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

/* Layout */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--s-4); }
main.page { max-width: 460px; margin: 0 auto; padding: var(--s-5) var(--s-4) var(--s-7); }
main.page.wide { max-width: 720px; }
main.page.xwide { max-width: 980px; }
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding-top: var(--s-3); padding-bottom: var(--s-3); }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 700; color: var(--fg); text-decoration: none; }
.brand:hover { color: var(--accent); }
.brand img { width: 1.6rem; height: 1.6rem; flex: none; }
.nav { display: flex; gap: var(--s-1) var(--s-4); flex-wrap: wrap; align-items: center; font-size: var(--fs-sm); }
.nav a { color: var(--fg); text-decoration: none; padding: var(--s-1) 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--accent); color: var(--fg); }
.nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.nav a.btn { color: var(--on-accent); padding: .25rem .75rem; border: 1px solid var(--accent); }
.nav a.btn:hover { color: var(--on-accent); border-color: var(--accent-hover); }
.site-footer { border-top: 1px solid var(--border); padding: var(--s-5) 0 var(--s-6); font-size: var(--fs-sm); color: var(--muted); }
.site-footer .nav { margin-bottom: var(--s-3); }

/* Cards, sections */
.card, main.page > section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-5); }
main.page > section + section { margin-top: var(--s-4); }
@media (max-width: 480px) { .card, main.page > section { padding: var(--s-4); } }
section h2 { margin-bottom: var(--s-3); }
.stack > * + * { margin-top: var(--s-4); }

/* Forms */
label, legend { display: block; font-size: var(--fs-sm); color: var(--muted); margin: var(--s-3) 0 var(--s-1); font-weight: 500; }
label.check { display: flex; gap: var(--s-2); align-items: center; color: var(--fg); font-size: var(--fs-base); margin: var(--s-2) 0; }
label.check input { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--accent); flex: none; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-height: 2.75rem; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--fg); }
input[type=radio] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
textarea { min-height: 6rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-2) var(--s-4) var(--s-4); margin: var(--s-4) 0 0; min-width: 0; }
legend { padding: 0 var(--s-2); font-weight: 600; color: var(--fg); }
.grid-2, .grid-auto { display: grid; gap: 0 var(--s-3); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
.radios { display: flex; gap: var(--s-4); padding-top: var(--s-2); }
.radios label { display: flex; align-items: center; gap: var(--s-2); color: var(--fg); font-size: var(--fs-base); margin: 0; }

/* Buttons */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 2.75rem; padding: .5rem 1.1rem; border: 1px solid var(--accent); border-radius: var(--r-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, transform .15s; }
button:hover:not(:disabled), .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button:active:not(:disabled) { transform: translateY(1px); }
button.secondary, .btn.secondary { background: transparent; color: var(--accent); }
button.secondary:hover:not(:disabled), .btn.secondary:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
button.danger { background: transparent; color: var(--err); border-color: var(--err); }
button.danger:hover:not(:disabled) { background: var(--err-bg); color: var(--err); border-color: var(--err); }
button.sm, .btn.sm { min-height: 2.25rem; padding: .25rem .75rem; font-size: var(--fs-sm); }
.btn.lg { min-height: 3.1rem; padding: .65rem 1.5rem; font-size: var(--fs-lg); }
button:disabled { opacity: .6; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; margin-top: var(--s-4); }
button[aria-busy="true"]::before, .loading::before { content: ""; width: 1em; height: 1em; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.loading::before { display: inline-block; vertical-align: -.15em; margin-right: var(--s-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Status messages (info / ok / err / loading); empty ones are hidden */
.msg { margin: var(--s-3) 0 0; padding: var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); }
.msg:empty { display: none; }
.msg.info { border-color: var(--accent); background: var(--accent-soft); }
.msg.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.msg.err { border-color: var(--err); background: var(--err-bg); color: var(--err); }
.msg.warn, .notice { border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: var(--r-sm); padding: var(--s-3); }
.notice { margin: 0 0 var(--s-4); font-size: var(--fs-sm); }
.err { color: var(--err); }
.ok { color: var(--ok); }

/* Badges (job status etc.) */
.badge { display: inline-block; padding: .1rem .6rem; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.badge.st-done, .badge.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.badge.st-failed, .badge.st-cancelled, .badge.bad { color: var(--err); border-color: var(--err); background: var(--err-bg); }
.badge.st-running { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge.st-queued { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }

/* Tables: the wrapper scrolls, never the page */
.table-wrap { overflow-x: auto; margin: var(--s-2) 0; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { text-align: left; padding: var(--s-2) var(--s-2); border-bottom: 1px solid var(--border); vertical-align: middle; }
td .badge { white-space: nowrap; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap td { white-space: nowrap; }

/* One-time secrets (new API key, callback secret) */
.secret-box { margin-top: var(--s-4); padding: var(--s-4); border: 2px solid var(--accent); border-radius: var(--r-md); background: var(--accent-soft); }
.secret-box strong { display: block; margin-bottom: var(--s-2); }
code.secret { display: block; padding: var(--s-3); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: var(--fs-base); word-break: break-all; user-select: all; }
.secret-box .actions { margin-top: var(--s-3); }
.copied { font-weight: 600; color: var(--ok); }

/* Job log */
ul.log { list-style: none; padding: 0; margin: var(--s-3) 0 0; font-size: var(--fs-sm); color: var(--muted); }
ul.log li { padding: .1rem 0; }
ul.log li.err { color: var(--err); }

/* Legal pages / long text */
.prose { max-width: 70ch; }
.prose h2 { margin-top: var(--s-5); }
.prose dt { font-weight: 600; }
.prose dd { margin: 0 0 var(--s-3); overflow-wrap: anywhere; }
.placeholder { border: 2px dashed var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: var(--r-md); padding: var(--s-4); margin: var(--s-4) 0; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button[aria-busy="true"]::before, .loading::before { animation: none !important; border-right-color: currentColor; border-style: dotted; }
}

/* ---------- Landing page ---------- */
.hero { padding: var(--s-6) 0 var(--s-7); background:
  radial-gradient(60rem 30rem at 85% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--s-6); align-items: center; }
.hero h1 { font-size: var(--fs-3xl); font-weight: 780; letter-spacing: -.025em; line-height: 1.05; margin-bottom: var(--s-4); max-width: 14ch; }
.hero .lead { font-size: var(--fs-lg); color: var(--muted); max-width: 52ch; }
.hero .actions { margin-top: var(--s-5); }
.hero .facts { list-style: none; padding: 0; margin: var(--s-5) 0 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--fs-sm); color: var(--muted); }
.hero .facts li::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: var(--s-2); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding: var(--s-5) 0 var(--s-6); } }

/* Hero mockup: a terminal request, then the label comes out. Base styles are the final state; keyframes only set the start. */
.printer { display: grid; gap: var(--s-4); justify-items: center; }
.term { width: 100%; background: var(--ink); color: var(--on-ink); border-radius: var(--r-md); box-shadow: var(--shadow); font: var(--fs-sm)/1.7 var(--mono); padding: var(--s-4); overflow: hidden; }
.term .t-line { display: block; white-space: pre-wrap; word-break: break-all; animation: line-in .4s ease both; }
.term .t-line:nth-child(1) { animation-delay: .2s; } .term .t-line:nth-child(2) { animation-delay: .8s; }
.term .t-line:nth-child(3) { animation-delay: 1.4s; } .term .t-line:nth-child(4) { animation-delay: 2s; }
.term .t-dim { color: var(--ink-muted); } .term .t-ok { color: var(--ink-accent); }
@keyframes line-in { from { opacity: 0; transform: translateY(4px); } }
/* Label mockup: the layout of a real Hermes AT label (100x150 mm), placeholder data, no logos.
   Sized in container units so it scales as one picture. */
.label-mock { width: min(16rem, 74%); aspect-ratio: 2 / 3; container-type: inline-size; background: #fff; color: #111; border-radius: 3px;
  box-shadow: var(--shadow); animation: print 1.2s 2.4s cubic-bezier(.3, .7, .2, 1) both; }
/* cqw on the container itself would resolve against the viewport, so size and padding live on the inner sheet. */
.label-mock .lm-sheet { height: 100%; overflow: hidden; padding: 4cqw 5cqw 3cqw; display: flex; flex-direction: column; font: 3.4cqw/1.2 Arial, "Helvetica Neue", Helvetica, sans-serif; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-1.5rem); } }
.label-mock p { margin: 0; }
.label-mock svg { display: block; width: 100%; height: 100%; fill: #111; }
.label-mock .lm-cap { font-size: 2.6cqw; }
.label-mock .lm-row { display: flex; justify-content: space-between; gap: 3cqw; border-top: .5cqw solid #111; padding-top: .8cqw; }
.label-mock .lm-sender { min-height: 17cqw; }
.label-mock .lm-sender > div:first-child { flex: 1; }
.label-mock .lm-sender > div:last-child { width: 34cqw; display: flex; flex-direction: column; gap: 1.5cqw; }
.label-mock .lm-center { text-align: center; }
.label-mock .lm-ref { border-top: .5cqw solid #111; border-bottom: .5cqw solid #111; text-align: right; font-size: 2.6cqw; padding: 3.5cqw 8cqw .6cqw 0; }
.label-mock .lm-recv { border-top: 0; margin-top: 1cqw; }
.label-mock .lm-addr { font-size: 4.3cqw; line-height: 1.25; margin-top: .6cqw; }
.label-mock .lm-weight { font-size: 4cqw; white-space: nowrap; }
.label-mock .lm-dm { width: 7.5cqw; height: 7.5cqw; margin: 1cqw auto 1.2cqw; }
.label-mock .lm-code { position: relative; border-top: .9cqw solid #111; padding: 1.2cqw 0 1.5cqw 14cqw; }
.label-mock .lm-route { display: block; font-size: 5.4cqw; }
.label-mock .lm-vert { position: absolute; left: 1cqw; top: 6cqw; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 5.6cqw; }
.label-mock .lm-block { position: absolute; left: 1.5cqw; top: 27cqw; width: 6cqw; height: 6cqw; background: #111; }
.label-mock .lm-bars { height: 24cqw; margin-top: .6cqw; }
.label-mock .lm-digits { display: block; font-size: 3cqw; margin-top: .6cqw; padding-left: 4cqw; word-spacing: .4em; }
.label-mock .lm-digits b { font-weight: 400; font-size: 4.2cqw; }
.label-mock .lm-drop { border-top: .5cqw solid #111; font-size: 4.8cqw; padding-top: 1cqw; }
.label-mock .lm-foot { display: grid; grid-template-columns: 1fr auto 20cqw; grid-template-areas: "p p p" "n m q"; gap: .5cqw 3cqw; align-items: end; margin-top: .5cqw; flex: 1; }
.label-mock .lm-product { grid-area: p; justify-self: end; font-size: 4.8cqw; }
.label-mock .lm-note { grid-area: n; font-size: 2.4cqw; align-self: center; }
.label-mock .lm-mid { grid-area: m; display: flex; flex-direction: column; align-items: flex-end; gap: 1cqw; font-size: 4.2cqw; }
.label-mock .lm-qr { grid-area: q; aspect-ratio: 1; }
.label-mock .lm-keep { border: .5cqw solid #111; border-top: 0; font-size: 4.4cqw; padding: .6cqw 0 0 4cqw; margin-top: 1.5cqw; }
.mock-caption { margin: calc(-1 * var(--s-2)) 0 0; max-width: 18rem; text-align: center; font-size: var(--fs-sm); color: var(--muted); }

.section { padding: var(--s-7) 0 0; }
.section > .wrap > h2 { font-size: var(--fs-2xl); max-width: 24ch; }
.section .intro { color: var(--muted); max-width: 60ch; font-size: var(--fs-lg); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: var(--s-5) var(--s-6); margin-top: var(--s-5); }
.features article { border-top: 2px solid var(--border); padding-top: var(--s-3); transition: border-color .2s; }
.features article:hover { border-top-color: var(--accent); }
.features h3 { margin-bottom: var(--s-2); }
.features p { color: var(--muted); font-size: var(--fs-sm); margin: 0; }

.steps { list-style: none; padding: 0; margin: var(--s-5) 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); position: relative; counter-reset: step; }
.steps::before { content: ""; position: absolute; left: 1.2rem; right: 1.2rem; top: 1.2rem; height: 2px; background: var(--accent); opacity: .35; transform-origin: left; }
.steps.in::before { animation: draw 1.2s .2s ease-out both; }
@keyframes draw { from { transform: scaleX(0); } }
.steps > li { position: relative; counter-increment: step; min-width: 0; }
.steps > li::before { content: counter(step); display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; position: relative; margin-bottom: var(--s-3); }
.steps h3 { margin-bottom: var(--s-2); }
.steps p { color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } .steps::before { display: none; } }
.code-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-5); }
.code-pair > div { min-width: 0; }
.code-pair h3 { font-size: var(--fs-base); }
@media (max-width: 860px) { .code-pair { grid-template-columns: 1fr; } }

.pills { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pills li { padding: .15rem .65rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--fs-sm); }

details.faq { border-top: 1px solid var(--border); padding: var(--s-3) 0; }
details.faq:last-of-type { border-bottom: 1px solid var(--border); }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-1) 0; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3em; line-height: 1; transition: transform .2s; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq p { margin: var(--s-2) 0 0; color: var(--muted); max-width: 70ch; }

@media (max-width: 600px) { .nav .hide-sm { display: none; } }
.section.last { padding-bottom: var(--s-7); }
.disclaimer { margin-top: var(--s-6); font-size: var(--fs-sm); color: var(--muted); max-width: 70ch; }

/* Scroll-in: content is visible without JS; the script adds .js on <html> and .in when an element enters the view. */
.js .reveal { opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; } }
#rates-more { margin-top: var(--s-3); }
