/* Protostar */

@font-face {
  font-family: "Syne";
  src: url("../fonts/syne.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/spacegrotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #F4EFE6;
  --band: #EBE4D7;
  --card: #FBF8F2;
  --ink: #0D0E17;
  --ink-hover: #262838;
  --body: #3A3C4E;
  --meta: #5E6278;
  --accent: #B8350F;
  --ember: #FF5A36;
  --on-ink: #D2CEC5;
  --rule: rgba(13, 14, 23, 0.14);
  --rule-strong: rgba(13, 14, 23, 0.3);
  --field-line: #7A7A80;
  --display: "Syne", "Space Grotesk", system-ui, sans-serif;
  --text: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1320px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font: 400 1.0625rem/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
:where(ul[role="list"], ol[role="list"]) { list-style: none; margin: 0; padding: 0; }
a { color: inherit; }
p { text-wrap: pretty; }
dfn { font-style: normal; }
.nw { white-space: nowrap; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }

.skip {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.3s;
}
.masthead.is-scrolled { border-bottom-color: var(--ink); }

.masthead-row { display: flex; align-items: center; gap: 2rem; min-height: 72px; }

.wordmark { margin-right: auto; font: 800 1.3rem/1 var(--display); letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }

.masthead-nav ul { display: flex; gap: 1.75rem; list-style: none; margin: 0; padding: 0; }
.masthead-nav a {
  padding-block: 0.35rem;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat;
  color: var(--ink);
  font: 500 0.95rem/1 var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: background-size 0.3s var(--ease);
}
.masthead-nav a:hover { background-size: 100% 1.5px; }

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

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.8rem 1.45rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font: 500 1rem/1 var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.pill-ink { background: var(--ink); color: var(--paper); }
.pill-ink:hover { background: var(--ink-hover); }
.pill-ember { background: var(--ember); color: var(--ink); }
.pill-ember:hover { background: var(--ink); color: var(--paper); }
.pill-line { border-color: var(--ink); color: var(--ink); }
.pill-line:hover { background: var(--ink); color: var(--paper); }
.pill-sm { min-height: 2.5rem; padding: 0.55rem 1.1rem; font-size: 0.92rem; }

/* ---------- cover ---------- */

.cover { position: relative; overflow: clip; padding-block: clamp(1.25rem, 2.5vw, 2rem) clamp(1.5rem, 3vw, 2.5rem); }
.cover-inner { position: relative; container-type: inline-size; }

/* issue line under the masthead */
.cover-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--rule-strong); }
.cover-meta li { display: flex; align-items: center; gap: 0.6rem; padding: 0.2rem 1.25rem 1rem; font: 500 0.92rem/1.3 var(--text); color: var(--ink); }
.cover-meta li:first-child { padding-left: 0; }
.cover-meta li + li { border-left: 1px solid var(--rule-strong); }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ember); }

/* headline, standfirst and the spiral share one stage; the spiral is exactly as tall as the stage */
.cover-stage { position: relative; padding-top: clamp(2.5rem, 5vw, 4.25rem); }

.cover-art {
  position: absolute;
  z-index: 0;
  top: clamp(1rem, 2vw, 2rem);
  bottom: 0;
  right: -3%;
  aspect-ratio: 1;
  pointer-events: none;
}
.cover-art svg { width: 100%; height: 100%; overflow: visible; }

.cover-title {
  position: relative;
  z-index: 1;
  font: 800 min(calc(100cqi / 8.6), 9.5rem)/0.92 var(--display);
  letter-spacing: -0.045em;
  color: var(--ink);
  text-wrap: balance;
}

.cover-intro { position: relative; z-index: 1; max-width: 36rem; margin-top: clamp(2rem, 4vw, 3.25rem); }
.standfirst { max-width: 34ch; font: 400 clamp(1.2rem, 1.9vw, 1.5rem)/1.45 var(--text); color: var(--ink); }
.cover-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

/* contents strip: the chapter numbers below refer back to this */
.contents { position: relative; z-index: 1; margin-top: clamp(2.5rem, 5vw, 4rem); }
.contents ol {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1px solid var(--rule-strong);
}
.contents li + li { border-left: 1px solid var(--rule-strong); }
.contents a {
  display: grid;
  gap: 0.45rem;
  height: 100%;
  padding: 0.95rem 1rem 1.05rem;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.2s;
}
.contents li:first-child a { padding-left: 0; }
.contents a:hover { background: var(--band); }
.contents li:first-child a:hover { background: none; }
.contents a:hover .contents-label { text-decoration: underline; text-underline-offset: 3px; }
.contents-num { font: 500 0.85rem/1 var(--text); color: var(--accent); font-variant-numeric: tabular-nums; }
.contents-label { font: 700 1.02rem/1.2 var(--display); letter-spacing: -0.01em; }

/* ---------- definition ---------- */

.define { padding-block: clamp(4rem, 8vw, 7rem); }
.define-inner {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: end;
  gap: clamp(2rem, 6vw, 6rem);
}
.pull { font: 700 clamp(2.2rem, 4.8vw, 4.4rem)/1.02 var(--display); letter-spacing: -0.035em; color: var(--ink); text-wrap: balance; }
.define-body { padding-left: clamp(1.25rem, 2.5vw, 2rem); border-left: 1.5px solid var(--ink); }
.define-entry { display: flex; align-items: baseline; gap: 0.6rem; }
.define-entry dfn { font: 700 1.35rem/1 var(--display); color: var(--ink); }
.define-pos { font: 400 0.95rem/1 var(--text); color: var(--meta); }
.define-text { margin-top: 0.8rem; font-size: 1.15rem; line-height: 1.5; color: var(--ink); }
.define-note { margin-top: 0.9rem; }

/* ---------- chapters ---------- */

.chapter { padding-block: clamp(4.5rem, 9vw, 7.5rem); border-top: 1px solid var(--rule-strong); }
.chapter-band { background: var(--band); border-top-color: transparent; }
.chapter-flush { border-top-color: transparent; }

.chapter-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: clamp(1.5rem, 4vw, 4rem); }

.chapter-label { position: sticky; top: 108px; align-self: start; display: grid; gap: 0.45rem; }
.chapter-num { font: 800 clamp(2.6rem, 4.4vw, 3.8rem)/0.9 var(--display); letter-spacing: -0.04em; color: var(--ink); }
.chapter-name { font: 500 1rem/1.3 var(--text); color: var(--meta); }

.chapter-body h2 {
  max-width: 17ch;
  font: 800 clamp(2.1rem, 4.2vw, 3.7rem)/1.02 var(--display);
  letter-spacing: -0.04em;
  color: var(--ink);
  text-wrap: balance;
}
.chapter-lead { max-width: 46ch; margin-top: 1.25rem; font-size: clamp(1.1rem, 1.5vw, 1.25rem); line-height: 1.5; text-wrap: balance; }
.chapter-cta { margin-top: 2.25rem; }

/* services as an index */
.index { margin-top: clamp(2.5rem, 4vw, 3.5rem); border-top: 1.5px solid var(--ink); }
.index-row {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 4fr) minmax(0, 6fr);
  align-items: baseline;
  gap: 0.4rem 1.5rem;
  padding-block: 1.35rem;
  border-bottom: 1px solid var(--rule-strong);
}
.index-ref { font: 500 0.95rem/1 var(--text); color: var(--accent); font-variant-numeric: tabular-nums; }
.index-title { font: 700 clamp(1.15rem, 1.7vw, 1.4rem)/1.2 var(--display); letter-spacing: -0.015em; color: var(--ink); }

/* security principles */
.principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2rem, 4vw, 3.5rem);
  margin-top: clamp(2.5rem, 4vw, 3.5rem);
}
.principle {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  align-content: start;
  column-gap: 1rem;
  padding-block: 1.6rem 1.9rem;
  border-top: 1.5px solid var(--ink);
}
.principle-num { grid-row: span 2; font: 400 clamp(2.9rem, 4.6vw, 3.9rem)/0.82 var(--display); letter-spacing: -0.04em; color: var(--ink); }
.principle h3 { font: 700 1.3rem/1.2 var(--display); letter-spacing: -0.01em; color: var(--ink); }
.principle p { margin-top: 0.5rem; }

/* process timeline */
.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
  margin-top: clamp(2.5rem, 4vw, 3.5rem);
}
.timeline-step { position: relative; padding-top: 1.5rem; border-top: 1.5px solid var(--ink); }
.timeline-step::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ember);
}
.timeline-num { font: 500 0.9rem/1 var(--text); color: var(--accent); }
.timeline-step h3 { margin-top: 0.8rem; font: 700 1.55rem/1.1 var(--display); letter-spacing: -0.02em; color: var(--ink); }
.timeline-step p { margin-top: 0.6rem; font-size: 1rem; }

/* ---------- inverted band ---------- */

.invert { padding-block: clamp(5rem, 10vw, 8rem); background: var(--ink); color: var(--on-ink); }
.invert-inner {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  align-items: end;
  gap: clamp(2rem, 5vw, 5rem);
}
.invert h2 { font: 800 clamp(2.3rem, 4.6vw, 4rem)/1 var(--display); letter-spacing: -0.04em; color: var(--paper); text-wrap: balance; }
.invert-side p { max-width: 40ch; font-size: 1.15rem; line-height: 1.55; }
.invert-side .pill { margin-top: 1.75rem; }
.invert-side .pill-ember:hover { background: var(--paper); color: var(--ink); }
.invert :focus-visible { outline-color: var(--paper); }

/* ---------- questions ---------- */

.faq-list { margin-top: clamp(2rem, 4vw, 3rem); border-top: 1.5px solid var(--ink); }
.faq-list details { border-bottom: 1px solid var(--rule-strong); }
.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.35rem;
  list-style: none;
  cursor: pointer;
  font: 700 clamp(1.1rem, 1.6vw, 1.3rem)/1.3 var(--display);
  color: var(--ink);
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  background:
    linear-gradient(var(--ink), var(--ink)) center / 14px 1.5px no-repeat,
    linear-gradient(var(--ink), var(--ink)) center / 1.5px 14px no-repeat;
  transition: transform 0.25s var(--ease);
}
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p { max-width: 60ch; padding-bottom: 1.4rem; }

/* ---------- contact ---------- */

.contact-alt { margin-top: 1rem; color: var(--meta); }
.contact-alt a { color: var(--ink); text-underline-offset: 3px; }

.contact-card {
  margin-top: clamp(2rem, 4vw, 3rem);
  padding: clamp(1.4rem, 3.5vw, 2.75rem);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--card);
}

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem 2rem; }
.field { display: grid; gap: 0.3rem; }
.field-wide { grid-column: 1 / -1; }
.field > span { font: 500 0.9rem/1.2 var(--text); color: var(--meta); }
.field em { margin-left: 0.3rem; font-style: normal; font-weight: 400; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0;
  border: 0;
  border-bottom: 1.5px solid var(--field-line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1.05rem/1.4 var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { min-height: 6.5rem; resize: vertical; }
.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1.75rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%230D0E17' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.2rem center / 12px 8px;
}
.field input::placeholder, .field textarea::placeholder { color: #6E7186; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: 0 1.5px 0 0 var(--ink);
}

.enquiry .pill { margin-top: 2rem; }
.form-status { margin-top: 1rem; font-weight: 500; color: var(--accent); }
.form-status:empty { display: none; }
.form-note { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-size: 0.92rem; color: var(--meta); }

/* ---------- colophon ---------- */

.colophon { overflow: clip; border-top: 3px solid var(--ink); }
.colophon-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  padding-block: 2.25rem;
}
.colophon-brand { display: flex; align-items: center; gap: 0.75rem; font: 700 1.05rem/1 var(--display); color: var(--ink); }
.colophon-brand img { width: 36px; height: 36px; }
.colophon nav ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; list-style: none; margin: 0; padding: 0; }
.colophon nav a { font-weight: 500; color: var(--ink); text-decoration: none; }
.colophon nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.colophon-meta { font-size: 0.92rem; text-align: right; color: var(--meta); }
.colophon-meta p + p { margin-top: 0.25rem; }

.colophon-word-wrap { container-type: inline-size; }
.colophon-word {
  margin-bottom: -0.14em;
  font: 800 calc(100cqi / 10.45)/0.8 var(--display);
  letter-spacing: -0.045em;
  white-space: nowrap;
  color: var(--ink);
  user-select: none;
}

/* ---------- motion: one load sequence, a slow spiral, gentle reveals ---------- */

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  .cover-meta { animation: fade 0.6s var(--ease) both; }
  .cover-title { animation: rise 0.9s var(--ease) 0.05s both; }
  .cover-art { animation: bloom 1.4s var(--ease) both; }
  .cover-intro { animation: fade 0.8s var(--ease) 0.25s both; }
  .contents { animation: fade 0.8s var(--ease) 0.4s both; }
  .cover-art .spiral { transform-origin: 300px 300px; animation: spin 90s linear infinite; }
  .cover-art .halo { transform-origin: 300px 300px; animation: breathe 9s ease-in-out infinite; }
}

@keyframes rise { from { opacity: 0; transform: translateY(0.18em); } to { opacity: 1; transform: none; } }
@keyframes bloom { from { opacity: 0; transform: scale(0.92) rotate(-18deg); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe {
  0%, 100% { opacity: 0.75; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .masthead-nav a, .pill, .contents a, .faq-list summary::after { transition: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .contents ol { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .contents li + li { border-left: 0; }
  .contents li:not(:nth-child(3n + 1)) { border-left: 1px solid var(--rule-strong); }
  .contents li:nth-child(n + 4) { border-top: 1px solid var(--rule); }
  .contents li:nth-child(3n + 1) a { padding-left: 0; }
  .contents li:nth-child(3n + 1) a:hover { background: none; }
}

@media (max-width: 1180px) {
  .masthead-row { gap: 1.5rem; }
  .masthead-nav ul { gap: 1.1rem; }
}

@media (max-width: 960px) {
  .masthead-nav { display: none; }
}

@media (max-width: 900px) {
  .chapter-grid { grid-template-columns: 1fr; }
  .chapter-label { position: static; display: flex; align-items: baseline; gap: 0.9rem; }
  .define-inner, .invert-inner { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2.5rem; }
}

@media (max-width: 760px) {
  .principles { grid-template-columns: 1fr; }
  .index-row { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .index-desc { grid-column: 2; }
  .cover-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cover-meta li:nth-child(2) { display: none; }
  .cover-meta li { padding: 0.2rem 0 0.9rem; font-size: 0.86rem; }
  .cover-meta li + li { padding-left: 1rem; }
  .contents ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contents li:not(:nth-child(3n + 1)) { border-left: 0; }
  .contents li:nth-child(n + 4) { border-top: 0; }
  .contents li:nth-child(3n + 1) a { padding-left: 1rem; }
  .contents li:nth-child(even) { border-left: 1px solid var(--rule-strong); }
  .contents li:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .contents li:nth-child(odd) a { padding-left: 0; }
  .contents li:nth-child(odd) a:hover { background: none; }
  .field-grid { grid-template-columns: 1fr; }
  .colophon-top { flex-direction: column; align-items: flex-start; }
  .colophon-meta { text-align: left; }
}

@media (max-width: 600px) {
  .cover-title { font-size: calc(100cqi / 6.3); }
  .cover-art { top: 1.5rem; bottom: auto; right: -16%; width: 60%; }
  .cover-intro { margin-top: 3rem; }
  .timeline { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .cover-meta { grid-template-columns: 1fr; }
  .cover-meta li:first-child { display: none; }
  .cover-meta li + li { padding-left: 0; border-left: 0; }
  .invert h2 { font-size: 2.05rem; }
}

/* ---------- 404 ---------- */

.lost { min-height: calc(100vh - 75px); display: grid; align-items: center; padding-block: clamp(3rem, 8vw, 6rem); }
.lost-code { font: 800 clamp(5rem, 16vw, 12rem)/0.85 var(--display); letter-spacing: -0.05em; color: var(--ink); }
.lost-title { max-width: 16ch; margin-top: 1.5rem; font: 800 clamp(1.9rem, 4vw, 3.2rem)/1.05 var(--display); letter-spacing: -0.035em; color: var(--ink); text-wrap: balance; }
.lost-text { max-width: 44ch; margin-top: 1rem; font-size: 1.15rem; }
.lost .pill { margin-top: 2rem; }
.lost .dot { display: inline-block; width: 0.16em; height: 0.16em; margin-left: 0.04em; border-radius: 50%; background: var(--ember); vertical-align: baseline; }
