/*
  Design tokens — edit here to control colour, type, and spacing site-wide.
  Pages keep legacy aliases (--bg, --ink, --col-gap, …) so existing CSS keeps working.
*/

@font-face {
  font-family: "ABC Areal Semi Mono";
  src: url("../fonts/ABCArealSemiMono-Medium.woff2") format("woff2");
  /* One Medium file covers the weights pages already request. */
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ABC Areal Semi Mono";
  src: url("../fonts/ABCArealSemiMono-MediumItalic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Imperial";
  src: url("../fonts/imperialBetaV01-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* —— Themes (edit these) —— */
  --theme-paper-bg: #f3f3f6;
  --theme-paper-ink: #111111;
  --theme-paper-muted: #7a7a7a;
  --theme-paper-swatch: #ffffff;
  --theme-paper-rule: rgba(17, 17, 17, 0.12);

  --theme-black-bg: #191919;
  --theme-black-ink: #fafafa;
  --theme-black-muted: #8a8a8a;
  --theme-black-rule: rgba(250, 250, 250, 0.16);

  --theme-colour-bg: #2717ff;
  --theme-colour-ink: #ffff00;
  --theme-colour-muted: #a0a0ff;
  --theme-colour-rule: rgba(255, 255, 0, 0.35);

  /* —— Colour (paper is the default) —— */
  /* Themes and the Live palette write --color-*. Pages read the aliases below. */
  --color-bg: var(--theme-paper-bg);
  --color-ink: var(--theme-paper-ink);
  --color-muted: var(--theme-paper-muted);
  --color-rule: var(--theme-paper-rule);

  --bg: var(--color-bg);
  --ink: var(--color-ink);
  --muted: var(--color-muted);
  --card: #ffffff;
  --card-ink: #111111;

  /* —— Fonts —— */
  --ui: "ABC Areal Semi Mono", sans-serif;
  --display: "Imperial", serif;

  /* —— Type —— */
  --text-normal: 12px;
  --text-large: 18px;
  --lead: 1.5;

  /* —— Space scale —— */
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-14: 14px;
  --space-16: 16px;
  --space-20: 20px;
  --space-28: 28px;
  --space-32: 32px;
  --space-40: 40px;
  --space-56: 56px;
  --space-64: 64px;
  --space-72: 72px;
  --space-80: 80px;
  --space-120: 120px;

  /* —— Semantic gaps —— */
  --gap-stack: var(--space-2);    /* stacked nav / meta lines */
  /* Temporary: media, text, and card share one gap. */
  --gap-text: var(--space-16);    /* between paragraphs */
  --gap-media: var(--space-16);   /* media gutters */
  --gap-card: var(--space-16);    /* inside project cards */
  --gap-block: var(--space-28);   /* story blocks, related groups */
  --gap-after-media: calc(var(--gap-block) * 3); /* after images, before the next paragraph */
  --gap-section: var(--space-120); /* between a description and the story or pictures */
  --gap-page: var(--space-80);    /* page bottom / large vertical */

  --pad: clamp(8px, 1.1vw, 14px);
  --gap-col: var(--pad);          /* main grid columns, same as the page inset */
  --header-pad-top: var(--gap-col);
  --header-pad-bottom: var(--gap-col);
  --footer-pad-top: var(--gap-col);
  --footer-pad-bottom: var(--gap-col);

  --radius: 4px;
  --col-gap: var(--gap-col);
  --cols: 1.4fr 1fr 1fr 1.2fr;
}

/* Drawing control is off for now; this also hides a cached copy of draw.js. */
#site-draw-toggle,
#site-draw-canvas {
  display: none !important;
}

html[data-theme="black"] {
  --color-bg: var(--theme-black-bg);
  --color-ink: var(--theme-black-ink);
  --color-muted: var(--theme-black-muted);
  --color-rule: var(--theme-black-rule);
}

html[data-theme="colour"] {
  --color-bg: var(--theme-colour-bg);
  --color-ink: var(--theme-colour-ink);
  --color-muted: var(--theme-colour-muted);
  --color-rule: var(--theme-colour-rule);
}

/* Homepage bio and project descriptions run to the page edge. */
p.intro-copy {
  max-width: none !important;
}

.intro-copy p,
.story p {
  max-width: none !important;
}

/* Intro paragraphs are grid rows, so column gap and paragraph margin were stacking. */
.grid.intro-copy {
  row-gap: calc((var(--col-gap) + var(--gap-text)) / 2);
}

.intro-copy p + p {
  margin-top: 0 !important;
}

.project-page .intro {
  margin-bottom: var(--gap-section);
}

.pilcrow {
  display: inline-block;
  padding-inline: var(--space-64);
}

.story p + p {
  margin-top: 0;
}

.story-figure.story-figure--small {
  grid-column: 1;
  width: max-content;
  max-width: 100%;
  margin: 0;
  justify-self: start;
  align-self: start;
}

.story-figure.story-figure--small img {
  margin-inline: 0;
}

@media (max-width: 800px) {
  .story-figure.story-figure--small {
    width: min(100%, 280px);
  }

  .story-figure--pair,
  .story-figure--grid,
  .story-figure--cols {
    row-gap: var(--gap-block) !important;
  }

  .story-figure--cols figcaption {
    width: calc(82% * 0.9) !important;
  }
}

.about-copy,
.about-bio,
.about-services {
  grid-column: 3 / -1 !important;
}

figcaption,
.tester-note {
  font-size: var(--text-normal) !important;
  color: color-mix(in srgb, var(--ink) 72%, transparent) !important;
}

/* SVG pictures stay square. Raster images can still be rounded. */
img[src$=".svg" i] {
  border-radius: 0 !important;
  clip-path: none !important;
}

.story-figure:has(img[src$=".svg" i]),
.project-media:has(img[src$=".svg" i]) {
  border-radius: 0;
  clip-path: none;
}

.theme-swatch[data-theme="paper"] { --swatch: var(--theme-paper-swatch); }
.theme-swatch[data-theme="black"] { --swatch: var(--theme-black-bg); }
.theme-swatch[data-theme="colour"] { --swatch: var(--theme-colour-bg); }
.theme-swatch[data-theme="live"] {
  --swatch: conic-gradient(#ff0040, #ffe600, #00e05a, #00c8ff, #3a2bff, #ff2bd6, #ff0040);
}
