/*
 * hanko-verify - attestation portal stylesheet.
 *
 * No CSS framework, no external font. System font stack stays
 * neutral across iOS / Android / desktop. Single column,
 * mobile-first (QR scans land on phones). Icons are inline SVG
 * so the page ships zero web requests beyond the Rekor JSON
 * call.
 *
 * Visual posture: "calm certificate". Cream + navy + gold
 * palette evokes attestation/notarisation without going gaudy.
 * Cards carry a thin double-frame and a small rosette stamp in
 * the corner when they confirm authenticity. The hero is a
 * centred medallion with an optional ribbon banner above it
 * (gold ribbon when status=ok). Hex hashes stay tucked into
 * copyable chips so a wall of mono-text never crashes the eye.
 */

* { box-sizing: border-box; }

:root {
  --bg:           #f1ece1;        /* warm cream wash */
  --surface:     #fffdf6;         /* paper white */
  --surface-soft:#f7f2e4;
  --ink:         #1a1b1f;
  --ink-soft:    #2f323a;
  --ink-muted:   #6c727f;
  --ink-faint:   #a09a86;
  --hairline:    #e6dfca;
  --hairline-2:  #d5cbab;
  --accent:      #15528d;
  --accent-soft: #e8eef8;
  --gold:        #997324;
  --gold-deep:   #6c4f12;
  --gold-soft:   #f4e8c4;
  --gold-line:   #c8a85a;
  --ok:          #137a3a;
  --ok-soft:     #ebf6ef;
  --warn:        #8e6300;
  --warn-soft:   #fbf3e0;
  --err:         #99182a;
  --err-soft:    #fbecee;
  --radius:      12px;
  --radius-sm:   6px;
  --shadow:      0 1px 2px rgba(31, 23, 8, 0.05),
                 0 8px 24px rgba(31, 23, 8, 0.04);
}

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 50% -10%, #fbf7eb 0, var(--bg) 600px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Page header ---------------------------------------------- */

header.site {
  max-width: 880px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 1.5rem;
  text-align: center;
}
header.site .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: var(--ink);
}
header.site .brand-mark {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  border: 1px solid var(--gold-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
header.site .brand-mark svg { width: 18px; height: 18px; }
header.site .brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
header.site .subtitle {
  display: inline-block;
  margin-top: 0.45rem;
  color: var(--gold-deep);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
header.site .subtitle::before,
header.site .subtitle::after {
  content: "";
  display: inline-block;
  width: 1.5rem;
  height: 1px;
  background: var(--gold-line);
  vertical-align: middle;
  margin: 0 0.6rem;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ---- Hero medallion ------------------------------------------- */

.hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.4rem;
  margin-top: 0.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

/* Inner double-line frame: classic certificate look. */
.hero .hero-frame {
  position: relative;
  padding: 1.6rem 1rem 0.9rem;
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) - 4px);
}
.hero .hero-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) - 8px);
  pointer-events: none;
  opacity: 0.55;
}

/* Hero ribbon banner: above the frame, gold by default. */
.hero .hero-ribbon {
  position: absolute;
  top: -0.7rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
  padding: 0.28rem 1.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  background: var(--gold-soft);
  color: var(--gold-deep);
  border: 1px solid var(--gold-line);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(31, 23, 8, 0.05);
}
.hero .hero-ribbon::before,
.hero .hero-ribbon::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  transform: translateY(-50%) rotate(45deg);
}
.hero .hero-ribbon::before { left: -7px; }
.hero .hero-ribbon::after  { right: -7px; }

/* Medallion icon sits centred above the title. */
.hero .hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 78px; height: 78px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--hairline);
  margin: 0 auto 0.85rem;
  position: relative;
}
.hero .hero-icon::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  opacity: 0.6;
  pointer-events: none;
}
.hero .hero-icon svg { width: 56px; height: 56px; }
.hero .hero-text { display: block; }
.hero .hero-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.hero .hero-title::before,
.hero .hero-title::after {
  content: "";
  display: inline-block;
  width: 1.4rem;
  height: 1px;
  background: var(--gold-line);
}
.hero .hero-sub {
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin: 0.2rem 0 0;
}

/* Status variants. Tinted medallion bg + ribbon palette switch. */
.hero.status-pending .hero-icon { background: var(--hairline); color: var(--ink-muted); border-color: var(--hairline-2); }
.hero.status-pending .hero-ribbon { background: var(--surface-soft); color: var(--ink-muted); border-color: var(--hairline-2); }
.hero.status-pending .hero-ribbon::before,
.hero.status-pending .hero-ribbon::after { background: var(--surface-soft); border-color: var(--hairline-2); }

.hero.status-ok .hero-icon { background: var(--gold-soft); color: var(--gold-deep); border-color: var(--gold-line); }
.hero.status-ok .hero-ribbon { background: var(--gold); color: #fffdf2; border-color: var(--gold-deep); }
.hero.status-ok .hero-ribbon::before,
.hero.status-ok .hero-ribbon::after { background: var(--gold); border-color: var(--gold-deep); }

.hero.status-warn .hero-icon { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.hero.status-warn .hero-ribbon { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.hero.status-warn .hero-ribbon::before,
.hero.status-warn .hero-ribbon::after { background: var(--warn-soft); border-color: var(--warn); }

.hero.status-err .hero-icon { background: var(--err-soft); color: var(--err); border-color: var(--err); }
.hero.status-err .hero-ribbon { background: var(--err-soft); color: var(--err); border-color: var(--err); }
.hero.status-err .hero-ribbon::before,
.hero.status-err .hero-ribbon::after { background: var(--err-soft); border-color: var(--err); }

.hero.status-info .hero-icon { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.hero.status-info .hero-ribbon { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.hero.status-info .hero-ribbon::before,
.hero.status-info .hero-ribbon::after { background: var(--accent-soft); border-color: var(--accent); }

/* ---- Generic card --------------------------------------------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}

/* (No corner seal stamp - kept the class as a marker but visuals removed.) */

.card-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 1.05rem;
}
.card-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.card-head .head-icon {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gold-soft);
  color: var(--gold-deep);
  border: 1px solid var(--gold-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card-head .head-icon svg { width: 18px; height: 18px; }
.card-head .head-meta {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.card-section {
  margin-top: 1.25rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--hairline);
  position: relative;
}
.card-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.card-section h3 {
  margin: 0 0 0.85rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--gold-deep);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.card-section h3::before {
  content: "";
  flex: 0 0 auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-line);
  box-shadow: 0 0 0 2px var(--gold-soft);
}

/* ---- Key-value pairs ------------------------------------------ */

dl.kv {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.55rem 1.25rem;
  margin: 0;
}
dl.kv dt {
  color: var(--ink-muted);
  font-size: 0.86rem;
  align-self: start;
  padding-top: 1px;
}
dl.kv dd {
  margin: 0;
  word-break: break-word;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
/* Mono values are always rendered as a chipped box (like the hash chips)
   so technical text reads as a token, not as inline body copy. Wrap the
   value in `<span class="mono-box">` inside the dd; the dd's legend
   ::after sits below the box, unboxed. */
.mono-box {
  display: inline-block;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.22rem 0.55rem;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
  color: var(--ink-soft);
  max-width: 100%;
  word-break: break-all;
}

/* Per-field legend rendered via [data-legend] attr. Pseudo-element so
   the dynamic value (set via textContent / innerHTML in verify.js)
   can replace any inner DOM without wiping the legend. Sans-serif and
   muted regardless of whether the value above is mono. */
dl.kv dd[data-legend]::after {
  content: attr(data-legend);
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.74rem;
  font-weight: 400;
  font-style: normal;
  color: var(--ink-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  max-width: 38rem;
}
dl.kv dd[data-legend=""]::after { content: none; }

@media (max-width: 540px) {
  dl.kv { grid-template-columns: 1fr; gap: 0.1rem 0; }
  dl.kv dt { margin-top: 0.55rem; font-size: 0.8rem; }
  dl.kv dd[data-legend]::after { font-size: 0.72rem; }
}

/* `hidden` HTML attribute needs to override our grid display. */
[hidden] { display: none !important; }

/* ---- Hex / hash rendering ------------------------------------- */

.hash {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  max-width: 100%;
  word-break: break-all;
  flex-wrap: wrap;
}
.hash .hash-text  { color: var(--ink-soft); flex: 1 1 auto; min-width: 0; }
.hash button.copy {
  background: none;
  border: 0;
  padding: 2px;
  cursor: pointer;
  color: var(--ink-faint);
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  flex: 0 0 auto;
}
.hash button.copy:hover { background: var(--hairline); color: var(--accent); }
.hash button.copy svg { width: 14px; height: 14px; }
.hash button.copy.copied { color: var(--ok); }
.hash-note {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-left: 2px solid var(--gold-line);
  background: var(--gold-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.hash-note svg { width: 12px; height: 12px; flex: 0 0 auto; margin-top: 2px; color: var(--gold-deep); }

/* ---- Chips / pills -------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid;
}
.chip svg { width: 12px; height: 12px; }
.chip-ok    { color: var(--ok);     border-color: var(--ok);     background: var(--ok-soft); }
.chip-warn  { color: var(--warn);   border-color: var(--warn);   background: var(--warn-soft); }
.chip-err   { color: var(--err);    border-color: var(--err);    background: var(--err-soft); }
.chip-info  { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.chip-gold  { color: var(--gold-deep); border-color: var(--gold-line); background: var(--gold-soft); }
.chip-muted { color: var(--ink-muted); border-color: var(--hairline-2); background: var(--surface-soft); }

/* ---- Drop zone ------------------------------------------------- */

.dropzone {
  border: 2px dashed var(--hairline-2);
  border-radius: var(--radius);
  padding: 1.6rem 1.25rem;
  text-align: center;
  background: var(--surface-soft);
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.dropzone .dz-icon {
  width: 42px; height: 42px;
  margin: 0 auto 0.6rem;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  border: 1.5px solid var(--gold-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.dropzone .dz-icon.dz-icon-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok);
}
.dropzone .dz-icon svg { width: 22px; height: 22px; }
.dropzone.is-hover {
  border-color: var(--gold-deep);
  background: var(--gold-soft);
  transform: translateY(-1px);
}
.dropzone.is-busy { border-color: var(--warn); background: var(--warn-soft); }
.dropzone.is-error { border-color: var(--err); background: var(--err-soft); }
.dropzone-text { margin: 0; color: var(--ink); font-size: 0.95rem; }
.dropzone-or { margin: 0.3rem 0; color: var(--ink-muted); font-size: 0.85rem; }
.dropzone-pick {
  display: inline-block;
  cursor: pointer;
  color: var(--gold-deep);
  font-size: 0.92rem;
  border-bottom: 1px dashed var(--gold-line);
}
.dropzone-pick input[type="file"] {
  position: absolute;
  width: 1px; height: 1px; opacity: 0;
  pointer-events: none;
}

/* ---- CA chain stack ------------------------------------------- */

.ca-chain {
  list-style: none; padding: 0; margin: 0;
  counter-reset: chain;
  display: flex; flex-direction: column;
  gap: 0.5rem;
}
.ca-chain li {
  position: relative;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem 0.6rem 2.2rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.ca-chain li::before {
  content: counter(chain);
  counter-increment: chain;
  position: absolute;
  left: 0.6rem; top: 0.6rem;
  width: 1.3rem; height: 1.3rem;
  border-radius: 50%;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  color: var(--gold-deep);
  text-align: center;
  font-size: 0.72rem; line-height: 1.25rem;
  font-weight: 700;
}
.ca-chain .ca-sub {
  display: block; color: var(--ink-muted);
  font-size: 0.78rem; margin-top: 0.15rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

/* ---- How-it-works fineprint ----------------------------------- */
/* Demoted: no card chrome, transparent background, dimmed muted copy.
   Reads like a footer fineprint block at the very bottom of the page. */

.howto {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 1rem 0 0;
  margin-top: 1.5rem;
  border-top: 1px dashed var(--hairline-2);
}
.howto .card-head {
  border-bottom: 0;
  padding-bottom: 0.3rem;
  margin-bottom: 0.4rem;
}
.howto .card-head h2 {
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.howto .card-head .head-icon {
  width: 20px; height: 20px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid var(--hairline-2);
  color: var(--ink-faint);
}
.howto .card-head .head-icon svg { width: 11px; height: 11px; }
.howto p {
  margin: 0 0 0.5rem;
  color: var(--ink-muted);
  font-size: 0.76rem;
  line-height: 1.55;
}
.howto p:last-child { margin-bottom: 0; }
.howto code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 0 0.2rem;
  border-radius: 3px;
  font-size: 0.7rem;
  color: var(--ink-muted);
}
.howto a { color: var(--ink-muted); text-decoration: underline; text-decoration-color: var(--hairline-2); }
.howto a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.footer-links { margin: 0; color: var(--ink-muted); font-size: 0.88rem; }
.footer-links a { color: var(--accent); text-decoration: none; margin-right: 0.65rem; }
.footer-links a:hover { text-decoration: underline; }

footer.site {
  max-width: 880px;
  margin: 1.5rem auto 2.25rem;
  padding: 0 1.25rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.82rem;
}
footer.site a { color: var(--accent); text-decoration: none; }
footer.site a:hover { text-decoration: underline; }
footer.site .crumb { color: var(--gold-deep); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.72rem; }
footer.site .dot { margin: 0 0.5rem; color: var(--gold-line); }

/* ---- Tiny helpers --------------------------------------------- */

.muted { color: var(--ink-muted); }

/* Disclosure for "Full subject" under stacked authority blocks. */
.dn-more {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}
.dn-more summary {
  color: var(--gold-deep);
  cursor: pointer;
  list-style: none;
}
.dn-more summary::-webkit-details-marker { display: none; }
.dn-more summary::before {
  content: "+ ";
  color: var(--gold-line);
}
.dn-more[open] summary::before { content: "- "; }
.dn-full {
  margin-top: 0.3rem;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  word-break: break-word;
}
.pad-top { padding-top: 0.4rem; }
.value-block { display: flex; flex-direction: column; gap: 0.25rem; }
