/* mxbwilly.com: design tokens are documented in docs/design-system.md. Keep the two in step. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-standard-normal.woff2") format("woff2-variations"),
       url("/fonts/archivo-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Hub neutrals: no hue of its own, so each project's colour reads as that project's. */
  --bg: #0e0f11;
  --surface: #15171a;
  --surface-2: #1d2024;
  --line: #262a2f;
  --line-strong: #3b4047;
  --text: #ecedee;
  --text-2: #b0b5bb;
  --text-3: #8b9097;
  --focus: #ecedee;

  /* Project accents, copied from each project's own palette (docs/projects/*.md). */
  --mxs: #f2c230;
  --mxs-hover: #f7d257;
  --mxs-ink: #16140c;
  --mxb: #3563e8;
  --mxb-hover: #2f5bd6;
  --mxb-ink: #ffffff;
  --mxb-light: #9db6ff;

  --font-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Fluid type, Utopia-style: 320px to 1240px viewports. */
  --step--1: clamp(0.8125rem, 0.79rem + 0.11vw, 0.875rem);
  --step-0: clamp(1rem, 0.957rem + 0.217vw, 1.125rem);
  --step-1: clamp(1.125rem, 1.06rem + 0.33vw, 1.3125rem);
  --step-5: clamp(2.5rem, 1.8rem + 3.5vw, 4.5rem);

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1240px;
  --radius: 8px;
  --radius-sm: 6px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.55;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; }

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

.wrap {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Header */

.site-header {
  display: flex;
  align-items: center;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding-block: 8px;
}

.brand-mark { width: 26px; height: 26px; fill: var(--text); }

.brand-word {
  font-size: 1.3125rem;
  font-weight: 800;
  font-stretch: 75%;
  letter-spacing: 0.01em;
  line-height: 1;
}

/* Intro (used by 404.html only; the home page has no intro, see docs/decisions.md) */

.intro {
  padding-top: clamp(32px, 6vw, 80px);
  padding-bottom: clamp(28px, 4vw, 48px);
}

h1 {
  margin: 0;
  max-width: 17ch;
  font-size: var(--step-5);
  font-weight: 800;
  font-stretch: 75%;
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lead {
  margin: clamp(16px, 2vw, 24px) 0 0;
  max-width: 58ch;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--text-2);
  text-wrap: pretty;
}

/* Projects */

.projects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-top: clamp(8px, 2vw, 24px);
  padding-bottom: clamp(48px, 7vw, 96px);
}
.projects:focus { outline: none; }

@media (min-width: 760px) {
  .projects { grid-template-columns: 1fr 1fr; gap: 20px; }
  .project-media { aspect-ratio: 2 / 1; }
}

.project {
  --accent: var(--text);
  --accent-hover: var(--text);
  --accent-ink: var(--bg);
  --accent-text: var(--text);

  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.project--mxs {
  --accent: var(--mxs);
  --accent-hover: var(--mxs-hover);
  --accent-ink: var(--mxs-ink);
  --accent-text: var(--mxs);
}
.project--mxb {
  --accent: var(--mxb);
  --accent-hover: var(--mxb-hover);
  --accent-ink: var(--mxb-ink);
  --accent-text: var(--mxb-light);
}
.project :focus-visible { outline-color: var(--accent-text); }

.project-media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms var(--ease-out);
}

.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(20px, 3vw, 32px);
}

.project-game {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.swatch {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 1px;
  transform: skewX(-12deg);
}

.project-logo { margin: 18px 0 0; line-height: 0; }
.project-logo img { height: clamp(40px, 4.4vw, 54px); width: auto; }

.project-tagline {
  margin: 20px 0 0;
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 700;
  font-stretch: 80%;
  line-height: 1.15;
  letter-spacing: -0.005em;
}

.project-desc {
  margin: 10px 0 0;
  max-width: 52ch;
  color: var(--text-2);
  text-wrap: pretty;
}

.project-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  /* Every item carries a leading dot; the list is pulled 27px left and that strip is clipped,
     so the dot that starts each wrapped line is hidden and only in-line separators show. */
  margin: 18px 0 0 -27px;
  padding: 0;
  clip-path: inset(0 0 0 27px);
  list-style: none;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--step--1);
  color: var(--text);
}
.project-facts li { display: flex; align-items: center; }
.project-facts li::before {
  content: "";
  flex: none;
  width: 3px;
  height: 3px;
  margin-inline: 12px;
  background: var(--text-3);
  border-radius: 50%;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--secondary {
  border: 1px solid var(--line-strong);
  color: var(--text);
}

.btn-arrow {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms var(--ease-out);
}
.btn-icon { width: 18px; height: 18px; fill: currentColor; }

.project-note {
  margin: auto 0 0;
  padding-top: 24px;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--text-3);
  max-width: 60ch;
}

@media (hover: hover) and (pointer: fine) {
  .project:hover .project-media img { transform: scale(1.03); }
  .btn--primary:hover { background: var(--accent-hover); }
  .btn--primary:hover .btn-arrow { transform: translateX(3px); }
  .btn--secondary:hover { background: var(--surface-2); border-color: #4a5058; }
  .brand:hover .brand-word { color: var(--text-2); }
}

/* Footer */

.site-footer {
  font-size: var(--step--1);
  color: var(--text-3);
}
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 24px;
  padding-bottom: 32px;
  border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }
.foot-brand { color: var(--text-2); font-weight: 600; }
.foot-brand span { margin-left: 6px; font-weight: 400; color: var(--text-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .project:hover .project-media img,
  .btn:active,
  .btn--primary:hover .btn-arrow { transform: none; }
}
