/* Lucee on Lambda SnapStart: test-certificate look. One file, no build step. */
@font-face {
    font-family: "Archivo";
    src: url("/assets/archivo.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
}

:root {
    --paper: #e9f1e8;        /* security-paper ground */
    --sheet: #f9fcf8;        /* the certificate itself */
    --ink: #12241c;
    --ink-soft: #3b5247;     /* secondary text, tinted from the ink */
    --rule: #b4c8ba;
    --rule-strong: #12241c;
    --band: #0e3b2c;
    --band-ink: #e6f2ea;
    --stamp: #1c3fc4;        /* cobalt stamp ink: actions, focus, the stamp */
    --stamp-press: #152f95;
    --good: #17734a;
    --error: #a32117;
    --space: clamp(1rem, 0.6rem + 1.6vw, 1.75rem);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--band) var(--paper); }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1.0625rem/1.55 "Archivo", system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    caret-color: var(--stamp);
}

::selection { background: var(--stamp); color: #fff; }

.wrap { width: min(100% - 2 * var(--space), 68rem); margin-inline: auto; }

a { color: var(--stamp); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

code, .id { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
code { overflow-wrap: anywhere; background: color-mix(in srgb, var(--rule) 40%, transparent); padding: 0.1em 0.3em; border-radius: 3px; }

.skip { position: absolute; left: var(--space); top: -4rem; background: var(--sheet); color: var(--ink); padding: 0.75rem 1rem; z-index: 2; }
.skip:focus { top: 0.5rem; }

/* Header band */
.band { background: var(--band); color: var(--band-ink); }
.band-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 2rem; min-height: 4rem; padding-block: 0.5rem; }
.band a { color: inherit; text-decoration: none; }
.band :focus-visible { outline-color: var(--band-ink); }
.name { font-weight: 700; font-stretch: 88%; font-size: 1.125rem; letter-spacing: 0.01em; padding-block: 0.6rem; }
.band nav { display: flex; gap: 0.25rem; margin-inline: -0.75rem; }
.band nav a { padding: 0.65rem 0.75rem; border-radius: 3px; font-weight: 500; box-shadow: inset 0 -2px 0 transparent; transition: box-shadow 0.25s var(--ease), background-color 0.25s var(--ease); }
.band nav a:hover { background: rgb(255 255 255 / 0.1); }
.band nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--band-ink); font-weight: 700; }

/* The certificate sheet */
.sheet {
    background: var(--sheet);
    margin-block: var(--space) calc(var(--space) * 2);
    padding: clamp(1.25rem, 0.5rem + 3.5vw, 3.5rem);
    border: 1px solid var(--rule-strong);
    outline: 1px solid var(--rule-strong);
    outline-offset: -7px;
    box-shadow: 0 1px 2px rgb(18 36 28 / 0.08), 0 12px 32px -12px rgb(18 36 28 / 0.22);
}

.lead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space) clamp(1.5rem, 4vw, 4rem); align-items: start; }

h1 { font-size: clamp(1.9rem, 1.1rem + 3.2vw, 3.4rem); line-height: 1.04; font-weight: 750; font-stretch: 92%; letter-spacing: -0.022em; margin: 0 0 1rem; text-wrap: balance; max-width: 18ch; }
h1 .figure { color: var(--stamp); white-space: nowrap; }
.statement .actions { margin-top: 1.5rem; }
.statement p { margin: 0; max-width: 58ch; font-size: 1.125rem; color: var(--ink-soft); }

h2 { font-size: 1.3rem; line-height: 1.2; font-weight: 700; font-stretch: 92%; margin: 0 0 0.75rem; }
section { margin-top: clamp(2.25rem, 1.5rem + 3vw, 4rem); }

.note, .prose { color: var(--ink-soft); max-width: 68ch; margin: 0 0 1rem; }
.prose { color: var(--ink); }
.steps { padding-left: 1.25rem; }
.steps li + li { margin-top: 0.75rem; }

/* Stamp and serial */
.issue { display: grid; justify-items: center; gap: 0.75rem; width: min(100%, 15rem); }
.stamp { width: clamp(11rem, 6rem + 12vw, 13.5rem); height: auto; color: var(--stamp); transform: rotate(-7deg); mix-blend-mode: multiply; }
.stamp-local { color: var(--ink); }   /* cobalt marks only a real restore */
.serial { margin: 0; text-align: center; }
.serial dt { font-size: 0.8rem; font-weight: 600; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.serial dd { margin: 0.15rem 0 0; font-size: 0.78rem; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: no-preference) {
    .stamp { animation: press 0.7s var(--ease) 0.15s backwards; }
    @keyframes press {
        from { opacity: 0; transform: rotate(-16deg) scale(1.55); filter: blur(5px); }
        55% { opacity: 1; }
        to { opacity: 1; transform: rotate(-7deg) scale(1); filter: blur(0); }
    }
    .mark[data-state] span { animation: ink 0.5s var(--ease) backwards; animation-delay: calc(0.5s + var(--i, 0) * 60ms); }
    @keyframes ink { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0); } }
}

/* Value tables */
.values { width: 100%; border-collapse: collapse; border-top: 2px solid var(--rule-strong); border-bottom: 2px solid var(--rule-strong); }
.values th, .values td { text-align: left; vertical-align: baseline; padding: 0.7rem 1rem 0.7rem 0; border-bottom: 1px solid var(--rule); }
.values tbody tr:last-child > * { border-bottom: 0; }
.values thead th { font-size: 0.8rem; font-weight: 600; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); border-bottom: 1px solid var(--rule-strong); padding-block: 0.5rem; }
.values thead code { text-transform: none; letter-spacing: 0; background: none; padding: 0; font-size: 0.95em; }
.values tbody th { font-weight: 600; white-space: nowrap; }
.values td { color: var(--ink-soft); }
.values .num, .values .id { color: var(--ink); font-weight: 500; }
.values .id { overflow-wrap: anywhere; font-weight: 400; }
.values tbody tr { transition: background-color 0.2s var(--ease); }
.values tbody tr:hover { background: color-mix(in srgb, var(--paper) 70%, transparent); }
.values .empty td { color: var(--ink-soft); padding-block: 1.5rem; }
.mark-col, .mark { width: 8.5rem; padding-right: 0 !important; text-align: right !important; white-space: nowrap; }
.mark span { display: inline-block; font-size: 0.8rem; font-weight: 700; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.1rem 0.45rem; }
.mark[data-state="changed"] span { background: var(--ink); color: var(--sheet); }
.mark[data-state="same"] span { color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--rule); }
.values:not([data-compared]) .mark-col, .values:not([data-compared]) .mark { display: none; }
.dupe { background: color-mix(in srgb, var(--error) 14%, transparent); }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.25rem; }
.actions-top { margin: 0 0 1.25rem; }
.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: 0.6rem 1.25rem;
    font: inherit; font-weight: 650; font-stretch: 92%; color: #fff; background: var(--stamp);
    border: 1px solid var(--stamp); border-radius: 3px; text-decoration: none; cursor: pointer;
    transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.button:hover, .button:active { background: var(--stamp-press); border-color: var(--stamp-press); }
.button[disabled] { background: var(--ink-soft); border-color: var(--ink-soft); cursor: progress; }
.button-quiet { background: transparent; color: var(--stamp); }
.button-quiet:hover, .button-quiet:active { background: color-mix(in srgb, var(--stamp) 10%, transparent); color: var(--stamp-press); }
.status { margin: 0; color: var(--ink-soft); }
.status[data-state="bad"] { color: var(--error); font-weight: 600; }
.status[data-state="good"] { color: var(--good); font-weight: 600; }

/* Cold-start scale */
.scale { margin: 0; display: grid; gap: 1rem; }
.scale dt { font-weight: 600; margin-bottom: 0.3rem; }
.scale dd { margin: 0; display: flex; align-items: center; gap: 0.75rem; }
.scale .bar { flex: 0 0 auto; width: calc((100% - 7.5rem) * var(--f)); min-width: 3px; height: 1.4rem; background: var(--ink); }
.scale .bar-good { background: var(--good); }
.scale .num { white-space: nowrap; font-weight: 600; }
/* Form */
.form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; }
.field { flex: 1 1 16rem; max-width: 26rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.field input { width: 100%; min-height: 2.9rem; padding: 0.55rem 0.75rem; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--rule-strong); border-radius: 3px; transition: box-shadow 0.18s var(--ease); }
.field input:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--stamp) 14%, transparent); }
.field input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.error { flex: 1 1 100%; color: var(--error); font-weight: 600; margin: -0.4rem 0 0; }
.received .values tbody th { width: 12rem; }

/* Images page */
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--space); margin-bottom: 1.5rem; }
.pair img { display: block; width: 100%; height: auto; background: var(--paper); }

/* Footer */
.foot { color: var(--ink-soft); font-size: 0.95rem; padding-bottom: calc(var(--space) * 2); }
.foot p { margin: 0 0 0.35rem; max-width: 75ch; }

/* What this page cost: one line above every page, filled in by site.js */
.timing { margin: var(--space) 0 0; padding: 0.7rem 1rem; background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--stamp); font-variant-numeric: tabular-nums; }
.timing strong { font-weight: 700; }
.timing + .sheet { margin-top: calc(var(--space) * 0.6); }

/* Architecture: a box on the home page, and the diagrams page */
.box { display: block; margin-top: clamp(2.25rem, 1.5rem + 3vw, 4rem); padding: 1.25rem 1.5rem; border: 1px solid var(--rule-strong); color: var(--ink); text-decoration: none; transition: background-color 0.2s var(--ease); }
.box:hover { background: color-mix(in srgb, var(--paper) 70%, transparent); }
.box h2 { margin: 0 0 0.35rem; color: var(--stamp); }
.box p { margin: 0; color: var(--ink-soft); max-width: 68ch; }
.diagram { margin: 1.25rem 0 0; }
.diagram a { display: block; border: 1px solid var(--rule); background: #fff; }
.diagram img { display: block; width: 100%; height: auto; }
.diagram figcaption { margin-top: 0.4rem; font-size: 0.9rem; color: var(--ink-soft); }

/* Narrow screens: the certificate stacks, tables become labelled rows */
@media (max-width: 46rem) {
    .lead { grid-template-columns: 1fr; }
    .issue { justify-self: start; justify-items: start; width: auto; }
    .serial { text-align: left; }
    h1 { max-width: none; }
    .values thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .values tr { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.75rem; padding-block: 0.7rem; border-bottom: 1px solid var(--rule); }
    .values tbody tr:last-child { border-bottom: 0; }
    .values th, .values td { display: block; padding: 0; border: 0; white-space: normal !important; }
    .values tbody th { grid-column: 1; }
    .values td { grid-column: 1 / -1; }
    .values .mark { grid-column: 2; grid-row: 1; width: auto; }
    .values td[data-label]::before { content: attr(data-label) ": "; font-family: "Archivo", system-ui, sans-serif; font-size: 1rem; font-weight: 600; color: var(--ink-soft); }
    .received .values tbody th { width: auto; }
    .button { flex: 1 1 100%; }
    .band nav a { padding-inline: 0.6rem; }
}

@media (min-width: 64rem) {
    .values[data-compare] .id { white-space: nowrap; }
}
