/*
 * "Glitch" design, direction 2a (dark). Palette from photos of a glitching monitor.
 * Every text/background pair is WCAG AA: ≥ 4.5:1 for body text, ≥ 3:1 for
 * large headlines. Body copy never sits on the magenta.
 */
:root {
  color-scheme: dark;

  --ink: #0b0a10;
  --panel: #1a1722;
  --panel-hover: #2a2535;
  --text: #fff;
  --muted: #cfc9d6;
  --pink: #f2a6e6;
  /* Deepened from the mock's #d81fcf so white text on it passes AA (4.79:1). */
  --magenta: #c81cc0;
  --magenta-deep: #a30f9b;
  --cyan: #8fe6ff;
  --mustard: #d4a51f;
  --mustard-deep: #a67e14;
  --gold-line: #c9a227;
  --green-line: #5ddc5d;

  --gutter: 40px;
  --header-h: 76px;
  --max: 1280px;

  /* Stair-stepped "blocky rounded" corners (12px). */
  --stair: polygon(0 12px, 4px 12px, 4px 6px, 8px 6px, 8px 2px, 12px 2px, 12px 0, calc(100% - 12px) 0, calc(100% - 12px) 2px, calc(100% - 8px) 2px, calc(100% - 8px) 6px, calc(100% - 4px) 6px, calc(100% - 4px) 12px, 100% 12px, 100% calc(100% - 12px), calc(100% - 4px) calc(100% - 12px), calc(100% - 4px) calc(100% - 6px), calc(100% - 8px) calc(100% - 6px), calc(100% - 8px) calc(100% - 2px), calc(100% - 12px) calc(100% - 2px), calc(100% - 12px) 100%, 12px 100%, 12px calc(100% - 2px), 8px calc(100% - 2px), 8px calc(100% - 6px), 4px calc(100% - 6px), 4px calc(100% - 12px), 0 calc(100% - 12px));
  /* Larger 24px stair for images. */
  --stair-lg: polygon(0 24px, 8px 24px, 8px 12px, 16px 12px, 16px 4px, 24px 4px, 24px 0, calc(100% - 24px) 0, calc(100% - 24px) 4px, calc(100% - 16px) 4px, calc(100% - 16px) 12px, calc(100% - 8px) 12px, calc(100% - 8px) 24px, 100% 24px, 100% calc(100% - 24px), calc(100% - 8px) calc(100% - 24px), calc(100% - 8px) calc(100% - 12px), calc(100% - 16px) calc(100% - 12px), calc(100% - 16px) calc(100% - 4px), calc(100% - 24px) calc(100% - 4px), calc(100% - 24px) 100%, 24px 100%, 24px calc(100% - 4px), 16px calc(100% - 4px), 16px calc(100% - 12px), 8px calc(100% - 12px), 8px calc(100% - 24px), 0 calc(100% - 24px));
  /* Torn corner for callouts. */
  --tear: polygon(0 100%, 0 0, 100% 0, 100% 72%, 92% 100%);
}

@media (max-width: 40rem) {
  :root {
    --gutter: 20px;
  }
}

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

html {
  background: var(--ink);
}

body {
  margin: 0;
  font-family: Archivo, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

a:hover {
  color: var(--pink);
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

img,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--text);
  color: var(--ink);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  margin: 0;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pink);
}

.eyebrow--gold {
  font-size: 12px;
  color: var(--mustard);
}

/* ---------- Frame + decoration ---------- */

.frame {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.frame > :not(.decor) {
  position: relative;
}

.decor,
.decor > * {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Thin rotated scan lines. Centred at 54.5% so they land where the mock put them. */
.decor > .scan {
  inset: auto;
  top: var(--top);
  left: -18.2%;
  width: 145.4%;
  height: 1px;
  background: var(--gold-line);
  opacity: var(--alpha);
  transform: rotate(var(--angle));
}

.decor > .scan--green {
  height: 2px;
  background: var(--green-line);
}

/* Home: magenta wedge ends just above the tagline, whatever the headline size. */
.frame--home {
  --intro-top: 150px;
  --name-size: clamp(2.75rem, 13vw, 7rem);
  --wedge-y: calc(var(--header-h) + var(--intro-top) + 1.8 * var(--name-size) + 13px);
}

.decor-wedge {
  background: var(--magenta);
  clip-path: polygon(0 0, 58% 0, 0 var(--wedge-y));
}

.decor-wedge-corner {
  background: var(--magenta-deep);
  clip-path: polygon(0 0, 132px 0, 0 122px);
}

.decor > .decor-cyan {
  inset: auto;
  top: 0;
  left: 58.2%;
  width: 300%;
  height: 2px;
  background: var(--cyan);
  transform-origin: 0 0;
  transform: rotate(127deg);
}

.decor-tear {
  background: var(--mustard);
  clip-path: polygon(0 100%, 0 calc(100% - 137px), 30% calc(100% - 76px), 48% calc(100% - 76px), 56% 100%);
}

.decor-tear-shadow {
  background: var(--mustard-deep);
  clip-path: polygon(0 100%, 0 calc(100% - 76px), 22% calc(100% - 46px), 34% 100%);
}

/* Inner pages: magenta corner top-right, mustard tear bottom-left. */
.decor-corner {
  background: var(--magenta);
  clip-path: polygon(100% 0, 100% 258px, 76% 0);
}

.decor-corner-cyan {
  background: var(--cyan);
  /* The mock's sliver, polygon(76% 0, 78% 0, 100% 228px, 100% 205px), cut off
     above the header row: white nav text on cyan would fail contrast. */
  clip-path: polygon(84.9% 76px, 85.33% 76px, 100% 228px, 100% 205px);
}

.decor-tear-inner {
  background: var(--mustard);
  clip-path: polygon(0 100%, 0 calc(100% - 61px), 20% calc(100% - 30px), 28% 100%);
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  height: var(--header-h);
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.02em;
}

.site-header a {
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 28px;
}

.site-header nav .is-active {
  border-bottom: 2px solid currentColor;
}

@media (max-width: 40rem) {
  .site-header nav {
    gap: 20px;
  }
}

/* ---------- Stair-step cards ---------- */

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 14px 18px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
  text-decoration: none;
  clip-path: var(--stair);
}

.card:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.card:focus-visible {
  outline-offset: -8px;
}

.card-title {
  font-weight: 700;
}

.card-year {
  flex: none;
  color: var(--pink);
}

.card-desc {
  flex-basis: 100%;
  color: var(--muted);
}

/* ---------- Home ---------- */

.home {
  flex: 1;
  display: grid;
  padding-bottom: 40px;
}

.home-intro {
  max-width: 820px;
  padding-top: var(--intro-top);
}

.home-intro h1 {
  margin: 0;
  font-weight: 900;
  font-size: var(--name-size);
  line-height: 0.9;
  letter-spacing: -0.035em;
}

.home-intro p {
  max-width: 480px;
  margin: 28px 0 0;
  padding-top: 12px;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.3;
}

.home-docs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 60rem) {
  .frame--home {
    min-height: max(100svh, 760px);
  }

  /* Intro top-left, docs bottom-right, sharing one grid cell. */
  .home {
    grid-template-areas: "stack";
  }

  .home-intro,
  .home-docs {
    grid-area: stack;
  }

  .home-intro {
    align-self: start;
  }

  .home-docs {
    align-self: end;
    justify-self: end;
    width: 400px;
  }
}

@media (max-width: 59.99rem) {
  .home-docs {
    max-width: 560px;
    margin-top: 64px;
    /* Clear the mustard tear. */
    padding-bottom: 120px;
  }
}

@media (max-width: 40rem) {
  .frame--home {
    --intro-top: 88px;
  }

  .home-intro p {
    font-size: 20px;
  }
}

/* ---------- Doc page ---------- */

.doc {
  flex: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "meta body"
    "more body";
  gap: 18px 60px;
  align-items: start;
  padding-top: 40px;
  padding-bottom: 32px;
  font-size: 14px;
}

.doc-meta {
  grid-area: meta;
  padding: 18px;
  background: var(--panel);
  clip-path: var(--stair);
}

.doc-meta p {
  margin: 0;
}

.doc-meta .doc-period {
  margin-top: 10px;
  font-weight: 700;
}

.doc-meta .doc-role {
  margin-top: 4px;
  color: var(--muted);
}

.doc-body {
  grid-area: body;
  max-width: 620px;
}

.doc-more {
  grid-area: more;
}

.doc-more h2 {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}

.doc-more ul {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.doc-more a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
  text-decoration: none;
}

.doc-more .year {
  flex: none;
  color: var(--pink);
}

@media (max-width: 59.99rem) {
  .doc {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas:
      "meta"
      "body"
      "more";
    gap: 40px;
  }

  .doc-meta {
    max-width: 360px;
  }
}

/* ---------- Docs index, 404 ---------- */

.listing {
  flex: 1;
  padding-top: 40px;
  padding-bottom: 32px;
}

.listing > h1 {
  margin: 0 0 40px;
  font-weight: 900;
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.listing .cards {
  max-width: 720px;
}

/* ---------- Long-form text ---------- */

.prose {
  font-size: 19px;
  line-height: 1.55;
}

.prose h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.prose > * {
  margin: 20px 0 0;
}

.prose > h1 + * {
  margin-top: 28px;
}

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

.prose h2,
.prose h3 {
  margin-top: 48px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.prose h2 {
  font-size: 28px;
}

.prose h3 {
  font-size: 22px;
}

.prose a {
  color: var(--pink);
  text-underline-offset: 0.15em;
}

.prose a:hover {
  color: var(--text);
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

/* Callout: mustard block with a torn corner. */
.prose blockquote {
  margin: 36px 0 0;
  padding: 22px 26px;
  background: var(--mustard);
  color: var(--ink);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.4;
  clip-path: var(--tear);
}

.prose blockquote > * {
  margin: 0;
}

.prose blockquote > * + * {
  margin-top: 12px;
}

.prose blockquote a,
.prose blockquote a:hover {
  color: var(--ink);
}

.prose blockquote + * {
  margin-top: 28px;
}

.prose figure,
.prose > picture,
.prose > p > picture {
  margin-top: 36px;
}

.prose img {
  clip-path: var(--stair-lg);
}

.prose figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.prose pre,
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--panel);
}

.prose code {
  padding: 0.1em 0.3em;
}

.prose pre {
  padding: 16px 18px;
  overflow-x: auto;
  clip-path: var(--stair);
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose hr {
  margin-block: 48px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Footnotes (markdown-it-footnote). */
.prose .footnotes-sep {
  margin-bottom: 4px;
}

.prose .footnote-ref {
  font-size: 0.7em;
  line-height: 0;
}

.prose .footnote-ref a {
  padding-inline: 0.1em;
  text-decoration: none;
}

.prose .footnotes {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.prose .footnotes-list {
  margin: 0;
}

.prose .footnote-item + .footnote-item {
  margin-top: 8px;
}

.prose .footnote-item p {
  margin: 0;
}

.prose .footnote-backref {
  text-decoration: none;
}

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

.site-footer {
  padding-block: 0 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.site-footer p {
  margin: 0;
}
