/*
 * SPDX-FileCopyrightText: Bruno Pacheco
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/* Classic Rome: travertine and bronze, verdigris as the second colour, Cinzel (Roman inscriptional
   capitals) for display text and EB Garamond for reading. Fonts are served with the site. */

@font-face {
  font-family: "Cinzel";
  src: url("fonts/Cinzel.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/EBGaramond.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/EBGaramond-Italic.woff2") format("woff2");
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f4eee3;          /* travertine */
  --bg-soft: #ebe2d2;
  --card: #fbf8f2;
  --text: #2b2420;        /* ink */
  --muted: #66574b;
  --line: #dccfbb;
  --accent: #8c5a2b;      /* bronze */
  --accent-strong: #6e4421;
  --accent-soft: #eadbc3;
  --second: #3e7c6e;      /* verdigris */
  --on-accent: #fbf3e4;
  --code-bg: #2b2420;
  --code-text: #efe6d6;
  --code-muted: #b39b7e;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --serif: "EB Garamond", Garamond, "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 4px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16120f;        /* basalt */
    --bg-soft: #1f1915;
    --card: #1b1612;
    --text: #ece3d3;
    --muted: #b5a691;
    --line: #3a2f26;
    --accent: #d3a26a;
    --accent-strong: #e6be8c;
    --accent-soft: #33261a;
    --second: #79bba9;
    --on-accent: #1a120b;
    --code-bg: #0f0c0a;
    --code-text: #ece3d3;
    --code-muted: #9c8a73;
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.18rem/1.6 var(--serif);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

code { font-family: var(--mono); font-size: .8em; }
:not(pre) > code {
  background: var(--accent-soft);
  padding: .1em .35em;
  border-radius: 3px;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; }
h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  letter-spacing: .04em;
  margin: 0 0 1.4rem;
}
/* a bronze rule with an interpunct, as on an inscription */
h2::before {
  content: "";
  display: block;
  width: 72px;
  height: 7px;
  margin-bottom: 14px;
  background:
    radial-gradient(circle, var(--accent) 3px, transparent 3.5px) center / 7px 7px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left center / 28px 1.5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right center / 28px 1.5px no-repeat;
}
h3 { font-size: 1.02rem; letter-spacing: .03em; margin: 0 0 .45rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: var(--radius);
}
.skip:focus { left: 8px; z-index: 10; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand img { display: block; }
.brand span { font: 700 1.15rem var(--display); letter-spacing: .12em; }
.top nav ul { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.top nav a {
  display: block; padding: 6px 10px; border-radius: var(--radius);
  color: var(--muted); text-decoration: none;
  font: 500 .82rem var(--display); letter-spacing: .08em; white-space: nowrap;
}
.top nav a:hover { color: var(--accent); }
/* narrower screens keep the links that leave the page; the sections are a scroll away */
@media (max-width: 960px) {
  .top nav li:nth-child(-n+3) { display: none; }
}
@media (max-width: 560px) {
  .top nav li:nth-child(-n+4) { display: none; }
}

/* hero */
.hero { padding: 64px 0 56px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 52px; } }
.eyebrow { color: var(--second); font: 500 .85rem var(--display); letter-spacing: .1em; margin: 0 0 14px; }
.hero h1 { font-size: clamp(1.65rem, 3.3vw, 2.3rem); line-height: 1.25; letter-spacing: .01em; margin: 0 0 20px; }
.lede { color: var(--muted); font-size: 1.28rem; margin: 0 0 28px; max-width: 34em; }
.lede em { color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button {
  display: inline-block; padding: 11px 22px; border-radius: var(--radius);
  border: 1px solid var(--accent); color: var(--accent); text-decoration: none;
  font: 600 .85rem var(--display); letter-spacing: .1em;
}
.button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.release { color: var(--muted); font-size: 1.02rem; margin: 20px 0 0; }

/* code */
.code { position: relative; margin: 0; border-top: 3px solid var(--accent); border-radius: var(--radius); }
.code figcaption {
  font: 500 .74rem var(--display); letter-spacing: .1em; color: var(--code-muted); background: var(--code-bg);
  padding: 14px 18px 0;
}
.code pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text);
  border-radius: 0 0 var(--radius) var(--radius); font-size: 1rem; line-height: 1.55;
}
.copy {
  position: absolute; top: 10px; right: 10px;
  font: 600 .68rem var(--display); letter-spacing: .08em; color: var(--code-muted);
  background: transparent; border: 1px solid #5a4a3c; border-radius: 3px; padding: 4px 8px; cursor: pointer;
}
.copy:hover, .copy:focus-visible { color: var(--code-text); border-color: var(--code-muted); }

/* numbers */
.band { background: var(--bg-soft); border-block: 1px solid var(--line); padding: 40px 0 30px; }
.stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stats li { border-left: 2px solid var(--accent); padding-left: 16px; }
/* EB Garamond, not Cinzel: Cinzel has capitals only, and would draw µs like MS */
.stats strong { display: block; font: 600 clamp(1.9rem, 3.6vw, 2.4rem)/1.15 var(--serif); color: var(--accent); }
.stats span { color: var(--muted); font-size: 1.05rem; }
.note { color: var(--muted); font-size: 1rem; margin: 24px 0 0; max-width: 62em; }

/* sections */
.section { padding: 72px 16px 0; }
@media (min-width: 720px) { .section { padding: 80px 32px 0; } }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cards article {
  border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: 20px 22px; background: var(--card);
}
.cards p { margin: 0; color: var(--muted); }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 30px; }
.steps > li { counter-increment: step; position: relative; padding-left: 56px; min-width: 0; }
/* step numbers as Roman numerals */
.steps > li::before {
  content: counter(step, upper-roman); position: absolute; left: 0; top: -4px;
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--accent); color: var(--accent); background: var(--card);
  font: 600 .95rem var(--display);
}
.steps p { margin: 0 0 12px; color: var(--muted); }
.steps .code + .code { margin-top: 12px; }
.more { color: var(--muted); margin: 30px 0 0; }

.how-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
@media (min-width: 900px) { .how-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 52px; } }
.how-grid p { margin: 0 0 14px; }
/* the C4 system context diagram: a landscape layout, and a portrait one for phones */
.context { margin: 0 0 40px; }
.context svg { display: block; width: 100%; height: auto; }
.context .c4-tall { display: none; max-width: 420px; margin: 0 auto; }
@media (max-width: 640px) {
  .context .c4-wide { display: none; }
  .context .c4-tall { display: block; }
}
.context figcaption { color: var(--muted); font-size: 1rem; margin-top: 12px; max-width: 62em; }
.c4 text { font-family: var(--serif); }
.c4 g text { text-anchor: middle; }
.c4 .c4-name { font: 600 15px var(--display); letter-spacing: .03em; }
.c4-person .c4-name { font-size: 13.5px; }
.c4 .c4-kind { font-size: 12px; font-style: italic; }
.c4 .c4-desc { font-size: 13.5px; }
.c4 .c4-label { font-size: 13px; font-style: italic; fill: var(--muted); }
.c4-person circle, .c4-person rect { fill: var(--second); }
.c4-person text { fill: var(--on-accent); }
.c4-focus rect { fill: var(--accent); stroke: var(--accent-strong); stroke-width: 1.5; }
.c4-focus text { fill: var(--on-accent); }
.c4-ext rect { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.c4-ext text { fill: var(--text); }
.c4-ext .c4-kind, .c4-ext .c4-desc { fill: var(--muted); }
.c4-edge { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 5 4; }
.c4-arrowhead { fill: var(--muted); }

/* the worked example, set like an inscribed tablet */
.bits {
  margin: 0; padding: 18px; overflow-x: auto;
  background: var(--card); border: 1px solid var(--line);
  outline: 3px double var(--accent); outline-offset: -9px;
  border-radius: var(--radius);
}
.bits table { border-collapse: separate; border-spacing: 6px; width: 100%; font-size: 1rem; }
.bits caption { text-align: left; color: var(--muted); padding: 6px 8px 8px; caption-side: top; }
.bits th { text-align: left; font: 500 .78rem var(--display); letter-spacing: .06em; color: var(--muted); white-space: nowrap; padding-right: 8px; }
/* rule numbers in EB Garamond: Cinzel's 1 reads as a Roman I */
.bits thead th { color: var(--text); text-align: center; font: 600 1rem var(--serif); }
.bits thead th:first-child { text-align: left; }
.bits td { text-align: center; font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.bits .cells td { color: var(--text); padding: 6px 4px; background: var(--bg-soft); border-radius: 3px; }
.bits .mask td { padding: 6px 0; background: var(--bg-soft); color: var(--muted); border-radius: 3px; }
.bits .mask td.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.bits .result td.on { background: var(--second); color: var(--on-accent); }
.bits .result th { color: var(--text); }
.verdict { margin: 10px 8px 6px; font: 600 1.05rem var(--serif); color: var(--second); }
@media (max-width: 480px) {
  .bits { padding: 12px 6px; outline-offset: -6px; }
  .bits table { border-spacing: 3px; }
  .bits td { font-size: .7rem; }
  .bits .cells td { padding: 5px 2px; }
  .bits th { padding-right: 2px; white-space: normal; font-size: .7rem; }
}

/* security: what to expect, and the limits */
.expect { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 900px) { .expect { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; } }
.expect > div { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--second); border-radius: var(--radius); padding: 20px 22px; }
.expect > .limits { border-top-color: var(--accent); }
.expect h3 { margin-bottom: .8rem; }

/* roadmap: three stages, numbered in Roman numerals */
.timeline { list-style: none; counter-reset: stage; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.timeline > li { counter-increment: stage; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.timeline > li h3::before {
  content: counter(stage, upper-roman); display: inline-grid; place-items: center;
  width: 30px; height: 30px; margin-right: 10px; border: 1px solid var(--accent); color: var(--accent);
  font: 600 .85rem var(--display); vertical-align: middle;
}
.timeline .plain li { margin-bottom: 8px; }

/* phalerae on a harness: the OpenSSF badges as Roman decorations, metal by level */
.ph-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.phalerae {
  position: relative; list-style: none; margin: 0 0 32px; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
/* the harness: a leather strap with rivets, down on phones, across on wider screens */
.phalerae::before {
  content: ""; position: absolute; z-index: 0; left: 50%; top: 0; bottom: 0; width: 22px; transform: translateX(-50%);
  background:
    radial-gradient(circle, #c9a26e 2.4px, transparent 3px) center / 22px 26px repeat-y,
    linear-gradient(90deg, #4a2f1c, #6b4428 45%, #4a2f1c);
  border-radius: 4px;
}
@media (min-width: 640px) {
  .phalerae { flex-direction: row; justify-content: center; gap: 44px; }
  .phalerae::before {
    left: 6%; right: 6%; top: 46px; bottom: auto; width: auto; height: 22px; transform: none;
    background:
      radial-gradient(circle, #c9a26e 2.4px, transparent 3px) center / 26px 22px repeat-x,
      linear-gradient(#4a2f1c, #6b4428 45%, #4a2f1c);
  }
}
.phalerae li { position: relative; z-index: 1; }
.phalerae a { display: block; border-radius: 50%; }
.phalerae a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.phalera { display: block; width: 170px; height: auto; transition: transform .15s ease; }
.phalerae a:hover .phalera { transform: translateY(-2px) rotate(-2deg); }
.ph-loop { fill: #6b4428; stroke: #3a2414; stroke-width: 1.5; }
.ph-rim { stroke-width: 2; }
.ph-beads { fill: none; stroke-width: 2.4; stroke-dasharray: .1 6.2; stroke-linecap: round; }
.ph-field { stroke-width: 1; opacity: .9; }
.ph-label { font: 700 11px var(--display); letter-spacing: 1.6px; text-anchor: middle; }
.ph-value { text-anchor: middle; }
.ph-word { font: 700 19px var(--display); letter-spacing: 1px; }
.ph-numeral { font: 700 40px var(--display); }
/* EB Garamond for numbers: Cinzel draws 1 like a Roman I */
.ph-number { font: 600 34px var(--serif); }
.ph-sub { font: 600 9px var(--display); letter-spacing: 1.4px; text-anchor: middle; }
.ph-issuer { font: 700 9.5px var(--display); letter-spacing: 2px; text-anchor: middle; }
.gold .ph-rim, .gold .ph-field { fill: url(#ph-gold); stroke: #7a5a14; }
.gold .ph-beads { stroke: #7a5a14; }
.gold text { fill: #4a360a; }
.silver .ph-rim, .silver .ph-field { fill: url(#ph-silver); stroke: #5f676e; }
.silver .ph-beads { stroke: #5f676e; }
.silver text { fill: #2d3237; }
.bronze .ph-rim, .bronze .ph-field { fill: url(#ph-bronze); stroke: #5a3618; }
.bronze .ph-beads { stroke: #5a3618; }
.bronze text { fill: #3a220e; }

/* armillae: the live checks as open bronze bracelets; a failing one turns verdigris */
.armillae { list-style: none; margin: -8px 0 30px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; }
.armillae a { display: block; border-radius: 12px; }
.armillae a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.armilla { display: block; width: 132px; height: auto; transition: transform .15s ease; }
.armillae a:hover .armilla { transform: translateY(-2px); }
.arm-band { fill: none; stroke: url(#arm-bronze); stroke-width: 9; stroke-linecap: round; }
.arm-knob { fill: url(#arm-bronze); stroke: #5a3618; }
.arm-label { font: 600 8.5px var(--display); letter-spacing: 1px; text-anchor: middle; fill: var(--muted); }
.arm-value { text-anchor: middle; fill: var(--text); }
.arm-word { font: 700 11.5px var(--display); letter-spacing: .3px; }
/* EB Garamond for numbers: Cinzel draws 1 like a Roman I */
.arm-num { font: 600 19px var(--serif); }
.failing .arm-band { stroke: url(#arm-verdigris); }
.failing .arm-knob { fill: url(#arm-verdigris); stroke: #264c41; }
.failing .arm-value { fill: var(--second); }
@media (max-width: 480px) { .armilla { width: 120px; } }

.plain { margin: 0; padding-left: 1.2em; }
.plain li { margin-bottom: 10px; }
.plain li::marker { color: var(--accent); }
.plain.two { display: grid; gap: 4px 40px; }
@media (min-width: 900px) { .plain.two { grid-template-columns: 1fr 1fr; } }
.contribute p { max-width: 46em; }

/* footer */
.foot { margin-top: 88px; border-top: 1px solid var(--line); padding: 26px 0 34px; color: var(--muted); font-size: 1rem; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }
.foot p { margin: 0; }
.foot ul { display: flex; flex-wrap: wrap; gap: 18px; list-style: none; margin: 0; padding: 0; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }
