/* ------------------------------------------------------------------
   Colors. Change --pink to restyle the whole site.
   ------------------------------------------------------------------ */
:root {
  color-scheme: light dark;

  --bg: #eeedf0;
  --surface: #f8f7f9;
  --surface-2: #e4e2e7;
  --ink: #222125;
  --muted: #5f5c65;
  --line: #d6d3dc;

  --pink: #f4a9c4;
  --pink-soft: #fbe2ec;
  --pink-ink: #a63a67;
  --on-pink: #2b1520;

  /* the editor-grey used by the viewport and the viewer */
  --editor: #29292d;
  --editor-2: #1f1f22;
  --editor-line: #3a3a40;
  --editor-ink: #e2e0e6;
  --editor-muted: #9b98a2;

  --check-a: #f7c3d6;
  --check-b: #fcecf2;

  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --max: 1240px;
  --gutter: clamp(1rem, 4vw, 3rem);
  --radius: 6px;
  --focus: var(--pink-ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2e2e33;
    --surface: #37373d;
    --surface-2: #424248;
    --ink: #efedf2;
    --muted: #aeabb4;
    --line: #4b4a51;

    --pink: #f5b4cb;
    --pink-soft: #463840;
    --pink-ink: #f7bed2;

    --editor: #232327;
    --editor-2: #1a1a1d;

    --check-a: #8a6676;
    --check-b: #4e4249;
  }
}

@property --dx { syntax: "<number>"; inherits: true; initial-value: -0.45; }
@property --dy { syntax: "<number>"; inherits: true; initial-value: -0.55; }

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

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--pink-ink); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

h2 {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-stretch: 125%;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
}
.skip:focus { top: 1rem; }

.noscript { padding: 2rem var(--gutter); }

/* ------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--pink); color: var(--on-pink); }
.btn-primary:hover { background: color-mix(in srgb, var(--pink) 85%, var(--ink)); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-dark { background: var(--editor-2); color: var(--editor-ink); border-color: var(--editor-line); }
.btn-dark:hover { border-color: var(--editor-muted); }
.btn-dark:disabled { opacity: 0.4; cursor: default; }
.btn svg { width: 1em; height: 1em; }

/* ------------------------------------------------------------------
   Header
   ------------------------------------------------------------------ */
.site-header { padding-block: 1.1rem; }
.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 700;
  font-stretch: 112%;
  text-decoration: none;
}
.brand-mark {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 8%, var(--pink) 34%, #b85a80 100%);
}
.nav { display: flex; gap: 0.25rem 1.4rem; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.975rem; }
.nav a:hover { color: var(--ink); }

/* ------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------ */
.hero { padding-block: clamp(1rem, 3vw, 2.5rem) clamp(3.5rem, 8vw, 6.5rem); }

.hero-name {
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
  font-size: clamp(3.25rem, 14.5vw, 8.5rem);
  font-stretch: 125%;
  font-weight: 850;
  line-height: 0.86;
  letter-spacing: -0.035em;
}
.hero-name span { display: block; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 4rem);
  align-items: end;
}
.hero-intro { font-size: clamp(1.125rem, 1.6vw, 1.3rem); line-height: 1.5; max-width: 30ch; margin-bottom: 1.5rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { order: 2; }
}

/* ------------------------------------------------------------------
   Viewport (hero media)
   ------------------------------------------------------------------ */
.viewport {
  background: var(--editor);
  color: var(--editor-ink);
  border-radius: 10px;
  overflow: hidden;
  --focus: var(--pink);
}
.vp-bar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.45rem;
  background: var(--editor-2);
  font-size: 0.75rem;
  line-height: 1;
}
.vp-bar span {
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--editor-ink);
}
.vp-bar .vp-hint { margin-left: auto; background: none; color: var(--editor-muted); }
.vp-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  touch-action: pan-y;
}
.vp-stage > img,
.vp-stage > video,
.vp-stage > model-viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--editor-2);
}
.gizmo { position: absolute; left: 0.6rem; bottom: 0.5rem; width: 46px; height: 46px; pointer-events: none; }
.vp-caption { margin-top: 0.7rem; color: var(--muted); font-size: 0.875rem; }

/* The placeholder scene: grey ball, chrome ball and color chart on a cyc.
   --dx and --dy go from -1 to 1 and follow the pointer (the light). */
.lookdev {
  position: absolute;
  inset: 0;
  transition: --dx 0.35s ease-out, --dy 0.35s ease-out;
  background:
    radial-gradient(60% 75% at calc(50% + var(--dx) * 30%) calc(28% + var(--dy) * 18%), rgba(255, 255, 255, 0.3), transparent 70%),
    linear-gradient(to bottom, #8e8e95 0%, #a9a9af 40%, #bfbfc4 58%, #c6c6ca 62%, #b4b4b9 82%, #a2a2a7 100%);
}
.ld-obj { position: absolute; }
.ld-obj .ld-shadow {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -9%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(20, 20, 26, 0.55), rgba(20, 20, 26, 0));
  transform: translateX(calc(var(--dx) * -38%)) translateY(calc(var(--dy) * -12%));
}
.ld-ball {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
}
.ld-grey-obj { left: 15%; bottom: 15%; width: 21%; }
.ld-chrome-obj { left: 40%; bottom: 15%; width: 21%; }
.ld-grey {
  background: radial-gradient(circle at calc(50% + var(--dx) * 24%) calc(50% + var(--dy) * 24%),
    #f2f2f3 0%, #bdbdc0 16%, #8a8a8e 42%, #535357 74%, #333336 100%);
}
.ld-chrome {
  background:
    radial-gradient(circle at calc(50% + var(--dx) * 30%) calc(50% + var(--dy) * 30%), #fff 0 3.5%, rgba(255, 255, 255, 0) 8%),
    radial-gradient(closest-side, rgba(0, 0, 0, 0) 74%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(to bottom, #f1f1f4 0%, #c3c4ca 26%, #8b8c93 44%, #3c3c41 49%, #2a2a2e 52%, #6f6f75 63%, #b5b5ba 84%, #d4d4d7 100%);
}
.ld-chart-obj { right: 7%; bottom: 17%; width: 27%; }
.ld-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  padding: 5%;
  background: #1d1d20;
  border-radius: 3px;
}
.ld-chart i { aspect-ratio: 1; border-radius: 1px; }
.ld-chart-obj .ld-shadow { bottom: -12%; height: 18%; }

/* ------------------------------------------------------------------
   Sections
   ------------------------------------------------------------------ */
.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--line);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

/* ------------------------------------------------------------------
   Work
   ------------------------------------------------------------------ */
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filters button {
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.925rem;
  cursor: pointer;
}
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: clamp(13rem, 21vw, 17rem);
  grid-auto-flow: dense;
  gap: 0.75rem;
}
.tile.wide { grid-column: span 2; }
.tile.tall { grid-row: span 2; }
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 15rem; }
  .tile.wide { grid-column: auto; }
  .tile.tall { grid-row: auto; }
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
}
.tile[hidden] { display: none; }
.tile > img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover .tile-label { background: var(--pink); color: var(--on-pink); }
.tile:hover .tile-label small { color: inherit; }
.tile:focus-visible { outline-offset: 2px; }

.tile-label {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  max-width: calc(100% - 1.2rem);
  padding: 0.45rem 0.7rem 0.5rem;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.25;
}
.tile-label strong { display: block; font-size: 0.95rem; font-weight: 650; }
.tile-label small { display: block; font-size: 0.8rem; color: var(--muted); }

.tile-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  background: rgba(25, 25, 28, 0.72);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}
.tile-badge svg { width: 0.85rem; height: 0.85rem; }

/* "missing texture" checker for pieces without an image yet */
.checker {
  width: 100%;
  height: 100%;
  background-color: var(--check-b);
  background-image: conic-gradient(var(--check-a) 25%, transparent 0 50%, var(--check-a) 0 75%, transparent 0);
  background-size: 48px 48px;
}

.empty { color: var(--muted); }

/* ------------------------------------------------------------------
   Apps
   ------------------------------------------------------------------ */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 4.5rem);
  align-items: center;
}
.app + .app { margin-top: clamp(3.5rem, 8vw, 6rem); }
.app:nth-child(even) .app-art { order: 2; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app:nth-child(even) .app-art { order: 0; }
}
.app-art {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface);
}
.app-art > img { width: 100%; height: 100%; object-fit: cover; }

.app h3 {
  margin: 0 0 0.35rem;
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-stretch: 125%;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.015em;
}
.app-tagline { font-size: 1.2rem; color: var(--muted); margin-bottom: 1.25rem; }
.app-text { max-width: 60ch; }

.details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.45rem 1.5rem;
  margin: 1.5rem 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.details dt { color: var(--muted); }
.details dd { margin: 0; }
@media (max-width: 420px) {
  .details { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .details dd { margin-bottom: 0.6rem; }
}

/* KeyCards drawing: three cards on a pink table */
.art-cards {
  display: grid;
  place-items: center;
  perspective: 1100px;
  background:
    radial-gradient(110% 80% at 50% 105%, var(--pink-soft), transparent 70%),
    var(--surface);
}
.cards {
  position: relative;
  width: 30%;
  aspect-ratio: 5 / 7;
  transform: rotateX(24deg) translateY(4%);
  transform-style: preserve-3d;
}
.card {
  position: absolute;
  inset: 0;
  border-radius: 9% / 6.5%;
  box-shadow: 0 22px 32px -14px rgba(60, 25, 40, 0.5), 0 2px 4px rgba(60, 25, 40, 0.15);
}
.card.back {
  background-color: #f4a9c4;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.4) 0 5px, transparent 5px 13px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.4) 0 5px, transparent 5px 13px);
  border: 7px solid #fff8fb;
}
.card.c1 { transform: translateX(-52%) translateY(5%) rotateZ(-15deg); }
.card.c2 { transform: translateX(52%) translateY(5%) rotateZ(15deg); }
.card.face {
  overflow: hidden;
  background: #fffdfe;
  color: #c63a6f;
  font-stretch: 100%;
  font-weight: 800;
  transform: translateY(-4%);
}
.card.face .pip {
  position: absolute;
  font-size: clamp(0.8rem, 2vw, 1.15rem);
  line-height: 1;
  text-align: center;
}
.card.face .pip.tl { top: 8%; left: 10%; }
.card.face .pip.br { bottom: 8%; right: 10%; transform: rotate(180deg); }
.card.face .big {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  line-height: 1;
}
.card.face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg,
    transparent 28%, rgba(255, 170, 205, 0.55) 42%, rgba(170, 215, 255, 0.5) 50%,
    rgba(255, 238, 170, 0.45) 57%, transparent 70%);
  mix-blend-mode: multiply;
}

/* Gamepad Painter drawing: the radial tool wheel over a brush stroke */
.art-wheel {
  display: grid;
  place-items: center;
  background: var(--surface);
}
.art-wheel svg { width: 78%; height: auto; overflow: visible; }
.art-wheel .stroke { fill: none; stroke: var(--pink); stroke-width: 26; stroke-linecap: round; opacity: 0.4; }
.art-wheel .seg { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.art-wheel .seg.on { fill: var(--pink); stroke: none; }
.art-wheel .lbl { fill: var(--ink); font-family: var(--font); font-size: 13px; font-weight: 600; text-anchor: middle; dominant-baseline: middle; }
.art-wheel .lbl.on { fill: var(--on-pink); }
.art-wheel .hub { fill: var(--editor); }
.art-wheel .knob { fill: var(--editor-2); stroke: #4a4a51; stroke-width: 2; }

/* ------------------------------------------------------------------
   About and contact
   ------------------------------------------------------------------ */
.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(3rem, 6vw, 5rem);
}
@media (max-width: 860px) {
  .info-grid { grid-template-columns: minmax(0, 1fr); }
}
.info-grid h2 { margin-bottom: 1.5rem; }
#about-body { max-width: 52ch; }
.tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.tools-list li {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0.75rem 0 1.75rem;
}
.email {
  font-size: clamp(1.35rem, 3.2vw, 2.1rem);
  font-stretch: 118%;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.email:hover { color: var(--pink-ink); }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0; padding: 0; list-style: none; }

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.75rem; color: var(--muted); font-size: 0.9rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-row p { margin: 0; }
.footer-row a { color: var(--muted); }

/* ------------------------------------------------------------------
   Viewer (opens when you click a piece)
   ------------------------------------------------------------------ */
.viewer {
  width: min(1240px, calc(100vw - 2rem));
  height: min(820px, calc(100dvh - 2rem));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--editor);
  color: var(--editor-ink);
  --focus: var(--pink);
}
.viewer::backdrop { background: rgba(18, 18, 22, 0.78); }
.viewer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  height: 100%;
}
.viewer-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  background: var(--editor-2);
}
.viewer-media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer-media > iframe,
.viewer-media > video { width: 100%; aspect-ratio: 16 / 9; max-height: 100%; border: 0; background: #000; }
.viewer-media > model-viewer { position: absolute; inset: 0; width: 100%; height: 100%; --poster-color: transparent; }
.viewer-media > .checker { position: absolute; inset: 0; width: auto; height: auto; }
.viewer-media .no-media {
  position: relative;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  background: var(--editor);
  color: var(--editor-ink);
  font-size: 0.9rem;
}

.viewer-info {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.6rem 1.5rem 1.4rem;
  overflow-y: auto;
  min-height: 0;
}
.viewer-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--editor-line);
  border-radius: 50%;
  background: var(--editor-2);
  color: var(--editor-ink);
  cursor: pointer;
}
.viewer-close:hover { border-color: var(--editor-muted); }
.viewer-meta { margin: 0; padding-right: 3rem; color: var(--editor-muted); font-size: 0.875rem; }
.viewer-title {
  margin: 0;
  font-size: 1.75rem;
  font-stretch: 120%;
  font-weight: 800;
  line-height: 1.05;
}
.viewer-text { color: var(--editor-ink); }
.viewer-tools { margin: 0; color: var(--editor-muted); font-size: 0.9rem; }
.viewer-tools:empty, .viewer-meta:empty { display: none; }
.viewer-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.viewer-thumbs:empty { display: none; }
.viewer-thumbs button {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 5px;
  background: var(--editor-2);
  color: var(--editor-ink);
  cursor: pointer;
}
.viewer-thumbs button[aria-current="true"] { border-color: var(--pink); }
.viewer-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.viewer-thumbs svg { width: 40%; height: 40%; margin: auto; }
.viewer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}
.viewer-nav[hidden] { display: none; }
.viewer-count { color: var(--editor-muted); font-size: 0.875rem; }

@media (max-width: 860px) {
  .viewer {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .viewer-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 50%) minmax(0, 1fr);
  }
  .viewer-info { padding: 1.25rem; }
}
