/*
  murus.dev

  The plan output is the artifact, so it gets the space and the page is built
  around it rather than around a headline. Structure comes from alignment and
  measure, never from boxes.

  Type is a 1.25 modular scale and space is a base-8 scale. Both are exposed as
  role-named tokens (--text-lede, --space-section) rather than as sizes, so a
  change to the scale does not mean hunting for every 1.0625rem in the file.
*/

:root {
  /* ---- colour ---- */
  --ground: #12100d;
  --raised: #191611;
  --ink: #e7e1d5;
  --muted: #8c8377;
  --stone: #b3a894;
  --amber: #e9a63c;
  --add: #8fb85c;
  --remove: #d97b62;

  /* ---- type scale: 1rem base, 1.25 ratio ---- */
  --step--1: 0.8rem; /* 12.8px, the smallest size used anywhere */
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.9531rem;

  /* ---- semantic type roles ---- */
  --text-lede: clamp(var(--step-1), 1.05rem + 1.5vw, var(--step-3));
  --text-heading: var(--step-1);
  --text-body: var(--step-0);
  --text-meta: 0.875rem;
  --text-caption: 0.9375rem;
  /* Floor is 0.8125rem (13px). The block scrolls rather than shrinking below
     that, because 88 columns of plan output at 11px is not readable type. */
  --text-terminal: clamp(0.8125rem, 0.7rem + 0.4vw, 0.9375rem);

  /* ---- line height, one value per group ---- */
  --leading-display: 1.2;
  --leading-heading: 1.3;
  --leading-body: 1.65;
  --leading-mono: 1.7;

  /* ---- letter spacing, one value per group ---- */
  --tracking-display: -0.015em;
  --tracking-heading: -0.005em;
  --tracking-mono: 0.02em;

  /* ---- space: base-8 ---- */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --space-12: 6rem;

  /* Component spacing and layout spacing are deliberately separate scales, so
     a change to section rhythm never resizes the padding inside the terminal. */
  --space-component: var(--space-3);
  --space-block: var(--space-4);
  --space-section: var(--space-8);
  --space-page-gutter: var(--space-3);

  --measure: 34rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0 var(--space-page-gutter) var(--space-12);
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 60rem;
  margin: 0 auto;
}

/* Keyboard users get the same wayfinding as pointer users. */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus-visible {
  left: var(--space-3);
  top: var(--space-2);
  z-index: 1;
  background: var(--raised);
  color: var(--ink);
  padding: var(--space-1) var(--space-2);
  text-decoration: none;
}

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

.masthead {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) 0 var(--space-8);
}

.masthead img {
  width: 28px;
  height: 28px;
  display: block;
}

.wordmark {
  font-family: var(--mono);
  font-size: var(--step-0);
  letter-spacing: var(--tracking-mono);
  color: var(--ink);
  text-decoration: none;
}

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-meta);
}

/* ---- links ---------------------------------------------------------- */

a {
  color: var(--stone);
  text-decoration-color: color-mix(in srgb, var(--stone) 40%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--amber);
  text-decoration-color: var(--amber);
}

.masthead nav a,
footer nav a {
  text-decoration: none;
  color: var(--muted);
}

.masthead nav a:hover,
footer nav a:hover {
  color: var(--ink);
}

/* ---- the artifact --------------------------------------------------- */

.lede {
  font-size: var(--text-lede);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  margin: 0 0 var(--space-block);
  max-width: 24ch;
  font-weight: 500;
}

/*
  Depth comes from tone and a self-coloured edge, not from a border or a
  shadow. The top lip is the raised surface's own colour lifted a few percent,
  so it reads as light catching an edge rather than as a line drawn round a
  box. The grain is a single inline SVG turbulence tile at very low opacity; it
  sits under the text, breaks up the flat fill, and stops the surface banding
  against the ground.
*/
.terminal,
.command {
  position: relative;
  font-family: var(--mono);
  font-size: var(--text-terminal);
  line-height: var(--leading-mono);
  background-color: var(--raised);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  color: var(--stone);
  padding: var(--space-component);
  overflow-x: auto;
  margin: 0;
  white-space: pre;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 7%, transparent);
}

.command {
  color: var(--ink);
  margin-bottom: var(--space-2);
}

/* The glyph carries the meaning, so the colour is reinforcement and never the
   only signal. Reading the plan in monochrome still works. */
.terminal .add {
  color: var(--add);
}
.terminal .change {
  color: var(--amber);
}
.terminal .remove {
  color: var(--remove);
}
.terminal .dim {
  color: var(--muted);
}
.terminal .strong {
  color: var(--ink);
  font-weight: 600;
}

.caption {
  color: var(--muted);
  font-size: var(--text-caption);
  margin: var(--space-2) 0 0;
  max-width: var(--measure);
}

/* ---- prose ---------------------------------------------------------- */

.prose {
  max-width: var(--measure);
  margin: var(--space-section) 0 0;
}

.prose h1 {
  font-size: var(--step-2);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-display);
  margin: 0 0 var(--space-1);
  font-weight: 600;
}

.prose h2 {
  font-size: var(--text-heading);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  margin: var(--space-6) 0 var(--space-1);
  font-weight: 600;
}

.prose > h2:first-child {
  margin-top: 0;
}

.prose p,
.prose li {
  color: color-mix(in srgb, var(--ink) 88%, var(--ground));
}

.prose ul {
  padding-left: var(--space-2);
}

.prose li {
  margin-bottom: var(--space-1);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  color: var(--stone);
}

.updated {
  color: var(--muted);
  font-size: var(--text-meta);
  margin: 0 0 var(--space-block);
}

/* The one thing on a policy page that must not be skimmed past. It is set
   apart by measure and weight rather than by a bar drawn down its edge. */
.pull {
  margin: var(--space-4) 0;
  padding: 0;
  color: var(--ink);
  font-size: var(--step-1);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  max-width: 30ch;
}

/* ---- footer --------------------------------------------------------- */

footer {
  margin-top: var(--space-12);
  padding-top: var(--space-3);
  color: var(--muted);
  font-size: var(--text-meta);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: baseline;
  justify-content: space-between;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}

footer em {
  font-style: italic;
}

/* ---- narrow --------------------------------------------------------- */

@media (max-width: 34rem) {
  :root {
    --space-section: var(--space-6);
  }

  .masthead {
    padding-bottom: var(--space-6);
  }

  .masthead nav {
    gap: var(--space-2);
  }

  footer {
    justify-content: flex-start;
  }
}
