/* Fonts */
@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* Tokens */
:root {
  /* Colours are light-dark(light, dark). Dark comes first in color-scheme so
     it wins when the device states no preference; theme.js can force either. */
  color-scheme: dark light;

  --bg: light-dark(#f6f7f9, #0d0f13);
  --surface: light-dark(#ffffff, #171a21);
  --text: light-dark(#14171a, #e8eaed);
  --text-muted: light-dark(#5b6470, #9aa3ae);
  --border: light-dark(#e3e6ea, #2a2f38);
  --dot: light-dark(#d9dee4, #252a33);
  --shadow: 0 8px 24px light-dark(rgb(20 23 26 / 0.08), rgb(0 0 0 / 0.45));

  /* Site accent: portfolio orange, as on the bjd859.com card */
  --c-portfolio: light-dark(#a85a09, #fb923c);
  --c-portfolio-strong: light-dark(#8a4907, #fdba74);

  /* One colour per kind of work. Each passes AA at any size in both themes;
     -strong has more contrast still. Web and video match the hub's tech
     green and video purple; production matches the video site's cyan. */
  --c-web: light-dark(#15803d, #4ade80);
  --c-web-strong: light-dark(#166534, #86efac);
  --c-video: light-dark(#9d27b0, #c084fc);
  --c-video-strong: light-dark(#7b1fa2, #d8b4fe);
  --c-production: light-dark(#0e7490, #22d3ee);
  --c-production-strong: light-dark(#155e75, #67e8f9);
  --c-design: light-dark(#a85a09, #fb923c);
  --c-design-strong: light-dark(#8a4907, #fdba74);
  --c-photo: light-dark(#be185d, #f472b6);
  --c-photo-strong: light-dark(#9d174d, #f9a8d4);

  --accent: var(--c-portfolio);
  --accent-strong: var(--c-portfolio-strong);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-lede: clamp(1rem, 2vw, 1.15rem);
  --text-h1: clamp(1.7rem, 5.8vw, 3.4rem);
  --text-h1-page: clamp(1.7rem, 4vw, 2.3rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 4rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);

  --measure: 62ch;
  --wide: 1040px;
  --shot-ratio: 16 / 10;

  --radius: 14px;
  --radius-sm: 8px;
  --focus-width: 2px;
  --dot-gap: 26px;
  --glow-radius: 160px;
  --toggle-size: 2.5rem;
  --ease: 0.15s ease;
  --ease-slow: 0.3s ease;
}

/* Set by theme.js when the visitor picks a theme */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

/* Kinds of work: set on each project card. Add a token pair above and a
   class here for a new kind. */
.kind-web {
  --accent: var(--c-web);
  --accent-strong: var(--c-web-strong);
}

.kind-video {
  --accent: var(--c-video);
  --accent-strong: var(--c-video-strong);
}

.kind-production {
  --accent: var(--c-production);
  --accent-strong: var(--c-production-strong);
}

.kind-design {
  --accent: var(--c-design);
  --accent-strong: var(--c-design-strong);
}

.kind-photo {
  --accent: var(--c-photo);
  --accent-strong: var(--c-photo-strong);
}

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

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

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.55;
}

a {
  color: inherit;
}

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

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--text);
  color: var(--surface);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

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

/* Dot grid background, with a cursor-following highlight added by cursor-fx.js */
.dot-grid,
.dot-grid-highlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
  background-size: var(--dot-gap) var(--dot-gap);
  pointer-events: none;
}

.dot-grid-highlight {
  background-image: radial-gradient(circle, var(--accent) 1.5px, transparent 1.5px);
  opacity: 0.55;
  mask-image: radial-gradient(
    circle var(--glow-radius) at var(--x, 50%) var(--y, 50%),
    black,
    transparent 70%
  );
}

@media (prefers-reduced-motion: reduce), (hover: none) {
  .dot-grid-highlight {
    display: none;
  }
}

.site-header,
.page,
.site-footer {
  position: relative;
  z-index: 1;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--gutter) 0;
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-decoration: none;
}

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

/* Theme toggle: stays hidden until theme.js wires it up */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--toggle-size);
  height: var(--toggle-size);
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle__icon {
  transition: transform var(--ease-slow);
}

.theme-toggle[aria-pressed="true"] .theme-toggle__icon {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle__icon {
    transition: none;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Page shell */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-7) var(--gutter) var(--space-8);
  text-align: center;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
}

h1 {
  font-size: var(--text-h1-page);
  line-height: 1.15;
  margin: 0 0 var(--space-4);
}

.lede {
  max-width: 46ch;
  margin: 0 0 var(--space-7);
  font-size: var(--text-lede);
  color: var(--text-muted);
}

.panel .lede {
  margin-bottom: 0;
}

/* Wordmark suffix */
.wordmark__sub {
  margin-left: var(--space-1);
  color: var(--accent);
}

/* Intro (index) */
.intro {
  max-width: var(--measure);
  margin-bottom: var(--space-7);
}

.intro .lede {
  margin: 0 auto;
}

/* Project cards (index) */
.projects {
  display: grid;
  gap: var(--space-5);
  width: 100%;
  max-width: var(--wide);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 760px) {
  .projects {
    grid-template-columns: 1fr 1fr;
  }
}

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}

.project:has(.project__link:hover),
.project:has(.project__link:focus-visible) {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .project:has(.project__link:hover),
  .project:has(.project__link:focus-visible) {
    transform: none;
  }
}

.project__shot {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--shot-ratio);
  object-fit: cover;
  object-position: top;
  border-bottom: 1px solid var(--border);
}

.project__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--space-5);
}

.project__kind {
  margin: 0 0 var(--space-3);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
}

.project__text {
  margin: 0;
  font-size: var(--text-base);
  color: var(--text-muted);
}

.project__meta {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.project__go {
  margin-top: auto;
  padding-top: var(--space-4);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--accent-strong);
}

/* The link covers the whole card, so the card is one click target */
.project__link {
  color: inherit;
  text-decoration: none;
}

.project__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.project__link:focus-visible {
  outline: none;
}

.project:has(.project__link:focus-visible) {
  outline: var(--focus-width) solid var(--accent);
  outline-offset: 2px;
}

/* Placeholder card: marks a slot still to be filled */
.project--placeholder {
  background: transparent;
  border: 1px dashed var(--accent);
}

.project__blank {
  display: grid;
  place-items: center;
  aspect-ratio: var(--shot-ratio);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px dashed var(--accent);
}

/* Panels (sub pages) */
.panel {
  width: 100%;
  max-width: 560px;
  padding: clamp(var(--space-5), 4vw, var(--space-7));
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel--wide {
  max-width: 720px;
}

.back-link {
  display: inline-block;
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.crosslink {
  margin: var(--space-5) 0 0;
  font-size: var(--text-base);
  color: var(--text-muted);
}

.crosslink a {
  font-weight: 600;
  color: var(--text);
}

/* Footer */
.site-footer {
  padding: var(--space-5);
  font-size: var(--text-xs);
  text-align: center;
  color: var(--text-muted);
}
