/* CIPAScan design system — instrument, not brochure. */

:root {
  /* ground */
  --paper: #f5f4f0;
  --paper-raised: #ffffff;
  --ink: #1c1e1a;
  --ink-soft: #55584f;
  --ink-faint: #8b8d84;
  --line: #dbd8cf;
  --line-soft: #e8e6de;

  /* brand accent */
  --accent: #2c5560;
  --accent-soft: #d9e4e2;
  --accent-ink: #ffffff;

  /* grade scale */
  --grade-a: #3f6e4d;
  --grade-a-bg: #dfe9df;
  --grade-c: #8a7315;
  --grade-c-bg: #f1ecd0;
  --grade-d: #ad6a1f;
  --grade-d-bg: #f5e6cd;
  --grade-f: #a63626;
  --grade-f-bg: #f6e2dd;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(28, 30, 26, 0.06);
  --shadow-md: 0 8px 24px -8px rgba(28, 30, 26, 0.18);

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", "Inter", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14171a;
    --paper-raised: #1b1f22;
    --ink: #e9e7e0;
    --ink-soft: #a3a89f;
    --ink-faint: #6d716a;
    --line: #33383a;
    --line-soft: #262b2d;

    --accent: #7fb4b0;
    --accent-soft: #1d2e30;
    --accent-ink: #0d1415;

    --grade-a: #8fc79c;
    --grade-a-bg: #1e2c22;
    --grade-c: #d8c877;
    --grade-c-bg: #34301a;
    --grade-d: #e0b06a;
    --grade-d-bg: #3a2e17;
    --grade-f: #e8897a;
    --grade-f-bg: #3a211d;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 28px -8px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  --paper: #14171a;
  --paper-raised: #1b1f22;
  --ink: #e9e7e0;
  --ink-soft: #a3a89f;
  --ink-faint: #6d716a;
  --line: #33383a;
  --line-soft: #262b2d;
  --accent: #7fb4b0;
  --accent-soft: #1d2e30;
  --accent-ink: #0d1415;
  --grade-a: #8fc79c;
  --grade-a-bg: #1e2c22;
  --grade-c: #d8c877;
  --grade-c-bg: #34301a;
  --grade-d: #e0b06a;
  --grade-d-bg: #3a2e17;
  --grade-f: #e8897a;
  --grade-f-bg: #3a211d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px -8px rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
  --paper: #f5f4f0;
  --paper-raised: #ffffff;
  --ink: #1c1e1a;
  --ink-soft: #55584f;
  --ink-faint: #8b8d84;
  --line: #dbd8cf;
  --line-soft: #e8e6de;
  --accent: #2c5560;
  --accent-soft: #d9e4e2;
  --accent-ink: #ffffff;
  --grade-a: #3f6e4d;
  --grade-a-bg: #dfe9df;
  --grade-c: #8a7315;
  --grade-c-bg: #f1ecd0;
  --grade-d: #ad6a1f;
  --grade-d-bg: #f5e6cd;
  --grade-f: #a63626;
  --grade-f-bg: #f6e2dd;
  --shadow-sm: 0 1px 2px rgba(28, 30, 26, 0.06);
  --shadow-md: 0 8px 24px -8px rgba(28, 30, 26, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  font-size: 16px;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* type scale */
.t-eyebrow { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.t-display { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; text-wrap: balance; }
.t-h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); line-height: 1.1; }
.t-h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); line-height: 1.18; }
.t-h3 { font-size: 1.35rem; line-height: 1.25; font-family: var(--sans); font-weight: 700; }
.t-body { font-size: 1rem; color: var(--ink-soft); }
.t-small { font-size: 0.86rem; color: var(--ink-soft); }
.t-micro { font-size: 0.74rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.tabular { font-variant-numeric: tabular-nums; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; }

/* nav */
.site-nav {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 40;
}
.site-nav .bar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.05rem 0; }
.wordmark { display: flex; align-items: baseline; gap: 0.35rem; font-family: var(--serif); font-size: 1.3rem; font-weight: 400; text-decoration: none; color: var(--ink); }
.wordmark .dot { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 1.75rem; font-size: 0.92rem; }
.nav-links a:not(.btn) { text-decoration: none; color: var(--ink-soft); }
.nav-links a:not(.btn):hover { color: var(--ink); }
.nav-links a.current { color: var(--ink); font-weight: 600; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 0.78rem 1.4rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* cards */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* severity chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.22rem 0.6rem; border-radius: 99px; white-space: nowrap;
}
.chip-f { color: var(--grade-f); background: var(--grade-f-bg); }
.chip-d { color: var(--grade-d); background: var(--grade-d-bg); }
.chip-c { color: var(--grade-c); background: var(--grade-c-bg); }
.chip-a { color: var(--grade-a); background: var(--grade-a-bg); }
.chip-neutral { color: var(--ink-soft); background: var(--line-soft); }

.tag {
  font-size: 0.76rem; color: var(--ink-soft); background: var(--line-soft);
  border: 1px solid var(--line); padding: 0.1rem 0.5rem; border-radius: 4px; white-space: nowrap;
}

/* grade medallion */
.medallion {
  width: 108px; height: 108px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 3.1rem; font-weight: 400;
  border: 3px solid currentColor; flex-shrink: 0;
}
.medallion.sm { width: 52px; height: 52px; font-size: 1.5rem; border-width: 2px; }
.medallion-f { color: var(--grade-f); background: var(--grade-f-bg); }
.medallion-d { color: var(--grade-d); background: var(--grade-d-bg); }
.medallion-c { color: var(--grade-c); background: var(--grade-c-bg); }
.medallion-a { color: var(--grade-a); background: var(--grade-a-bg); }

/* blur / unlock */
.blur-guard { position: relative; }
.blur-guard .blur-target {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}
.blur-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  text-align: center; padding: 1rem;
  background: linear-gradient(to bottom, transparent, var(--paper-raised) 55%);
}
.blur-overlay .lock-icon { color: var(--ink-faint); }
.blur-overlay p { margin: 0; font-size: 0.85rem; color: var(--ink-soft); max-width: 30ch; }

/* forms */
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
input[type="text"], input[type="email"], input[type="url"], input[type="search"], textarea {
  font: inherit; font-size: 0.95rem;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper-raised); color: var(--ink);
  width: 100%;
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }

.url-scan-form {
  display: flex; gap: 0.6rem; align-items: stretch;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  box-shadow: var(--shadow-md);
}
.url-scan-form input { border: none; box-shadow: none; padding: 0.7rem 0.9rem; font-size: 1.05rem; }
.url-scan-form input:focus-visible { outline: none; }
.url-scan-form .btn { white-space: nowrap; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 5rem; padding: 2.75rem 0; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.4rem; font-size: 0.88rem; }
.footer-links a { text-decoration: none; color: var(--ink-soft); }
.footer-links a:hover { color: var(--ink); }
.footer-note { font-size: 0.8rem; color: var(--ink-faint); margin-top: 1.25rem; }
.footer-note .dot-ok { color: var(--grade-a); }

/* table scroll */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-raised); }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
thead th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); background: var(--line-soft);
}
tbody td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line-soft); font-size: 0.9rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

@media print {
  .site-nav, .site-footer, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
