/* ==========================================================================
   UndecimoDia — security research dossier
   Deliberately single-theme (dark). Committed identity, not adaptive.
   ========================================================================== */

:root {
  /* -- color: ground & ink, warm-neutral bias toward the accent -- */
  --bg:        #0c0c0b;
  --bg-raised: #131311;
  --bg-inset:  #0f0f0e;
  --ink:       #ece8e1;
  --ink-dim:   #b9b5ad;
  --muted:     #a29c92;
  --line:      #29271f;
  --line-soft: #1c1b16;

  /* -- color: functional accents (severity-coded, not decorative) -- */
  --red:      #d7263d;
  --red-dim:  #7d1f2c;
  --red-ink:  #ffd9dd;
  --yellow:     #f2c14e;
  --yellow-dim: #7a611f;
  --yellow-ink: #2b2000;

  /* -- type -- */
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* -- layout -- */
  --max: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --label-col: 200px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--yellow); color: var(--yellow-ink); padding: 0.75rem 1.25rem;
  font-family: var(--font-mono); font-weight: 700;
}
.skip-link:focus { left: 1rem; top: 1rem; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

/* subtle grain for tactility — avoids the flat, over-clean "AI vector" look */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- section rule: a tab the width of the label column, running
   into a hairline — echoes the report grid instead of decorating on top
   of it. Used only at the three major transitions (nav, hero, footer). ---------- */
.section-rule {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  display: grid; grid-template-columns: var(--label-col) minmax(0, 1fr);
  align-items: center;
}
.section-rule__tab { height: 3px; background: var(--red); }
.section-rule__line { height: 1px; background: var(--line); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(12,12,11,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--max); margin: 0 auto; padding: 0.9rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
}
.topbar__mark {
  font-family: var(--font-mono); font-weight: 700; font-size: 1rem;
  letter-spacing: 0.02em;
}
.cursor { color: var(--red); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.nav-toggle {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-toggle span { width: 20px; height: 2px; background: var(--ink); display: block; }

.nav-list { display: flex; gap: 1.75rem; }
.nav-list a {
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-list a:hover, .nav-list a:focus-visible, .nav-list a.is-active {
  color: var(--ink); border-color: var(--red);
}

/* ---------- hero ---------- */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(2.5rem, 6vw, 4rem);
}
.hero__title {
  font-size: clamp(2.75rem, 8vw, 5.25rem);
  font-weight: 800; line-height: 0.98; letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero__role {
  margin-top: 1.4rem; font-size: clamp(0.95rem, 2vw, 1.05rem);
  color: var(--ink-dim); letter-spacing: 0.01em;
}
.hero__thesis {
  max-width: 42em; margin-top: 1.6rem;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem); line-height: 1.55;
  color: var(--ink);
}
.hero__actions { display: flex; gap: 1rem; margin-top: 2.25rem; flex-wrap: wrap; }
.btn {
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 0.85rem 1.5rem; border: 1px solid var(--line);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn--primary:hover, .btn--primary:focus-visible { background: #b81e33; border-color: #b81e33; }
.btn--ghost { color: var(--ink); }
.btn--ghost:hover, .btn--ghost:focus-visible { border-color: var(--ink); }

.hero__links {
  display: flex; gap: 1.5rem; margin-top: 2.5rem; flex-wrap: wrap;
  padding-top: 1.5rem; border-top: 1px solid var(--line-soft);
}
.hero__links a {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted);
  letter-spacing: 0.03em;
}
.hero__links a:hover, .hero__links a:focus-visible { color: var(--ink); }

/* ---------- section grid ---------- */
.section {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(2.25rem, 5.5vw, 3.75rem) var(--gutter);
  border-bottom: 1px solid var(--line-soft);
}
.section__grid {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
.section__label-col { position: sticky; top: 5.5rem; align-self: start; }
.section__index {
  font-size: 0.78rem; letter-spacing: 0.08em;
  color: var(--red); font-weight: 700;
}
.section__title {
  margin-top: 0.4rem;
  font-family: var(--font-body);
  font-size: clamp(1.4rem, 2.6vw, 1.7rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}
.section__note { margin-top: 0.45rem; color: var(--muted); font-size: 0.9rem; }

.lede { font-size: 1.1rem; line-height: 1.65; color: var(--ink); max-width: 46em; }
.section__content p + p { margin-top: 1.1rem; max-width: 46em; line-height: 1.65; color: var(--ink-dim); }

/* ---------- advisory table ---------- */
.advisory-table {
  margin-top: 2rem; border: 1px solid var(--line); overflow-x: auto;
}
.advisory-table__head, .advisory-table__row {
  display: grid; grid-template-columns: 1fr 1.4fr 1fr 1.6fr;
  min-width: 640px;
}
.advisory-table__head {
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); background: var(--bg-inset);
  border-bottom: 1px solid var(--line);
}
.advisory-table__head span, .advisory-table__row span { padding: 0.85rem 1rem; }
.advisory-table__row--empty { color: var(--muted); }
.sev {
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
  padding: 0.15rem 0.5rem;
}
.sev--none { color: var(--muted); }
.status {
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 0.2rem 0.55rem;
}
.status--progress { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow-dim); }

/* ---------- research log placeholder ---------- */
.log-placeholder {
  margin-top: 1.75rem; padding: 2rem; border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.85rem;
}

/* ---------- certifications ---------- */
.cert-group + .cert-group { margin-top: 1.75rem; }
.cert-group__label {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.5rem;
}
.cert-list { display: flex; flex-direction: column; }
.cert-list li {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 1.1rem 0; border-top: 1px solid var(--line-soft);
}
.cert-list li:first-child { border-top: none; }
.cert-list__main { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; }
.cert-list__name { font-weight: 600; font-size: 1.02rem; }
.cert-list__issuer { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.03em; }
.cert-list__meta {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.75rem;
  color: var(--muted); font-size: 0.76rem; letter-spacing: 0.02em;
}
.cert-list__verify { color: var(--muted); }
.cert-list__verify:hover, .cert-list__verify:focus-visible { color: var(--ink); }

/* ---------- footer ---------- */
.footer { background: var(--bg-inset); }
.footer__inner {
  max-width: var(--max); margin: 0 auto; padding: clamp(2.5rem, 6vw, 4rem) var(--gutter);
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
}
.footer__lead { margin-top: 0.6rem; color: var(--ink-dim); max-width: 30em; }
.footer__pgp { margin-top: 0.9rem; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.03em; }
.footer__links { display: flex; gap: 1.5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.footer__links a { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.footer__links a:hover, .footer__links a:focus-visible { color: var(--ink); }
.footer__col--meta { text-align: right; color: var(--muted); font-size: 0.78rem; display: flex; flex-direction: column; gap: 0.3rem; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .section__grid { grid-template-columns: 1fr; }
  .section__label-col { position: static; }
  .section__title { margin-bottom: 0.1rem; }
  .section-rule { grid-template-columns: 64px minmax(0, 1fr); }
  .footer__inner { flex-direction: column; }
  .footer__col--meta { text-align: left; }
}

@media (max-width: 680px) {
  .nav-toggle { display: flex; }
  .nav-list {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-direction: column; gap: 0; padding: 0.5rem 0;
    display: none;
  }
  .nav-list.is-open { display: flex; }
  .nav-list li { width: 100%; }
  .nav-list a {
    display: block; padding: 0.9rem var(--gutter); border-bottom: 1px solid var(--line-soft);
  }
  .advisory-table__head, .advisory-table__row { min-width: 560px; }
}
