/* Shared styles for toppingdesign.com: "Engineering Editorial" (see DESIGN.md).
   Pages link this, then add their own page-specific rules. */

:root {
  color-scheme: light dark;
  --bg: light-dark(#fafaf8, #050505);
  --panel: light-dark(#f2f3f5, #0c0c0c);
  --line: light-dark(#e5e7eb, #2a2a2a);
  --ink: light-dark(#1f2937, #f4f4f4);
  --ink-soft: light-dark(#374151, #d4d4d4);
  --muted: light-dark(#5b6472, #9a9a9a);
  --blue: light-dark(#2563eb, #2f6bff);
  --blue-wash: light-dark(rgba(37, 99, 235, 0.08), rgba(47, 107, 255, 0.12));
  --lime: light-dark(#a3ff12, #d7ff3f);
  --sans: Inter, system-ui, sans-serif;
  --head: Sora, Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 46rem;
  --wide: 64rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 1.5rem 1.25rem 6rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.03rem, 0.5vw + 0.9rem, 1.12rem);
  line-height: 1.65;
  text-wrap: pretty;
}

.col { max-width: var(--measure); margin-inline: auto; }
.wide { max-width: var(--wide); margin-inline: auto; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* Off-site links open in a new tab and carry a small arrow. */
a[target="_blank"]::after {
  content: "";
  content: "" / " (opens in a new tab)";
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.22em;
  vertical-align: 0.12em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M4 1.5h6.5V8M10.5 1.5 1.5 10.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M4 1.5h6.5V8M10.5 1.5 1.5 10.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Mono labels: eyebrows, captions, meta. */
.label,
.kicker,
.back {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.back { color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }

/* Essay layout */
.essay-header { padding: clamp(3rem, 10vw, 6rem) 0 2.2rem; border-bottom: 1px solid var(--line); }
.kicker { margin: 0 0 1rem; color: var(--muted); }
.essay-header h1 {
  max-width: 18ch;
  margin: 0;
  font-family: var(--head);
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.dek { max-width: 36rem; margin: 1.3rem 0 0; color: var(--muted); font-size: 1.1em; line-height: 1.45; }

article { padding-top: 2.2rem; }
article p { margin: 0 0 1.3em; }
article h2 {
  margin: 2.8em 0 0.8em;
  font-family: var(--head);
  font-size: 1.35em;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
article ul { margin: -0.5em 0 1.4em; padding-left: 1.25em; }
article li { margin: 0.3em 0; }
article li::marker { color: var(--blue); }
article code { font-family: var(--mono); font-size: 0.88em; }

blockquote {
  margin: 2rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--blue);
  font-family: var(--head);
  font-size: 1.2em;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
blockquote p { margin: 0; }

figure { margin: 2.6rem 0; }
figure img,
figure video { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
figcaption { margin-top: 0.7rem; color: var(--muted); font-family: var(--mono); font-size: 0.74rem; line-height: 1.55; }

table { width: 100%; border-collapse: collapse; margin: 0 0 0.6rem; font-size: 0.9em; font-variant-numeric: tabular-nums; }
th, td { padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 500; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; }
td:last-child { font-family: var(--mono); font-size: 0.92em; }

.signoff { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; }

@media (max-width: 38rem) {
  body { padding-inline: 1rem; }
}
