/* ==========================================================================
   PUBLIC PROTOCOL — DESIGN SYSTEM  ·  publicprotocol.org

   The same civic system as furcate.org — one family, two properties — the way
   Pentagram gives Dream.org one language with a colour per division. Same
   faces (Big Shoulders for signage, Public Sans for reading, Ubuntu Mono for
   what is cited or measured), same bands, plates and signage numbering. Its
   own colour: the navy the Protocol has always been set in. Its own pattern:
   ruled lines, because this is a charter — articles, tests, citations — and
   a charter is a ruled document before it is anything else.
   ========================================================================== */

@font-face {
  font-family: 'Big Shoulders';
  src: url('/assets/fonts/bigshoulders-400-900.woff2') format('woff2-variations');
  font-weight: 400 900; font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('/assets/fonts/publicsans-300-800.woff2') format('woff2-variations');
  font-weight: 300 800; font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('/assets/fonts/publicsans-400-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Ubuntu Mono';
  src: url('/assets/fonts/ubuntumono-400.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Ubuntu Mono';
  src: url('/assets/fonts/ubuntumono-700.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  --ground:   oklch(0.988 0.003 255);
  --ground-2: oklch(0.960 0.005 255);
  --ink:      oklch(0.160 0.010 265);
  --ink-2:    oklch(0.390 0.010 265);
  --ink-3:    oklch(0.550 0.008 265);
  --rule:     oklch(0.820 0.008 262);
  --hair:     oklch(0.895 0.006 262);

  /* The colour — the Protocol's navy, used as a colour: bands, plates, fills. */
  --navy:     oklch(0.355 0.125 262);
  --navy-ink: oklch(0.355 0.125 262);   /* navy is dark enough to carry type as it is */
  --on-navy:  oklch(0.975 0.004 255);
  --wash:     oklch(0.355 0.125 262 / 0.08);

  --display: 'Big Shoulders', 'Archivo', system-ui, sans-serif;
  --sans:    'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'Ubuntu Mono', ui-monospace, Menlo, Consolas, monospace;
  --measure: 64ch;

  /* The pattern: ruled lines. A charter is a ruled document. */
  --ruled: repeating-linear-gradient(180deg, transparent 0 27px, oklch(0.355 0.125 262 / 0.13) 27px 28px);
}

/* -- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { font-size: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0; background: var(--ground); color: var(--ink-2);
  font-family: var(--sans); font-size: 1rem; line-height: 1.62;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word; font-synthesis: none;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--navy); text-decoration-thickness: 2px; text-underline-offset: 0.16em; }
a:hover { color: var(--navy); }
a:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
::selection { background: var(--navy); color: var(--on-navy); }

.instrument { max-width: 84rem; margin: 0 auto; padding: 0 1.4rem; }
@media (min-width: 60rem) { .instrument { padding: 0 3rem; } }

/* -- Type ----------------------------------------------------------------- */

h1, h2, h3, h4 { margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font-family: var(--display); font-weight: 900; text-transform: uppercase;
     font-size: clamp(3.2rem, 9.5vw, 7.4rem); line-height: 0.92; letter-spacing: 0.004em; }
h2 { font-family: var(--display); font-weight: 800; text-transform: uppercase;
     font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 0.98; letter-spacing: 0.006em; margin-bottom: 1.2rem; }
h3 { font-weight: 700; font-size: 1.04rem; line-height: 1.3; margin-bottom: 0.4rem; }
h4 { font-weight: 700; font-size: 0.94rem; margin-bottom: 0.3rem; }
p { margin: 0 0 1.1rem; }
p:last-child { margin-bottom: 0; }
.lede { font-size: clamp(1.1rem, 1.9vw, 1.35rem); line-height: 1.45; color: var(--ink-2); max-width: 50ch; }
strong, b { color: var(--ink); font-weight: 700; }
em { font-style: normal; color: var(--ink); box-shadow: inset 0 -0.45em 0 var(--wash); }
.col { max-width: var(--measure); }
code, .val, .figure { font-family: var(--mono); font-size: 0.95em; color: var(--ink); font-variant-ligatures: none; }
code { background: var(--ground-2); border: 1px solid var(--hair); padding: 0.05em 0.4em; }

/* Labels: signage small caps, in the colour. */
.label { display: inline-block; font-weight: 700; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy); }
.cite { display: block; font-size: 0.86rem; color: var(--ink-3); margin-top: 0.4rem; }

/* -- Masthead: the band ---------------------------------------------------- */

header.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap;
  padding: 1.1rem 0 1rem; border-top: 10px solid var(--navy); border-bottom: 2px solid var(--ink);
}
.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none;
            font-family: var(--display); font-weight: 900; font-size: 1.75rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink); }
.wordmark span, .wordmark b { color: var(--navy); }
.wordmark svg, .mark { width: 1.6rem; height: 1.6rem; color: var(--navy); }
nav.masthead { display: flex; flex-wrap: wrap; gap: 1.4rem; }
nav.masthead a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 0.86rem; }
nav.masthead a:hover { color: var(--navy); }

/* -- Opening: the façade, over the ruled page ----------------------------- */

.opening { padding: 4rem 0 3rem; position: relative; background: var(--ruled); background-clip: content-box; }
@media (min-width: 62rem) { .opening { padding: 6rem 0 4.4rem; } }
.opening > * { position: relative; }
.opening .label { margin-bottom: 1.6rem; }
.opening .lede { margin-top: 1.8rem; }

/* -- Preamble: a plate ---------------------------------------------------- */

.preamble { background: var(--navy); color: var(--on-navy); padding: 1.6rem 1.7rem 1.8rem; margin-top: 2.4rem; max-width: 74ch; }
.preamble .label { color: var(--on-navy); opacity: 0.75; margin-bottom: 0.8rem; }
.preamble p { color: var(--on-navy); font-size: 1.04rem; line-height: 1.55; }
.preamble a { color: var(--on-navy); text-decoration-color: var(--on-navy); }

/* -- Buttons -------------------------------------------------------------- */

.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2.4rem; }
.btn { display: inline-block; text-decoration: none; border: 2px solid var(--ink); background: var(--ink); color: var(--ground);
       padding: 0.72rem 1.35rem; font-weight: 700; font-size: 0.86rem; letter-spacing: 0.02em; }
.btn:hover { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn-line { background: none; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--ground); border-color: var(--ink); }

/* -- Divisions: numbered like signage ------------------------------------- */

section.div { padding: 3.6rem 0; border-top: 2px solid var(--rule); }
@media (min-width: 62rem) { section.div { padding: 5.4rem 0; } }
section.div:first-of-type { border-top: 10px solid var(--navy); }
.divhead { margin-bottom: 1.8rem; }
.divhead .label { margin-bottom: 0.7rem; }
.divbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 3.4rem; }
@media (min-width: 62rem) { .divbody { grid-template-columns: 13rem minmax(0, 1fr); } }
.gutter { font-size: 0.82rem; color: var(--ink-3); line-height: 1.5; }
@media (max-width: 61.99rem) { .gutter { margin-bottom: 1.2rem; } }

/* -- Stakes --------------------------------------------------------------- */

.stakes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.7rem 2.6rem; margin-top: 1.6rem; }
@media (min-width: 52rem) { .stakes { grid-template-columns: repeat(2, 1fr); } }
.stake { border-top: 6px solid var(--navy); padding-top: 0.85rem; }
.stake .src { margin-bottom: 0.5rem; font-size: 0.84rem; color: var(--ink-3); }
.stake .src b { display: block; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy); margin-bottom: 0.15rem; }
.stake p { font-size: 0.94rem; }
.stake .figure { display: inline-block; margin-top: 0.5rem; font-size: 0.9rem; color: var(--navy); font-weight: 700; }

/* -- Articles: the charter itself ----------------------------------------- */

.articles { margin-top: 1.4rem; }
.art { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem 2.4rem; padding: 1.8rem 0; border-top: 2px solid var(--rule); }
@media (min-width: 54rem) { .art { grid-template-columns: 7.5rem minmax(0, 1fr); } }
.art .no { font-family: var(--display); font-weight: 800; font-size: 3rem; line-height: 0.9; letter-spacing: 0.02em; color: var(--navy); }
.art .no small { display: block; font-family: var(--sans); font-weight: 700; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.35rem; }
.art .binds { font-weight: 700; font-size: 1.12rem; line-height: 1.4; color: var(--ink); max-width: var(--measure); }
.art .note { font-size: 0.94rem; color: var(--ink-2); max-width: var(--measure); }
.art .test { background: var(--ground-2); border-left: 6px solid var(--navy); padding: 0.9rem 1.1rem; max-width: var(--measure); margin-top: 0.4rem; }
.art .test b { display: block; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy); margin-bottom: 0.3rem; }
.art .test p { margin: 0; font-size: 0.94rem; }
@media (min-width: 54rem) { .art > :not(.no) { grid-column: 2; } }

/* -- Lexicon -------------------------------------------------------------- */

.lexicon { margin-top: 1.4rem; }
.term { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.3rem 2rem; padding: 1.1rem 0; border-top: 1px solid var(--hair); }
@media (min-width: 46rem) { .term { grid-template-columns: 12rem minmax(0, 1fr); } }
.term .t { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.35rem; line-height: 1; letter-spacing: 0.02em; color: var(--ink); }
.term .k { font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.term .val, .term p { font-size: 0.94rem; margin: 0; }

/* -- Cards ---------------------------------------------------------------- */

.cards, .two, .three { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.7rem 2.6rem; margin-top: 1.8rem; }
@media (min-width: 46rem) { .two, .cards { grid-template-columns: repeat(2, 1fr); } .three { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 70rem) { .three { grid-template-columns: repeat(3, 1fr); } }
.card { border-top: 3px solid var(--ink); padding-top: 0.85rem; }
.card .label { display: block; margin-bottom: 0.45rem; }
.card p { font-size: 0.92rem; margin: 0; }

/* -- Adoption: the plate -------------------------------------------------- */

.adopt { background: var(--navy); color: var(--on-navy); padding: 2rem 1.8rem 2.2rem; margin-top: 2rem; }
.adopt h2, .adopt h3, .adopt p, .adopt .label { color: var(--on-navy); }
.adopt .label { opacity: 0.75; }
.adopt a { color: var(--on-navy); text-decoration-color: var(--on-navy); }
.adopt .btn { background: var(--on-navy); border-color: var(--on-navy); color: var(--navy); }
.adopt .btn:hover { background: transparent; color: var(--on-navy); }
.adopt .btn-line { background: none; color: var(--on-navy); }

/* -- Title block: a ruled document's corner ------------------------------- */

.titleblock { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 2px solid var(--ink); border-top-width: 10px; border-top-color: var(--navy); margin-top: 2.4rem; }
@media (min-width: 52rem) { .titleblock { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.titleblock > div { padding: 0.8rem 1rem; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); font-size: 0.86rem; }
.titleblock > div b { display: block; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.2rem; }
.titleblock > div:last-child, .titleblock > div:nth-child(2n) { border-right: 0; }
@media (min-width: 52rem) { .titleblock > div:nth-child(2n) { border-right: 1px solid var(--hair); } .titleblock > div:nth-child(4n) { border-right: 0; } }

/* -- Footer --------------------------------------------------------------- */

footer.foot { border-top: 10px solid var(--navy); padding: 2.8rem 0 3.4rem; margin-top: 2rem; }
footer.foot .cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.9rem 3rem; }
@media (min-width: 46rem) { footer.foot .cols { grid-template-columns: repeat(4, 1fr); } }
footer.foot h4 { font-weight: 700; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.7rem; }
footer.foot ul { list-style: none; margin: 0; padding: 0; font-size: 0.92rem; }
footer.foot li { margin-bottom: 0.4rem; }
footer.foot a { text-decoration: none; color: var(--ink-2); }
footer.foot a:hover { color: var(--navy); }
.colophon { margin-top: 2.6rem; padding-top: 1.4rem; border-top: 2px solid var(--hair); font-size: 0.84rem; color: var(--ink-3); max-width: 74ch; line-height: 1.6; }

p, li, .card p { text-wrap: pretty; }

/* -- Mobile menu ---------------------------------------------------------- */

.navtoggle { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.navbtn { display: none; }
@media (max-width: 61.99rem) {
  header.masthead { row-gap: 0; }
  .navbtn { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none;
            font-weight: 700; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); padding: 0.35rem 0; }
  .navbtn::after { content: "+"; font-size: 1.05em; line-height: 1; }
  .navtoggle:checked ~ .navbtn::after { content: "–"; }
  .navtoggle:focus-visible ~ .navbtn { outline: 2px solid var(--navy); outline-offset: 3px; }
  nav.masthead { display: none; flex-basis: 100%; width: 100%; flex-direction: column; gap: 0; margin: 0 0 0.4rem; }
  .navtoggle:checked ~ nav.masthead { display: flex; }
  nav.masthead a { display: block; width: 100%; padding: 0.72rem 0; border-top: 1px solid var(--hair); }
}

/* -- Long tokens ---------------------------------------------------------- */
code, .val, .figure { overflow-wrap: anywhere; }
h1, h2 { overflow-wrap: break-word; }
