/* Public certificate page. Reward principles: the holder is the hero, the certificate is big and lit,
   sharing is present but quiet, verification is one scan away, evidence is one click deeper. */

.cert-page { background: var(--paper-2); }
.cert-page main { min-height: 100vh; }

/* ---------- Hero: status + certificate + brand bar, exactly one screen ---------- */
.cert-hero { display: flex; flex-direction: column; height: 100vh; height: 100svh; min-height: 480px; background: var(--ink); }
.cert-hero > .status, .cert-hero > .welcome, .cert-hero > .brandbar { flex: none; }
.brandbar { border-top: 1px solid var(--ink-line); color: var(--bone); }
.brandbar .wrap { display: flex; align-items: center; gap: 12px 20px; height: 56px; }
.brandbar-note { font-size: 14px; color: var(--bone-3); padding-left: 20px; border-left: 1px solid var(--ink-line); }
.brandbar-link { margin-left: auto; font-size: 15px; color: var(--bone-2); text-decoration: none; white-space: nowrap; }
.brandbar-link:hover { color: var(--bone); }
@media (max-width: 560px) { .brandbar-note { display: none; } }
@media (max-width: 480px) { .brandbar .logo-cat { display: none; } }
/* Without a certificate there is nothing to fill a screen. */
.cert-hero.empty { height: auto; min-height: 0; }

/* ---------- Status strip ---------- */
.status { color: var(--text); }
.status .wrap { display: flex; align-items: center; justify-content: space-between; gap: 6px 24px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.status .l { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status .lbl { font-family: var(--f-head); font-size: 21px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }
.status .txt { font-size: 16px; font-weight: 500; }
.status .r { font-size: 14px; }
.st-valid { background: var(--ok); }
.st-expired { background: var(--warn); }
.st-revoked, .st-missing { background: var(--bad); }

.welcome { background: var(--ink-2); color: var(--bone); border-bottom: 1px solid var(--ink-line); }
.welcome .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; font-size: 16px; }
.welcome b { font-weight: 600; }

/* ---------- Stage ---------- */
.stage { position: relative; overflow: hidden; color: var(--bone); flex: 1 1 auto; min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; padding: clamp(16px, 4vh, 48px) var(--pad); }
.stage::before { content: ''; position: absolute; left: 50%; top: -35%; width: min(1100px, 150%); aspect-ratio: 1; transform: translateX(-50%); background: radial-gradient(closest-side, color-mix(in oklch, var(--tier) 26%, transparent), transparent 70%); pointer-events: none; }
/* Europe behind the certificate, as on the landing hero: EU-27 hatched, centred on the certificate, fading out. */
.stage-map { position: absolute; left: 50%; top: 50%; width: max(1400px, 120%); max-width: none; height: auto; transform: translate(-49.54%, -62.54%); pointer-events: none; user-select: none; opacity: .45;
  -webkit-mask-image: radial-gradient(closest-side at 49.54% 62.54%, #000 55%, transparent); mask-image: radial-gradient(closest-side at 49.54% 62.54%, #000 55%, transparent); }
.stage-inner { position: relative; display: flex; align-items: center; justify-content: center; gap: 20px; }

/* Width = whatever fits: the stage's width minus the share rail, or its height × the A4 ratio. */
.cert-wrap { position: relative; perspective: 1400px; filter: drop-shadow(0 24px 40px oklch(0 0 0 / .5)); container-type: inline-size; width: min(1000px, 100cqw - 64px, 100cqh * 1.414); }
.certificate {
  --cut: 20px;
  position: relative; aspect-ratio: 1.414; display: flex; flex-direction: column; justify-content: space-between; gap: 1.5em;
  padding: 3em 3.4em 3.2em;
  background: linear-gradient(165deg, oklch(0.985 0.01 95), oklch(0.945 0.016 95));
  color: var(--text);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  transition: transform .25s ease-out;
  font-size: 1.56cqi; /* scales with the certificate, not the viewport */
}
.certificate::before { content: ''; position: absolute; inset: 1em; border: 1px solid color-mix(in oklch, var(--text) 22%, transparent); pointer-events: none; }
.certificate::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: .6em; background: var(--tier); }
/* Watermark: the same map printed into the paper, like security paper. z-index -1 keeps it under the content
   (the certificate's clip-path makes it a stacking context, so it stays above the paper).
   Central Europe (49.54% of the map) sits at the golden ratio, 61.8% from the left: with the map at 118% width,
   the x offset is (0.618 - 0.4954 × 1.18) / (1 - 1.18) = -18.6%. */
.c-map { position: absolute; z-index: -1; inset: 1em; pointer-events: none; background: var(--text); opacity: .14;
  -webkit-mask: url(../europe-map-print.svg) -18.6% 58% / 118% auto no-repeat; mask: url(../europe-map-print.svg) -18.6% 58% / 118% auto no-repeat; }
/* Silver foil, the technique of poke-holo's reverse holo (re-implemented): the watermark map is the foil. One broad
   dark–light–dark band slides across it with the pointer, modulated by a radial light at the pointer, and fades as the
   pointer nears the edges. Pointer vars come from certificate.js (eased); --holo is 0 until the pointer is over it. */
.c-foil { position: absolute; z-index: -1; inset: 1em; pointer-events: none;
  -webkit-mask: url(../europe-map-print.svg) -18.6% 58% / 118% auto no-repeat; mask: url(../europe-map-print.svg) -18.6% 58% / 118% auto no-repeat;
  background-image: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), #fff 5%, #000 50%, #fff 80%), linear-gradient(-45deg, oklch(0.3 0.01 240) 15%, oklch(0.97 0.004 240), oklch(0.3 0.01 240) 85%);
  background-blend-mode: soft-light; background-size: 120% 120%, 200% 200%;
  background-position: center, calc(100% * var(--px, .5)) calc(100% * var(--py, .5));
  opacity: clamp(0, var(--holo, 0) * (1.4 - var(--pfc, 0)), 1); }
/* Glare: a soft light over the whole sheet at the pointer, slightly darker towards the far corner. Inside the
   certificate, so it tilts with it and is clipped to its cut corners. */
.c-glare { position: absolute; z-index: 1; inset: 0; pointer-events: none; mix-blend-mode: overlay; opacity: calc(var(--holo, 0) * .45);
  background: radial-gradient(farthest-corner circle at var(--mx, 50%) var(--my, 50%), oklch(1 0 0 / .8) 10%, oklch(1 0 0 / .4) 25%, oklch(0 0 0 / .35) 95%); }

.c-top { display: flex; justify-content: space-between; align-items: center; gap: 1em; }
.c-top .logo-word { font-size: 1.4em; }
.c-top .logo-word span { color: oklch(0.5 0.02 120); }
.c-top .logo svg { width: 2.1em; height: auto; }
.c-eu { display: flex; align-items: center; gap: .6em; font-family: var(--f-head); font-weight: 700; font-size: 1.15em; letter-spacing: 0.08em; }
.c-eu .flag { width: 1.8em; height: auto; }
.c-mid { text-align: center; }
.c-kicker { font-family: var(--f-head); font-weight: 600; font-size: 1.05em; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-3); }
.c-name { margin: .35em 0 .1em; font-size: 5.6em; line-height: .92; letter-spacing: 0.01em; }
.c-name.long { font-size: 4.3em; }
.c-prod { font-size: 1.3em; color: var(--text-2); }
.c-tier { display: inline-flex; align-items: center; gap: .8em; margin-top: 1.4em; }
.c-tier svg { width: 3.6em; height: auto; }
.c-tier .t { font-family: var(--f-stencil); font-size: 2.8em; letter-spacing: 0.06em; line-height: 1; }
.c-tier .m { text-align: left; font-size: .95em; line-height: 1.35; color: var(--text-2); max-width: 13em; }
.c-bot { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.5em; align-items: end; }
.c-facts { display: grid; grid-template-columns: auto 1fr; gap: .2em .9em; font-size: .95em; }
.c-facts dt { color: var(--text-3); }
.c-facts dd { font-family: var(--f-mono); font-size: .92em; }
.c-sign { text-align: center; font-size: .9em; color: var(--text-2); }
.c-sign .line { display: block; min-width: 14em; margin-bottom: .4em; border-top: 1px solid var(--text); padding-top: .5em; font-family: var(--f-head); font-weight: 700; font-size: 1.25em; color: var(--text); }
.c-qr { justify-self: end; display: flex; flex-direction: column; align-items: center; gap: .4em; }
.c-qr svg { width: 6.2em; height: 6.2em; }
.c-qr span { font-size: .8em; color: var(--text-3); }

/* Small screens: the certificate becomes a card instead of a shrunken A4. */
@media (max-width: 640px) {
  .cert-hero { height: auto; min-height: 100svh; }
  .stage { container-type: normal; flex: 1 0 auto; }
  .stage-inner { width: 100%; }
  .cert-wrap { width: 100%; }
  .certificate { aspect-ratio: auto; font-size: 12px; padding: 2.2em 1.8em 2.4em; gap: 2em; }
  .c-top .logo-word { display: none; }
  .c-name { font-size: 3.6em; } .c-name.long { font-size: 2.8em; }
  .c-tier { flex-wrap: wrap; justify-content: center; }
  .c-tier .m { text-align: center; flex-basis: 100%; max-width: none; }
  .c-bot { grid-template-columns: 1fr auto; }
  .c-sign { display: none; }
}

/* Expired / revoked: visible, but clearly void. */
.void .certificate > :not(.stamp) { filter: grayscale(1); opacity: .45; }
.void .certificate::after { background: var(--paper-line); }
.stamp { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-10deg); font-family: var(--f-stencil); font-size: 7em; letter-spacing: 0.08em; color: var(--bad); border: .08em solid var(--bad); padding: 0 .3em; line-height: 1.1; pointer-events: none; }
.stamp.exp { color: var(--warn-ink); border-color: var(--warn-ink); }

/* ---------- Share rail ---------- */
.share { display: flex; flex-direction: column; gap: 6px; }
.share a, .share button { position: relative; display: grid; place-items: center; width: 44px; height: 44px; background: transparent; border: 1px solid var(--ink-line); color: var(--bone-3); cursor: pointer; transition: color .15s, border-color .15s; text-decoration: none; }
.share a:hover, .share button:hover { color: var(--bone); border-color: var(--bone-3); }
.share [data-tip]::after { content: attr(data-tip); position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 6px 9px; background: var(--bone); color: var(--text); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.share [data-tip]:hover::after, .share [data-tip]:focus-visible::after { opacity: 1; }
@media (max-width: 760px) {
  .stage-inner { flex-direction: column; gap: 14px; }
  .cert-wrap { width: min(100cqw, (100cqh - 58px) * 1.414); }
  .share { flex-direction: row; justify-content: center; }
  .share [data-tip]::after { display: none; }
}

/* ---------- Details ---------- */
.cd { padding: clamp(48px, 7vw, 80px) 0 0; }
.cd:last-child { padding-bottom: clamp(56px, 8vw, 96px); }
.cd h2 { font-size: clamp(28px, 3.4vw, 38px); }
.cd-lede { margin-top: 8px; color: var(--text-2); font-size: 17px; }
.narrow { max-width: 760px; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.kpi { padding: 20px; background: var(--paper); display: flex; flex-direction: column; gap: 4px; }
.kpi b { font-family: var(--f-head); font-size: clamp(32px, 4vw, 44px); line-height: 1; }
.kpi span { font-size: 15px; color: var(--text-2); }
.next { margin-top: 12px; padding: 18px 20px; background: var(--ink); color: var(--bone); }
.next-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 16px; color: var(--bone-2); }
.next-top b { color: var(--bone); }
.next-name { font-family: var(--f-stencil); letter-spacing: 0.05em; }
.prog { margin-top: 12px; height: 6px; background: var(--ink-3); }
.prog i { display: block; height: 100%; }
.record { margin-top: 20px; display: grid; gap: 0; border-top: 1px solid var(--paper-line); }
.record div { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 4fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--paper-line); font-size: 16px; }
.record dt { color: var(--text-3); }
@media (max-width: 560px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi { flex-direction: row; align-items: baseline; gap: 12px; } .record div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* Every check: one accordion row per held tier, styled like the landing page tier header; inside, the same
   domain groups as the landing page tier explorer (.req-grid / .req-group from site.css). */
.tiers-acc { margin-top: 20px; display: grid; gap: 8px; }
.tiers-acc summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 20px; gap: 4px 16px; align-items: center; padding: 14px clamp(16px, 2.5vw, 28px); background: var(--ink); color: var(--bone); border-top: 4px solid var(--tier); }
.tiers-acc summary::-webkit-details-marker { display: none; }
.tiers-acc summary::after { content: '+'; grid-column: 4; grid-row: 1 / span 2; font-family: var(--f-mono); font-size: 20px; transition: transform .2s; text-align: center; }
.tiers-acc details[open] summary::after { transform: rotate(45deg); }
.tiers-acc summary svg { grid-row: 1 / span 2; width: 40px; height: auto; }
.tiers-acc .nm { font-family: var(--f-stencil); font-size: clamp(20px, 2.4vw, 26px); letter-spacing: 0.05em; line-height: 1; color: var(--tier); }
.tiers-acc .sub { grid-column: 2; font-family: var(--f-head); font-weight: 600; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone-3); }
.tiers-acc .ct { grid-column: 3; grid-row: 1 / span 2; font-family: var(--f-mono); font-size: 14px; color: var(--bone-2); white-space: nowrap; }
.tiers-acc .ct.gap { color: var(--warn, var(--bone)); }
.tiers-acc .req-grid { padding: 12px 0 8px; }
.tiers-acc .mark { color: var(--ok-ink); }
.tiers-acc .is-gap .mark { color: var(--warn-ink); }
.tiers-acc .is-open .mark { color: var(--text-3); }
.tiers-acc .not-reached summary { background: var(--ink-2); }
.tiers-acc .not-reached summary svg, .tiers-acc .not-reached .nm { opacity: .6; }
.how { font-size: 13px; color: var(--text-3); white-space: nowrap; padding-top: 2px; }
.how-declared { font-style: italic; }
@media (max-width: 640px) {
  .cert-hero { height: auto; min-height: 100svh; }
  .stage { container-type: normal; flex: 1 0 auto; }
  .stage-inner { width: 100%; }
  .cert-wrap { width: 100%; } }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px clamp(32px, 6vw, 72px); }
@media (max-width: 860px) { .two { grid-template-columns: minmax(0, 1fr); } }
.subs { margin-top: 16px; border-top: 1px solid var(--paper-line); }
.subs li { display: grid; grid-template-columns: 10px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--paper-line); font-size: 16px; }
.subs .who { color: var(--text-3); font-size: 15px; }
@media (max-width: 480px) { .subs li { grid-template-columns: 10px minmax(0, 1fr); } .subs .who { grid-column: 2; } }
/* Audit log: full width, one row per step. Columns: date (once per day), event, what happened, who confirmed it. */
.log { margin-top: 20px; padding-bottom: 8px; border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); }
.log li { display: grid; grid-template-columns: 96px 104px minmax(0, 1fr) auto; gap: 16px; align-items: baseline; padding: 8px 0; font-size: 16px; }
.log li.day { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--paper-line); }
.log li:first-child { padding-top: 14px; }
.log .d { font-family: var(--f-mono); font-size: 14px; color: var(--text-3); }
.log .ev { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.log .ev-pass .ev, .log .ev-fixed .ev { color: var(--ok-ink); }
.log .ev-gap .ev { color: var(--warn-ink); }
.log .ev-fail .ev, .log .ev-revoked .ev { color: var(--bad); }
.log .ev-tier .e, .log .ev-revoked .e { font-weight: 600; }
.log .ev-tier .ev { color: var(--text); }
.log .how-tier { font-family: var(--f-stencil); font-size: 14px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--tier); filter: brightness(.8); }
.log-more { margin-top: 16px; }
@media (max-width: 640px) { .log li { grid-template-columns: 88px minmax(0, 1fr); gap: 2px 12px; } .log .e, .log .how { grid-column: 2; } .log .d { grid-row: span 3; } }
.cd-badge .two { align-items: center; }
.opts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.seg { display: inline-flex; border: 1.5px solid var(--text); }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-size: 15px; font-weight: 500; cursor: pointer; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bone); }
.code { position: relative; margin-top: 12px; background: var(--ink); }
.code pre { margin: 0; padding: 16px 18px; padding-right: 92px; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.6; color: var(--bone-2); white-space: pre-wrap; word-break: break-all; }
.code .btn { position: absolute; top: 10px; right: 10px; }
.badge-preview { --cut: 16px; display: flex; justify-content: center; align-items: center; min-height: 300px; padding: 32px 20px; }
.badge-preview.dark { background: var(--ink); }
.badge-preview.light { background: var(--paper); }

.missing { max-width: 680px; padding-top: clamp(48px, 8vw, 96px); padding-bottom: clamp(48px, 8vw, 96px); }
.missing h1 { font-family: var(--f-mono); font-weight: 500; text-transform: none; font-size: clamp(24px, 5vw, 40px); margin: 8px 0 16px; overflow-wrap: anywhere; }
.missing > p:not(.eyebrow) { font-size: 18px; color: var(--text-2); margin-bottom: 24px; }
.missing form { margin-bottom: 16px; }
.missing h1.plain { font-family: var(--f-head); font-weight: 700; text-transform: uppercase; font-size: clamp(36px, 5vw, 56px); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 18px; background: var(--bone); color: var(--text); font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 80; box-shadow: 0 10px 30px oklch(0 0 0 / .3); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

@media print {
  .status, .welcome, .share, .brandbar, #details, .site-footer, .toast, #confetti, .skip { display: none !important; }
  .cert-hero { height: auto; min-height: 0; background: #fff; }
  .stage { container-type: normal; }
  .cert-wrap { width: 100%; }
  .stage { background: #fff; padding: 0; }
  .stage::before { display: none; }
  .stage-inner { display: block; max-width: none; }
  .cert-wrap { filter: none; }
  .certificate { transform: none !important; font-size: 12px; }
  @page { size: A4 landscape; margin: 10mm; }
}

/* Phones last, so it wins over the tablet rule above. */
@media (max-width: 640px) { .cert-wrap { width: 100%; } }
@media (max-width: 640px) and (max-height: 700px) {
  .stage { padding-top: 12px; padding-bottom: 12px; }
  .stage-inner { gap: 10px; }
  .certificate { padding: 1.6em 1.6em 1.8em; gap: 1.4em; }
  .status .wrap { padding-top: 8px; padding-bottom: 8px; }
}

/* Server-rendered additions: open violations and the collapsed rest of the audit log. */
.violations { --cut: 10px; margin-top: 20px; padding: 16px 20px; background: color-mix(in oklch, var(--warn) 22%, var(--paper-2)); }
.violations h3 { font-family: var(--f-head); font-size: 18px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.violations li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 6px 0; font-size: 16px; }
.violations .due { font-size: 14px; color: var(--warn-ink); }
.log-more { margin-top: 16px; }
.log-more > summary { list-style: none; }
.log-more > summary::-webkit-details-marker { display: none; }
.log-more[open] > summary { display: none; }
.log-more > .log { margin-top: 0; border-top: 0; }
