/* Self-hosted fonts (latin subset, from Google Fonts; all SIL Open Font License). */
@font-face {
  font-family: "Schibsted Grotesk";
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/schibsted-grotesk-500.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "Caveat";
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/caveat-600.woff2") format("woff2");
}

:root {
  --ink: #141414;
  --paper: #ffffff;
  --canvas: #f5f5f5;
  --mist: #e9e9e9;
  --hairline: #d9d9d9;
  --highlight: #fecc33;

  --font-display: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-script: "Caveat", cursive;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: Arial, Helvetica, sans-serif;

  --gutter: clamp(16px, 4vw, 52px);
  --section-gap: 80px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  background-color: var(--canvas);
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word; /* long words and URLs wrap instead of widening the page */
  /* Footer sits at the bottom of the window even on short pages (the 404). */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1; }

/* Inner pages: fainter grid so the text stands out. */
body.inner {
  background-image:
    linear-gradient(rgb(217 217 217 / 0.7) 1px, transparent 1px),
    linear-gradient(90deg, rgb(217 217 217 / 0.7) 1px, transparent 1px);
}

a { color: inherit; text-decoration: none; }

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow { margin: 0 0 40px; text-align: center; font-weight: 400; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

mark {
  background: var(--highlight);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 0.3em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px var(--gutter);
}
.nav__links { display: flex; gap: 24px; margin-right: auto; }
.nav__links a, .nav__home { padding: 6px 0; }
.nav__links a:hover, .nav__links a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }
.nav__home { margin-right: 16px; }

.btn {
  background: var(--ink);
  color: var(--paper);
  padding: 9px 20px;
  border-radius: 8px;
}

/* Home hero */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  padding: 64px var(--gutter) 64px;
}
.hero__tagline mark {
  white-space: nowrap;
  text-transform: capitalize;
  font-size: 1.2em;
  /* A band behind the letters rather than the font's full (tall) line box, so lines don't touch. */
  background: linear-gradient(transparent 20%, var(--hl) 20%, var(--hl) 88%, transparent 88%);
}
.hero__tagline mark .minor { text-transform: none; font-size: calc(1em / 1.2); }
.hero__tagline {
  margin: 0;
  font: 600 clamp(22px, 2.4vw, 32px) var(--font-script);
  line-height: 1.24;
}

/* Polaroid board */
.board { padding: 0 var(--gutter) var(--section-gap); }
.board__cards {
  width: min(75vw, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.12fr 0.94fr;
  align-items: start;
  gap: clamp(16px, 2.5vw, 40px);
}

.polaroid {
  display: block;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 14px 14px 24px;
  transform: rotate(var(--r, 0deg)) translateY(var(--y, 0));
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.polaroid:hover, .polaroid:focus-visible {
  transform: rotate(0deg) translateY(calc(var(--y, 0px) - 6px));
  border-color: rgb(20 20 20 / 0.3); /* --ink at 30% */
}
.polaroid--1 { --r: -3deg; --y: 24px; }
.polaroid--2 { --r: 1.5deg; --y: -8px; }
.polaroid--3 { --r: -1deg; --y: 48px; }

.polaroid .demo { border-radius: 10px; aspect-ratio: 4 / 5; }
.polaroid__label { display: flex; padding: 2px 4px 12px; }
.polaroid__caption { display: grid; gap: 10px; padding: 16px 4px 0; }
.polaroid__title { font: 500 clamp(21px, 1.8vw, 27px)/1.1 var(--font-display); }
.polaroid__caption:has(.sticker) { position: relative; padding-right: 76px; }
.sticker {
  position: absolute;
  right: 0;
  bottom: -6px;
  width: 72px;
  height: 72px;
  object-fit: contain;
  transform: rotate(6deg);
  transition: transform 0.25s ease;
}
.sticker svg { display: block; width: 100%; height: 100%; }
.polaroid:hover .sticker { transform: rotate(-4deg) scale(1.06); }
.polaroid__more { opacity: 0.7; } /* 0.7 keeps it above WCAG AA contrast on white */
.polaroid:hover .polaroid__more { opacity: 1; }

/* Tags */
.tag { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

/* Demo media */
.demo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 16px;
  background: var(--mist);
}
.demo--image { height: auto; aspect-ratio: 4 / 5; }
.demo--empty {
  display: grid;
  place-items: center;
  border: 1px dashed var(--hairline);
  background: repeating-linear-gradient(-45deg, var(--mist) 0 10px, var(--canvas) 10px 20px);
}
.demo--empty span {
  font: 12px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--paper);
  padding: 6px 10px;
  border-radius: 4px;
}

/* Category page */
.cat-hero { padding: 64px var(--gutter) var(--section-gap); }
.back { display: inline-block; margin: -6px 0 34px; padding: 6px 0; }
.back:hover { text-decoration: underline; text-underline-offset: 4px; }
.cat-hero__title {
  margin: 0;
  font: 600 clamp(51px, 9.6vw, 100px)/1.05 var(--font-script);
}
.cat-hero__blurb { margin: 24px 0 0; font: 600 clamp(22px, 2.4vw, 32px)/1.24 var(--font-script); max-width: 20em; }

.projects {
  display: grid;
  gap: 100px;
  padding: 0 var(--gutter) var(--section-gap);
}
.project {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 52px;
  align-items: center;
  width: 100%;
  max-width: 1200px;
}
/* Halfway between the left edge and centered; zero once the screen is too narrow for it. */
.project--nudge { margin-left: max(0px, (100% - 900px) / 4); }
.project--flip { margin-left: auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.project--portrait { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); max-width: 900px; }
.project--portrait.project--flip { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); }
.project--flip .project__media { order: 2; }
.project__media {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 12px;
  transform: rotate(-1deg);
}
.project--flip .project__media { transform: rotate(1deg); }
.project__media .demo { border-radius: 10px; }
.project__media { position: relative; }
.restart {
  display: block;
  margin: 8px 4px 0;
  padding: 8px 0;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}
.restart:hover { text-decoration: underline; text-underline-offset: 4px; }
.play {
  position: absolute; left: 50%; top: calc(50% - 14px); transform: translate(-50%, -50%);
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 8px; padding: 10px 18px; cursor: pointer;
}
.project__text { display: grid; gap: 16px; justify-items: start; }
/* Liquid glass: each case's text sits on one translucent, blurred panel
   with a specular rim and a soft drop shadow. */
.project__text {
  position: relative;
  isolation: isolate;
  padding: clamp(24px, 3vw, 36px);
  border-radius: 28px;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.16), rgb(255 255 255 / 0.04));
  -webkit-backdrop-filter: blur(1.5px) saturate(180%);
  backdrop-filter: blur(1.5px) saturate(180%);
  border: 1px solid rgb(255 255 255 / 0.7);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.95),
    inset 0 -1px 0 rgb(255 255 255 / 0.35),
    inset 0 0 0 0.5px rgb(0 0 0 / 0.04),
    0 1px 2px rgb(0 0 0 / 0.06),
    0 12px 32px -8px rgb(0 0 0 / 0.16),
    0 32px 64px -24px rgb(0 0 0 / 0.14);
}
/* Light catching the top-left edge, like the glass's lensing highlight. */
.project__text::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 0% 0%, rgb(255 255 255 / 0.3), transparent 45%),
    radial-gradient(80% 50% at 100% 100%, rgb(255 255 255 / 0.15), transparent 55%);
}
.project__text .transcript { border-top-color: rgb(20 20 20 / 0.1); }
.project__head { display: grid; gap: 10px; }
.project__title { margin: 0; font: 500 clamp(24px, 2.6vw, 32px)/1.1 var(--font-display); letter-spacing: -0.01em; }
.project__desc { margin: 0; max-width: 32em; }
.project__award { margin: 0; font-size: 15px; }
.project--snaps { max-width: 1200px; }
.project--portrait.project--snaps { grid-template-columns: minmax(0, 340px) minmax(0, 508px) auto; }
.project--portrait.project--flip.project--snaps { grid-template-columns: minmax(0, 508px) minmax(0, 340px) auto; }
.snaps { order: 3; display: grid; justify-items: center; padding: 8px; }
.snap {
  width: 166px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--paper);
  padding: 6px 6px 20px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgb(20 20 20 / 0.08);
  transform: rotate(var(--r, 0deg)) translateX(var(--x, 0));
  transition: transform 0.25s ease;
}
.snap + .snap { margin-top: -26px; }
.snap:nth-child(1) { --r: -6deg; --x: -18px; }
.snap:nth-child(2) { --r: 4deg; --x: 23px; }
.snap:nth-child(3) { --r: -3deg; --x: -10px; }
.snap:hover { transform: rotate(0deg) scale(1.5); position: relative; z-index: 1; }
.project__bullets { margin: -8px 0 0; padding-left: 1.2em; display: grid; gap: 6px; max-width: 32em; }
.project__bullets li::marker { color: var(--accent, var(--ink)); }
.project__label { margin: 4px 0 -8px; font-weight: 400; opacity: 0.6; }
.transcript p { margin: 12px 0 0; max-width: 32em; }
.transcript + .transcript { border-top: 0; padding-top: 0; }

.transcript { width: 100%; max-width: 32em; border-top: 1px solid var(--hairline); padding-top: 12px; }
.transcript summary { cursor: pointer; padding: 6px 0; list-style: none; }
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::before { content: "+"; display: inline-block; width: 1.4em; }
.transcript[open] summary::before { content: "−"; }
.transcript summary:hover { text-decoration: underline; text-underline-offset: 4px; }
.transcript ol { margin: 12px 0 0; padding-left: 1.4em; display: grid; gap: 6px; font-size: 15px; }
.transcript li::marker { font: 12px var(--font-mono); opacity: 0.55; }

.links { display: flex; flex-wrap: wrap; gap: 10px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}
.link-btn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.link-btn:hover { background: var(--ink); color: var(--paper); }

.tab {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
}
.tab:hover { background: var(--ink); color: var(--paper); }

.stats { display: flex; flex-wrap: wrap; gap: 16px 32px; margin: 4px 0; }
.stats div { display: grid; gap: 8px; }
.stats dt { order: 2; opacity: 0.6; max-width: 14ch; line-height: 1.3; }
.stats dd { margin: 0; font: 500 32px/1 var(--font-display); }
.stats__delta { margin-left: 6px; font-size: 12px; vertical-align: sub; white-space: nowrap; color: #1a7f37; }

.next {
  display: block;
  margin: 0 var(--gutter) var(--section-gap);
  padding-top: 40px;
  border-top: 1px solid var(--ink);
  font: 600 clamp(36px, 5.5vw, 52px)/1.1 var(--font-script);
}
.next .mono { display: block; margin-bottom: 16px; }
.next:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* Footer */
.footer {
  display: grid;
  justify-items: center;
  gap: 24px;
  padding: var(--section-gap) var(--gutter) 40px;
  border-top: 1px solid var(--hairline);
  background: var(--canvas);
}
.footer .eyebrow { margin: 0; }
.footer__email {
  /* Same size as LinkedIn beside it, but kept lowercase so it reads as an address. */
  text-transform: none;
  padding: 2px 4px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.footer__email:hover { background: var(--highlight); }
.footer__row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 32px; }
.footer__copy { margin: 0; }
.footer__row a { padding: 6px 4px; } /* 24px+ tap targets */
.footer__row a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* 404 */
.not-found__links { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 12px; font: 500 clamp(22px, 2.4vw, 28px)/1.2 var(--font-display); }
.not-found__links a { display: inline-block; padding: 4px 0; }
.not-found__links a:hover { text-decoration: underline; text-underline-offset: 4px; }

a:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 4px; }
/* Hidden until a keyboard user tabs to it. */
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 10; padding: 10px 14px; background: var(--ink); color: var(--paper); border-radius: 8px; }
.skip-link:focus { top: 12px; }

@media (max-width: 860px) {
  .hero { flex-direction: column; align-items: flex-start; padding-top: 64px; }
  .hero__tagline { text-align: left; }
  .project, .project--flip, .project--portrait, .project--portrait.project--flip { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .project--portrait .project__media { max-width: 340px; }
  .project--flip .project__media { order: 0; }
  .project--portrait.project--snaps, .project--portrait.project--flip.project--snaps { grid-template-columns: minmax(0, 1fr); }
  .snaps { display: flex; justify-content: flex-start; }
  .snap { width: min(125px, 30vw); }
  .snap + .snap { margin: 0 0 0 -16px; }
  .snap:nth-child(n) { --x: 0; }
  .board__cards { width: 100%; max-width: 420px; grid-template-columns: 1fr; gap: 40px; }
  .polaroid--1, .polaroid--2, .polaroid--3 { --y: 0px; }
}

@media (max-width: 600px) {
  .nav { flex-wrap: wrap; gap: 16px; }
  .nav__home { width: 100%; margin: 0; }
  .nav__links { gap: 16px; }
  .projects { gap: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .polaroid, .sticker, .snap { transition: none; }
}
