/* Classic page: dashboard layout. Themes override the variables on :root. */
:root {
  --bg: #fbfaf7;
  --fg: #16161a;
  --muted: #4a4a55;
  --surface: #ffffff;
  --border: #e5e5e5;
  --accent: #1d4ed8;
  --font-scale: 1;
  --dot: rgba(22, 22, 26, 0.14);
  /* Dark tiles. Text colours keep at least 4.5:1 on --tile-bg. */
  --tile-bg: #191919;
  --tile-fg: #f4f4f2;
  --tile-muted: #b4b4b4;
  --tile-accent: #9cc0ff;
  --tile-line: rgba(255, 255, 255, 0.14);
  --tile-radius: 20px;
  --radius: 1rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --page-width: 72rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --fg: #f2f2ef;
    --muted: #b9b9c2;
    --surface: #1b1b20;
    --border: #34343c;
    --accent: #8ab4ff;
    --dot: rgba(255, 255, 255, 0.09);
    color-scheme: dark;
  }
}

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

html {
  font-size: calc(100% * var(--font-scale));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--fg);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  overflow-wrap: break-word;
}

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

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

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

main:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: 0.5rem;
}

.skip-link:focus {
  top: 1rem;
}

/* Top bar: brand left, tabs in the middle, game link right */
.site-header {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: 'brand tabs game';
  align-items: center;
  gap: 0.5rem 1rem;
  width: calc(min(var(--page-width), 100%) - 2 * var(--gutter));
  margin: 0.75rem auto 0;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--tile-radius);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.bar {
  display: contents;
}

.brand {
  grid-area: brand;
  min-width: 0;
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
}

.bar .button {
  grid-area: game;
  justify-self: end;
}

.tabbar {
  grid-area: tabs;
  min-width: 0;
}

.tabbar ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0.25rem;
  overflow-x: auto;
  list-style: none;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  scrollbar-width: none;
}

.tabbar a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.25rem 1rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.tabbar a:hover {
  color: var(--fg);
}

.tabbar a[aria-current='page'] {
  background: var(--fg);
  color: var(--bg);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.button-secondary {
  background: transparent;
  color: var(--accent);
}

/* Views (tabs). Without JavaScript all views show stacked. */
.view {
  max-width: var(--page-width);
  margin-inline: auto;
  padding: 1.5rem var(--gutter) 2.5rem;
  scroll-margin-top: 6rem;
}

.view-hidden {
  display: none;
}

.view-title {
  margin: 0 0 1.5rem;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Bento grid with dark tiles */
.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 1rem;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--tile-line);
  border-radius: var(--tile-radius);
  background: var(--tile-bg);
  color: var(--tile-fg);
  scroll-margin-top: 6rem;
}

.tile > * {
  margin-block: 0;
}

.tile-title {
  color: var(--tile-muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tile a {
  color: var(--tile-accent);
}

.tile :focus-visible {
  outline-color: var(--tile-accent);
}

.tile .meta,
.tile .eyebrow,
.tile .badge,
.tile .tags span,
.tile .metrics dt,
.tile .process dt {
  color: var(--tile-muted);
}

.tile .button {
  border-color: var(--tile-accent);
  background: var(--tile-accent);
  color: var(--tile-bg);
}

.tile .button-secondary {
  background: transparent;
  color: var(--tile-accent);
}

.tile .card {
  border-color: var(--tile-line);
  background: rgba(255, 255, 255, 0.04);
}

.tile .tags li {
  border-color: var(--tile-line);
  background: transparent;
}

#tile-profile {
  justify-content: flex-end;
  min-height: 16rem;
}

#tile-profile .avatar {
  width: 6rem;
  height: 6rem;
  margin-bottom: auto;
  border-radius: 50%;
  object-fit: cover;
}

#tile-profile h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

#tile-profile .hero-name {
  display: block;
  margin-bottom: 0.5rem;
}

#tile-profile .hero-title {
  display: block;
  color: var(--tile-muted);
  font-size: 0.5em;
  font-weight: 600;
  letter-spacing: 0;
}

#tile-years {
  align-items: center;
  text-align: center;
}

#tile-years .tile-title {
  align-self: flex-start;
}

.counter {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.counter-value {
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.counter-unit {
  color: var(--tile-muted);
  font-weight: 600;
}

.arc {
  width: 100%;
  max-width: 12rem;
  height: auto;
}

.arc path {
  fill: none;
  stroke: var(--tile-accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 158;
  stroke-dashoffset: 0;
}

#tile-experience {
  grid-column: 1 / -1;
}

#tile-experience h3 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  line-height: 1.25;
}

#tile-experience h4 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  line-height: 1.25;
}

#tile-experience p {
  max-width: 42rem;
  margin: 0 0 0.75rem;
}

/* Folder cards: a CSS tab on top, image area, title and meta */
.folders {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.folder {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  margin-top: 0.9rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0 var(--tile-radius) var(--tile-radius) var(--tile-radius);
  background: var(--surface);
  color: var(--fg);
  overflow-wrap: anywhere;
}

.folder::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: -1px;
  width: 45%;
  height: 0.9rem;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--surface);
}

a.folder {
  text-decoration: none;
}

.tile .folder {
  color: var(--fg);
}

.tile .folder .meta {
  color: var(--muted);
}

.tile .folder:focus-visible {
  outline-color: var(--tile-accent);
}

.folder .media {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: var(--border);
}

.folder-title,
.folder h3 {
  display: block;
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.folder-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.folder-body p {
  margin: 0.25rem 0 0;
}

/* Filter chips for the AI tab */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.25rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chip[aria-pressed='true'],
.chip[aria-current='true'] {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

/* Shared text pieces */
.lead {
  font-size: 1.2rem;
}

.eyebrow,
.meta,
.badge {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.block + .block {
  margin-top: 2rem;
}

.block > h3 {
  margin: 0 0 1rem;
}

.key-messages {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.25rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
}

.tags span {
  display: block;
  color: var(--muted);
  font-weight: 400;
}

.metrics,
.process {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.metrics dt,
.process dt {
  color: var(--muted);
  font-weight: 600;
}

.metrics dd,
.process dd {
  margin: 0;
}

/* Cards (agencies, AI projects) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#ai .cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--tile-radius);
  background: var(--surface);
}

.card h4 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.25;
}

.card p {
  margin: 0 0 0.75rem;
}

.card > :last-child {
  margin-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Legal pages: hero and prose sections */
.hero,
.section,
.site-footer {
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.hero {
  padding-block: clamp(2.5rem, 8vw, 5rem) clamp(1.5rem, 4vw, 2.5rem);
}

.hero h1 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero-small h1 {
  font-size: clamp(2.25rem, 6vw, 4rem);
}

.section {
  padding-block: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid var(--border);
}

.section p {
  max-width: 42rem;
  margin: 0 0 1rem;
}

.prose h2 {
  margin: 2rem 0 0.5rem;
  font-size: 1.5rem;
}

.prose h2:first-child {
  margin-top: 0;
}

address {
  font-style: normal;
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Breakpoints */
@media (max-width: 960px) {
  .folders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'brand game'
      'tabs tabs';
    padding: 0.5rem;
    padding-left: 1rem;
  }

  .tabbar ul {
    justify-content: space-between;
  }

  .tabbar li {
    flex: 1 0 auto;
  }

  .tabbar a {
    justify-content: center;
    width: 100%;
  }

  .bento,
  #ai .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  #tile-profile {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .folders {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Motion only for people who did not ask to reduce it */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .tabbar a,
  .chip,
  .button,
  .folder {
    transition:
      background-color 0.2s ease,
      color 0.2s ease,
      transform 0.2s ease;
  }

  a.folder:hover {
    transform: translateY(-2px);
  }

  .view:not(.view-hidden) {
    animation: view-in 0.3s ease both;
  }

  .tile {
    animation: tile-in 0.45s ease both;
  }

  .tile:nth-child(2) {
    animation-delay: 0.05s;
  }

  .tile:nth-child(3) {
    animation-delay: 0.1s;
  }

  .tile:nth-child(n + 4) {
    animation-delay: 0.15s;
  }

  .arc path {
    animation: arc-draw 1.2s ease-out 0.2s both;
  }

  @keyframes view-in {
    from {
      opacity: 0;
    }
  }

  @keyframes tile-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }

  @keyframes arc-draw {
    from {
      stroke-dashoffset: 158;
    }
  }
}
