:root {
  --bg: #0b0b0d;
  --bg-soft: #101014;
  --fg: #ece8e0;
  --fg-dim: #7a7670;
  --tile: #16161a;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --max: 1200px;
  --pad: clamp(1rem, 3vw, 2.25rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.6;
}

/* subtle film-grain — keep it very light */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.9'/></svg>");
  transform: translate3d(0, var(--parallax-grain, 0), 0);
}

/* custom cursor — Minecraft-style plus crosshair, color-inverting */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  pointer-events: none;
  z-index: 200;
  transform: translate3d(-100px, -100px, 0);
  transition:
    width 0.2s ease,
    height 0.2s ease,
    opacity 0.2s ease;
  opacity: 0;
  mix-blend-mode: difference;
}

/* horizontal + vertical bars form the "+" */
.cursor-dot::before,
.cursor-dot::after {
  content: "";
  position: absolute;
  background: var(--fg);
}
.cursor-dot::before {
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
}
.cursor-dot::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
}

.cursor-dot.active {
  opacity: 1;
}
.cursor-dot.hot {
  width: 24px;
  height: 24px;
}

/* WebGL overlay sits above DOM tiles but below nav/lightbox */
.gl-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 5;
  pointer-events: none;
}

/* hide raw tile <img> once WebGL has bound */
body.webgl-ready .tile img {
  visibility: hidden;
}

/* header — black bar with image buttons */
.site-header {
  position: relative;
  z-index: 20;
  background: #000;
  padding: 1rem var(--pad);
  width: 100%;
}

.nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
  justify-content: center;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  transition:
    transform 0.25s ease,
    filter 0.25s ease,
    opacity 0.25s ease;
  opacity: 1;
}

.nav-btn img {
  height: clamp(60px, 7.5vw, 100px);
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4));
}

.nav-btn:hover {
  opacity: 1;
  transform: translateY(-2px) rotate(-1deg);
  filter: brightness(1.08);
}

.nav-btn:active {
  transform: translateY(0) rotate(0deg);
}

.nav-btn[aria-current="page"] {
  transform: translateY(-2px);
}

.nav-btn[aria-current="page"] img {
  filter:
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 10px rgba(255, 170, 80, 0.35));
}

/* generic page body placeholder */
.page-body {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem var(--pad) 6rem;
}

.page-body-inner {
  max-width: 720px;
}

.page-kicker {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 1rem;
}

.page-lede {
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  color: var(--fg);
  margin: 0 0 2rem;
  max-width: 48ch;
}

.page-placeholder {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--fg-dim);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* hero — "Work | Portfolio" heading with character beside it */
.hero {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 3.5rem var(--pad) 3rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 2rem;
  min-height: 120px;
}

.title {
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 0;
  letter-spacing: 0.01em;
  color: var(--fg);
}

.title .sep {
  color: var(--fg-dim);
  font-weight: 300;
  margin: 0 0.35em;
}

.hero-character {
  flex: 0 0 auto;
  width: clamp(90px, 11vw, 140px);
  align-self: flex-end;
  transform: translate3d(0, var(--parallax-hero, 0), 0);
  will-change: transform;
}

.hero-character img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.hero-character img.missing {
  aspect-ratio: 1;
  width: 100%;
  background: radial-gradient(
    circle at 35% 35%,
    #2a2a32 0%,
    #16161a 60%,
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0.4;
}

/* play intro — character + speech bubble */
.play-intro {
  margin: 0 0 2.5rem;
  padding-top: 5.5rem;
}

.play-character {
  position: relative;
  display: inline-block;
  width: clamp(72px, 9.6vw, 108px);
}

.play-character img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.play-character img.missing {
  aspect-ratio: 1;
  background: radial-gradient(
    circle at 35% 35%,
    #2a2a32 0%,
    #16161a 60%,
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0.4;
}

.speech-bubble {
  position: absolute;
  left: calc(100% + 18px);
  bottom: calc(100% - 28px);
  width: max-content;
  max-width: 280px;
  color: #0b0b0d;
  padding: 0.9rem 1.05rem;
  font-size: 0.85rem;
  line-height: 1.45;
  transform: rotate(-1.2deg);
  isolation: isolate;
}

.speech-bubble p {
  margin: 0;
  position: relative;
  z-index: 1;
}

.speech-bubble-shape {
  position: absolute;
  inset: 0;
  background: #ece8e0;
  border: 2px solid #0b0b0d;
  border-radius: 26px 18px 22px 16px / 18px 24px 16px 22px;
  box-shadow: 3px 3px 0 #cc1f1a;
  filter: url(#wobble);
  z-index: 0;
}

.speech-bubble-shape::before,
.speech-bubble-shape::after {
  content: "";
  position: absolute;
  bottom: 14px;
  width: 0;
  height: 0;
  border-style: solid;
}

.speech-bubble-shape::before {
  left: -14px;
  border-width: 8px 14px 8px 0;
  border-color: transparent #0b0b0d transparent transparent;
}

.speech-bubble-shape::after {
  left: -10px;
  border-width: 7px 12px 7px 0;
  border-color: transparent #ece8e0 transparent transparent;
}

@media (max-width: 640px) {
  .play-character {
    width: clamp(110px, 28vw, 160px);
  }
  .speech-bubble {
    left: auto;
    right: calc(100% + 14px);
    max-width: 220px;
  }
  .speech-bubble-shape::before {
    left: auto;
    right: -14px;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #0b0b0d;
  }
  .speech-bubble-shape::after {
    left: auto;
    right: -10px;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #ece8e0;
  }
}

/* gallery */
.gallery-section {
  position: relative;
  z-index: 1;
  padding-bottom: 5rem;
}

.gallery {
  list-style: none;
  margin: 0 auto;
  padding: 0 var(--pad);
  max-width: var(--max);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  background: var(--tile);
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.tile:hover {
  opacity: 0.95;
}

.tile img,
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile.missing::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--fg-dim);
  font-size: 0.85rem;
  opacity: 0.4;
  letter-spacing: 0.1em;
}

.tile .tile-caption {
  position: absolute;
  left: 0.9rem;
  bottom: 0.7rem;
  z-index: 2;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.tile:hover .tile-caption {
  opacity: 1;
  transform: translateY(0);
}

/* about */
.about-section {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 4rem var(--pad) 5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.about-inner {
  display: flex;
  flex-direction: row;
  gap: 3rem;
  align-items: flex-start;
}

.about-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (max-width: 720px) {
  .about-inner {
    flex-direction: column;
    gap: 2rem;
  }
}

.about-kicker {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 0.5rem;
}

.about-name {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
  color: var(--fg);
}

.about-copy p {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  max-width: 48ch;
  margin: 0 0 1rem;
  color: var(--fg);
}

.about-copy p.about-contact {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--fg-dim);
}

.about-copy p.about-contact a {
  color: var(--fg);
  border-bottom: 1px solid var(--fg-dim);
  padding-bottom: 2px;
}

.about-tools h3 {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 1rem;
}

.about-tools ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  font-size: 0.9rem;
  color: var(--fg);
}

.about-tools li {
  position: relative;
  padding-right: 0.9rem;
}

.about-tools li:not(:last-child)::after {
  content: "·";
  position: absolute;
  right: 0;
  color: var(--fg-dim);
}

/* about — personal photos */
.about-photos {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  width: clamp(160px, 22vw, 220px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.about-photo {
  background: #ece8e0;
  padding: 8px 8px 28px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  transform: rotate(var(--tilt, -2deg));
  transition: transform 0.25s ease;
}

.about-photo:nth-child(2n) { --tilt: 2deg; }
.about-photo:nth-child(3n) { --tilt: -2.5deg; }
.about-photo:nth-child(4n) { --tilt: 1.5deg; }
.about-photo:nth-child(5n) { --tilt: -1deg; }

.about-photo:hover {
  transform: rotate(0) scale(1.03);
}

.about-photo img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

/* footer */
.site-footer {
  position: relative;
  z-index: 1;
  background: var(--bg);
  overflow: hidden;
}

.stickers {
  position: relative;
  height: 110px;
  pointer-events: none;
}

.sticker {
  position: absolute;
  bottom: 10px;
  width: clamp(44px, 5.5vw, 64px);
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
  animation: float var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  transform: rotate(var(--rot, 0deg));
}

.sticker img {
  width: 100%;
  height: auto;
}

@keyframes float {
  0%,
  100% {
    transform: rotate(var(--rot, 0deg)) translateY(0);
  }
  50% {
    transform: rotate(var(--rot, 0deg)) translateY(-5px);
  }
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem var(--pad) 2.5rem;
  display: flex;
  justify-content: center;
}

.socials {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 10, 0.86);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 1;
  transition: opacity 0.25s ease;
}

.lightbox[hidden] {
  display: none;
}

.lb-stage {
  grid-row: 1;
  grid-column: 1;
  margin: 0;
  max-width: min(1100px, 92vw);
  max-height: 78vh;
  display: grid;
  place-items: center;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.lb-stage.swapping {
  opacity: 0;
  transform: scale(0.98);
}

.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  display: block;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lb-meta {
  grid-row: 2;
  grid-column: 1;
  margin-top: 1.25rem;
  max-width: 1100px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  text-align: center;
}

.lb-meta strong {
  color: var(--fg);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.lb-meta .sep {
  margin: 0 0.6em;
}

.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}
.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
}
.lb-close {
  top: 1.25rem;
  right: 1.25rem;
  font-size: 1.5rem;
}
.lb-prev {
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
}
.lb-next {
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
}
.lb-prev:hover {
  transform: translateY(-50%) translateX(-2px);
}
.lb-next:hover {
  transform: translateY(-50%) translateX(2px);
}

/* responsive */
@media (max-width: 900px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
  .about-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 520px) {
  .hero-inner {
    flex-direction: row;
    align-items: flex-end;
  }
  .nav {
    gap: 1.25rem;
    font-size: 0.72rem;
  }
  .gallery {
    grid-template-columns: 1fr;
  }
  .lb-prev,
  .lb-next {
    width: 38px;
    height: 38px;
  }
}

@media (pointer: coarse) {
  .cursor-dot {
    display: none;
  }
  .hero-bg {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .hero-character,
  .grain {
    transform: none !important;
  }
  .hero-bg,
  .gl-overlay {
    display: none !important;
  }
}

/* Repair pass: reliable native media, readable controls and small screens. */
.tile-open { display:block; width:100%; height:100%; border:0; padding:0; background:none; color:inherit; cursor:pointer; font:inherit; text-align:left; }
.tile-open:focus-visible { outline:3px solid #ffd28d; outline-offset:-4px; }
a:focus-visible, button:focus-visible { outline:2px solid #ffd28d; outline-offset:5px; }
.tile .tile-caption { left:0; right:0; bottom:0; padding:2.5rem .9rem .8rem; background:linear-gradient(transparent,rgba(0,0,0,.85)); opacity:1; transform:none; }
.video-badge { position:absolute; top:.8rem; right:.8rem; padding:.25rem .5rem; border-radius:3px; background:rgba(0,0,0,.65); font-size:.65rem; letter-spacing:.08em; text-transform:uppercase; pointer-events:none; }
.work-heading { max-width:var(--max); margin:0 auto; padding:2rem var(--pad); }
.work-heading h1 { font-size:1.2rem; font-weight:400; margin:0 0 .3rem; }
.work-heading p { color:#aaa59e; font-size:.8rem; margin:0; }
.gallery-message { padding:2rem; text-align:center; }
.socials a { display:inline-flex; align-items:center; justify-content:center; min-width:44px; min-height:44px; }
.play-intro { padding-top:1rem; margin-bottom:0; }
.play-character { width:100%; display:flex; align-items:center; gap:1.5rem; }
.play-character > img { width:clamp(72px,9.6vw,108px); flex:0 0 auto; }
.speech-bubble { position:relative; left:auto; right:auto; bottom:auto; width:auto; max-width:280px; }
.page-body { padding-bottom:3rem; }
.lb-meta { color:#bbb5ab; }
.lb-stage { max-width:min(1100px,80vw); }
@media(max-width:640px) {
 .nav { gap:clamp(.6rem,3vw,1.25rem); }
 .nav-btn { min-width:0; }
 .nav-btn img { width:100%; height:auto; max-height:70px; object-fit:contain; }
 .play-character { gap:1rem; }
 .speech-bubble { font-size:.78rem; padding:.8rem; max-width:calc(100% - 90px); }
 .speech-bubble-shape::before { left:-14px; right:auto; border-width:8px 14px 8px 0; border-color:transparent #0b0b0d transparent transparent; }
 .speech-bubble-shape::after { left:-10px; right:auto; border-width:7px 12px 7px 0; border-color:transparent #ece8e0 transparent transparent; }
 .lb-stage { max-width:92vw; }
 .lb-prev,.lb-next { top:auto; bottom:1rem; transform:none; z-index:2; }
 .lightbox { padding-bottom:5rem; }
 .lb-stage img,.lb-stage video { max-height:65vh; }
}
@media(prefers-reduced-motion:reduce) { html,body {scroll-behavior:auto;} }
