/*! site.css — shared design system for martinharrigan.ie, quantabytes.com and
 *  blockpursuit.com. This file is byte-identical in all three repositories.
 *  Per-site colour overrides live alongside it in brand.css. */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  /* Overridden per site in brand.css. --brand is decorative (rules, marks);
     --accent must clear 4.5:1 against --bg because links use it. */
  --brand: #25557c;
  --accent: #25557c;

  --ink: #1a1a1a;
  --ink-muted: #585858;
  --bg: #ffffff;
  --bg-subtle: #f4f5f7;
  --rule: #e2e4e7;

  --measure: 43rem;
  --gutter: clamp(1.5rem, 6vw, 4rem);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e6e6;
    --ink-muted: #a2a2a2;
    --bg: #121212;
    --bg-subtle: #1d1d1d;
    --rule: #333333;
  }
}

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

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
}

/* ---------- Layout ---------- */

.site-header,
.site-footer,
main {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  padding-block: 3.5rem 1.5rem;
  margin-bottom: 3rem;
  border-bottom: 3px solid var(--brand);
}

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

.site-header a:hover .wordmark,
.site-header a:focus-visible .wordmark {
  color: var(--accent);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.wordmark img {
  display: block;
}

.wordmark .mark {
  flex: none;
  width: 1.55em;
  height: 1.55em;
}

.site-footer {
  margin-top: 5rem;
  padding-block: 1.5rem 4rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0 0 0.5rem;
}

/* ---------- Typography ---------- */

h1,
h2,
h3 {
  margin: 2.5rem 0 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  scroll-margin-top: 1.5rem;
}

h1 {
  margin-top: 0;
  font-size: 1.875rem;
}

h2 {
  font-size: 1.375rem;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.35rem;
}

/* ---------- Elements ---------- */

img,
svg,
iframe {
  max-width: 100%;
}

img,
svg {
  height: auto;
}

figure {
  margin: 2rem 0;
}

figure img {
  display: block;
}

figcaption {
  margin-top: 0.5rem;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9375em;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: var(--bg-subtle);
}

pre {
  padding: 1rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  overflow-x: auto;
}

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

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--ink-muted);
}

hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.table-wrap {
  overflow-x: auto;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.video {
  margin: 2rem 0;
  aspect-ratio: 9 / 5;
}

.video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

/* ---------- Components ---------- */

.lede {
  font-size: 1.125rem;
}

/* Inline category nav — the publication index on martinharrigan.ie. */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.toc li {
  margin: 0;
}

/* A publication or article entry. */
.entry {
  margin: 0 0 1.25rem;
}

.entry-title {
  font-weight: 600;
}

.entry-venue {
  font-style: italic;
}

.entry-links {
  color: var(--ink-muted);
}

.backlink {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.fine {
  font-size: 0.8125rem;
}

/* ---------- Print ---------- */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .site-header,
  .site-footer,
  .toc,
  .backlink {
    display: none;
  }

  main {
    max-width: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
