/* =========================================================
   Tokens
========================================================= */
:root{
  --bg:          #12131a;
  --bg-raised:   #191b24;
  --ink:         #edeae3;
  --ink-dim:     #9a9baa;
  --line:        #2a2c38;
  --accent:      #d6a72f;   /* amber — used sparingly */
  --accent-ink:  #12131a;
 
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Space Grotesk', 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
}
 
*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
 
body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
 
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
 
.wrap{
  max-width: 920px;
  margin: 0 auto;
  padding: 0 28px;
}
 
a{ color: inherit; }
 
:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
 
/* subtle grain so flat dark background doesn't feel like a template */
.grain{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
 
/* =========================================================
   Header
========================================================= */
.site-header{
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(18,19,26,0.86);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.header-inner{
  display:flex;
  align-items:center;
  justify-content: space-between;
  height: 64px;
}
.header-nav{ display:flex; gap: 28px; }
.header-nav a{
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--ink-dim);
  transition: color 0.15s ease;
}
.header-nav a:hover{ color: var(--ink); }
 
/* =========================================================
   Hero
========================================================= */
.hero{
  padding: 48px 0 16px;
  position: relative;
  z-index: 1;
}
.hero-inner{
  display: grid;
  grid-template-columns: minmax(220px, 42%) minmax(0, 1fr);
  gap: 36px;
  align-items: stretch;
}
.hero-copy{
  display: flex;
  flex-direction: column;
}
.hero-photo{
  width: 100%;
  aspect-ratio: 4 / 5;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-raised);
}
.hero-photo img,
.hero-photo-placeholder{
  width: 100%;
  height: 100%;
  display: block;
}
.hero-photo img{ object-fit: cover; }
.hero-photo-placeholder{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-dim);
  background: linear-gradient(145deg, var(--bg-raised), #242735);
  font-family: var(--font-mono);
  text-align: center;
  text-transform: uppercase;
}
.hero-photo-placeholder span{ color: var(--ink); font-size: 0.9rem; }
.hero-photo-placeholder small{ font-size: 0.68rem; text-transform: none; }
.hero-title{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.12;
  margin: -8px 0 12px;
  max-width: 14ch;
  letter-spacing: -0.01em;
}
.hero-sub{
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin: 0 0 16px;
}
.hero-sub:last-child{ margin: auto 0 0; }
 
/* =========================================================
   Work / game cards
========================================================= */
.work{
  padding: 20px 0 40px;
  position: relative;
  z-index: 1;
}
.game{
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
.game:last-child{ border-bottom: 1px solid var(--line); }
 
.game-cover{
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-raised);
  transition: opacity 0.15s ease;
}
.game-cover:hover{ opacity: 0.85; }
 
.game-heading h2 a{
  text-decoration: none;
  color: inherit;
  transition: color 0.15s ease;
}
.game-heading h2 a:hover{ color: var(--accent); }
.game-cover img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-fallback{
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: rgba(237,234,227,0.85);
  background: linear-gradient(155deg, var(--tile-a, #333) 0%, var(--tile-b, #111) 100%);
}
.performance-cover .cover-fallback{
  --tile-a: #315d58;
  --tile-b: #172320;
  font-size: 1.05rem;
  color: #dce8d9;
}
.chempunk-cover .cover-fallback{
  --tile-a: #5a3d29;
  --tile-b: #211a19;
  color: #f1d2a7;
  font-size: 1.05rem;
}
 
.game-heading{
  display:flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.game-heading h2{
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}
.game-meta{
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin: 8px 0 14px;
}
.game-desc{
  margin: 0 0 18px;
  max-width: 62ch;
  color: rgba(237,234,227,0.88);
}
.game-tags{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.game-tags span{
  font-size: 0.78rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
}
.game-links{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
}
 
.btn{
  display: inline-block;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:hover{ background: #e6ba46; }
.btn:active{ transform: translateY(1px); }
 
@media (max-width: 640px){
  .hero-inner{ grid-template-columns: 1fr; gap: 32px; }
  .hero-photo{ max-width: 220px; }
  .hero-sub{ font-size: 1.05rem; }
  .game{ grid-template-columns: 1fr; }
  .game-cover{ aspect-ratio: 16 / 9; }
}
 
/* =========================================================
   Game detail page
========================================================= */
.detail-header{
  padding: 28px;
}
.back-link{
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s ease;
}
.back-link:hover{ color: var(--ink); }
 
.detail-hero{
  padding: 8px 0 48px;
  position: relative;
  z-index: 1;
}
.chempunk-detail-hero{ padding-bottom: 27px; }
.chempunk-detail-hero .detail-meta{ margin-bottom: 7px; }
.chempunk-page .wrap{ padding-left: 28px; padding-right: 28px; }
.windward-page .wrap{ padding-left: 28px; padding-right: 28px; }
.windward-detail-hero{ padding-bottom: 10px; }
.detail-heading{
  display:flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.detail-heading h1{
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.detail-meta{
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--ink-dim);
  margin: 0 0 28px;
}
.detail-tags{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.detail-tags span{
  font-size: 0.78rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
}
.performance-hero{ padding: 8px 28px; }
.performance-intro{
  max-width: 58ch;
  color: var(--ink-dim);
  margin: 0 0 24px;
}
.performance-projects{
  padding-bottom: 64px;
  position: relative;
  z-index: 1;
}
.performance-project{
  padding: 34px 0 40px;
  border-top: 1px solid var(--line);
}
.performance-project:last-child{ border-bottom: 1px solid var(--line); }
.performance-project-heading{ margin-bottom: 22px; }
.performance-number{
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent);
  margin: 0 0 5px;
}
.performance-project h2{
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}
.performance-project-layout{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.performance-gallery{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  container-type: inline-size;
}
.performance-shot{ min-width: 0; margin: 0; }
.performance-shot--featured{ grid-column: 1 / -1; }
.performance-shot-placeholder{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 16px;
  border: 1px dashed #46645b;
  background-color: #172320;
  background-image: linear-gradient(rgba(155, 190, 167, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(155, 190, 167, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  text-align: center;
  overflow: hidden;
}
.performance-shot-placeholder img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}
.performance-shot-placeholder span{
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #b8d0bd;
}
.performance-shot-placeholder small{
  font-size: 0.75rem;
  color: var(--ink-dim);
}
.performance-shot > img{
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--line);
}
.performance-shot > video{
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
  border: 1px solid var(--line);
}
.performance-shot--small .performance-shot-placeholder{ aspect-ratio: 16 / 9; }
.performance-shot--small > img{
  aspect-ratio: auto;
  object-fit: initial;
  background: transparent;
}
.performance-shot--shell-sort > img{
  width: auto;
  height: calc((100cqw - 12px) / 2.472);
  margin-inline: 0;
}
.performance-shot--merge-sort > img{
  width: auto;
  height: calc((100cqw - 12px) / 2.472);
  margin-left: calc(-17.44cqw + 2px);
}
.performance-shot figcaption{
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
}
.performance-story{ display: grid; gap: 18px; }
.performance-summary{
  margin: 0;
  font-size: 1.02rem;
  color: rgba(237,234,227,0.9);
}
.performance-story-block{
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.performance-story-block h3{
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: rgba(237,234,227,0.88);
}
.performance-story-block p{
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-dim);
}
@media (max-width: 640px){
  .performance-project-layout{ grid-template-columns: 1fr; gap: 24px; }
}
 
/* video */
.media-block{
  padding: 8px 0 56px;
  position: relative;
  z-index: 1;
}
.video-frame{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.chempunk-media{
  padding: 2px 0 56px;
  position: relative;
  z-index: 1;
}
.chempunk-feature,
.chempunk-gif{ min-width: 0; margin: 0; }
.chempunk-feature{ margin-bottom: 28px; }
.chempunk-media-image{
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 12px;
  background-color: #211e1b;
  object-fit: cover;
}
.chempunk-feature-image{ aspect-ratio: 16 / 8; }
.chempunk-feature figcaption,
.chempunk-gif figcaption{
  margin-top: 8px;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.chempunk-gif-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 640px){
  .chempunk-gif-grid{ grid-template-columns: 1fr; }
}
.image-collage img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: detail-collage-fade 30s ease-in-out infinite;
}
.image-collage img:nth-child(1){ animation-delay: 0s; }
.image-collage img:nth-child(2){ animation-delay: -24s; }
.image-collage img:nth-child(3){ animation-delay: -18s; }
.image-collage img:nth-child(4){ animation-delay: -12s; }
.image-collage img:nth-child(5){ animation-delay: -6s; }
@keyframes detail-collage-fade{
  0%, 14%{ opacity: 1; }
  20%, 94%{ opacity: 0; }
  100%{ opacity: 1; }
}
@media (prefers-reduced-motion: reduce){
  .image-collage img{ animation: none; opacity: 0; }
  .image-collage img:first-child{ opacity: 1; }
}
/* long-form body */
.detail-body{
  padding: 8px 0 64px;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 56px;
  border-top: 1px solid var(--line);
}
.chempunk-body{
  grid-template-columns: 1fr;
  border-top: none;
}
.chempunk-body::before{
  content: "";
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  border-top: 1px solid var(--line);
}
.detail-copy h2{
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 40px 0 14px;
}
.detail-copy h2:first-child{ margin-top: 40px; }
.windward-copy h2,
.windward-copy h2:first-child{ margin-top: 10px; }
.detail-copy p{
  max-width: 62ch;
  color: rgba(237,234,227,0.88);
  margin: 0 0 16px;
}
.detail-side{
  border-left: 1px solid var(--line);
  padding-left: 32px;
  height: fit-content;
}
.side-block{ margin-bottom: 28px; }
.side-block h3{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
  margin: 0 0 8px;
  font-weight: 500;
}
.side-block p{
  margin: 0;
  font-size: 0.92rem;
}
 
/* gallery */
.gallery{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 12px;
}
.gallery-tile{
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: var(--bg-raised);
  display:flex;
  align-items:center;
  justify-content:center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
  border: 1px dashed var(--line);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.gallery-tile:hover{
  border-color: var(--accent);
  transform: translateY(-2px);
}
.gallery-tile img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lightbox[hidden]{ display: none; }
.lightbox{
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) minmax(0, 900px) minmax(44px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 40px 28px;
  background: rgba(10, 11, 16, 0.94);
}
.lightbox-content{
  width: 100%;
  margin: 0;
  text-align: center;
}
.lightbox-image{
  display: block;
  width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border: 1px solid var(--line);
  background: var(--bg-raised);
}
.lightbox-caption{
  margin-top: 12px;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.lightbox button{
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  background: var(--bg-raised);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.lightbox button:hover{ border-color: var(--accent); color: var(--accent); }
.lightbox-close{
  position: absolute;
  top: 20px;
  right: 24px;
}
.lightbox-open{ overflow: hidden; }
 
@media (max-width: 720px){
  .detail-body{ grid-template-columns: 1fr; }
  .detail-side{
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 28px;
  }
  .gallery{ grid-template-columns: repeat(2, 1fr); }
  .lightbox{
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 10px;
    padding: 56px 12px 24px;
  }
  .lightbox button{ width: 38px; height: 38px; }
}
 
/* =========================================================
   Footer
========================================================= */
.site-footer{
  border-top: 1px solid var(--line);
  padding: 56px 0 72px;
  position: relative;
  z-index: 1;
}
.contact-footer{ padding: 14px 0 36px; }
.footer-links{
  display:flex;
  gap: 20px;
  margin-top: 26px;
}
.footer-links a{
  text-decoration: none;
  color: var(--ink-dim);
  font-size: 0.9rem;
}
.footer-links a:hover{ color: var(--ink); }