/* ============================================================================
   THEME — change colours/fonts here. Most look tweaks are one line.
   ========================================================================== */
:root {
  --bg: #000000;          /* page background  (try #ffffff for a white site) */
  --fg: #ffffff;          /* text colour      (use #000000 on a white site)  */
  --muted: #888888;       /* faded text (years, footer)                      */
  --accent: #6cf;         /* link colour                                     */
  --gap: 10px;            /* space between project-page images                */
  --cols: 5;              /* number of columns in the grid (desktop)         */
  --grid-gap: 4px;        /* tight gap between cover tiles (like Adobe)       */
  --maxw: 1600px;         /* max content width                               */
  --font: "Times New Roman", Times, serif;
}

/* light theme (SITE.theme === "light") */
body.light {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #777777;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-y: scroll; }   /* always reserve the scrollbar → no width jump / spurious resize */

/* hold the page hidden until the 3D objects load, then fade everything in */
body { transition: opacity .4s ease; }
html.loading body { opacity: 0; }

/* custom cursor — yellow arrow with a black outline (applies everywhere) */
* {
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%3E%3Cpath%20d='M3%202%20L3%2017%20L7%2013%20L10%2018%20L12%2017%20L10%2011%20L15%2011%20Z'%20fill='%23ffe000'%20stroke='%23000'%20stroke-width='1.8'%20stroke-linejoin='round'%20stroke-linecap='round'/%3E%3C/svg%3E") 3 2, auto !important;
}
/* sticky footer: push the copyright to the bottom on short pages */
body:not(.landing) { display: flex; flex-direction: column; min-height: 100vh; }
body:not(.landing) main { flex: 1 0 auto; }
#site-footer { flex-shrink: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }

/* fade gallery / project images in as they load (avoids hard pop-in) */
.sc-img img, #pmedia .media img { opacity: 0; transition: opacity .45s ease; }
.sc-img img.ld, #pmedia .media img.ld { opacity: 1; }

/* text selection highlight — yellow, not the default blue */
::selection { background: #ffe000; color: #000; }
::-moz-selection { background: #ffe000; color: #000; }

/* Header --------------------------------------------------------------------*/
header.nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  flex-wrap: wrap;
}
header.nav .menu { display: flex; gap: 28px; flex-wrap: wrap; }
header.nav .menu a { letter-spacing: .02em; }
header.nav .menu a.italic { font-style: italic; }
header.nav .menu a:hover,
header.nav .name:hover { text-decoration: underline; }
header.nav .menu a.active { text-decoration: underline; }
header.nav .name { font-style: italic; text-decoration: underline; white-space: nowrap; }

/* Main / pages --------------------------------------------------------------*/
main { max-width: var(--maxw); margin: 0 auto; padding: 0 32px 80px; }

/* Landing launcher (3 rotating dithered objects) ----------------------------*/
body.landing { overflow: hidden; height: 100vh; }
#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; touch-action: none; pointer-events: none; }
body.landing header.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 20; }
#obj-labels { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#welcome {
  position: fixed; z-index: 6; pointer-events: none;
  color: #000; font-family: var(--font); font-style: italic; font-weight: 400; font-size: 26px; line-height: 1.02;
}
@media (max-width: 760px) { #welcome { font-size: 16px; } }
body.landing footer.foot { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; padding: 8px 0; }
.obj-label {
  position: absolute; transform: translate(-100%, -115%);   /* sits to the top-left of the object */
  opacity: 0; transition: opacity .12s ease;
  color: #ffff00; font-family: var(--font); font-style: italic; font-weight: 400;
  font-size: 40px; letter-spacing: .01em; white-space: nowrap; text-decoration: none; text-transform: none;
  paint-order: stroke fill;            /* outline behind the fill = clean edges */
  -webkit-text-stroke: 3px #000; stroke: #000;
}
.obj-label.show { opacity: 1; }   /* non-interactive: clicks go through to the window-level short-click handler */
@media (max-width: 760px) { .obj-label { font-size: 26px; } }

/* object nav bar — fixed/floating at the top (landing gets a minimal one too) */
#site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 50; pointer-events: none; }
#site-header .nav-label { pointer-events: auto; }   /* canvas stays click-through */
@media (max-width: 600px) { #site-header { position: absolute; top: 14px; } }   /* phones: nav scrolls away + a little top margin */
body:not(.landing) main { padding-top: 150px; }      /* clear the fixed navbar */
@media (max-width: 600px) { body:not(.landing) main { padding-top: 122px; } }
#navbar { position: relative; width: 100%; }
#nav-canvas { display: block; width: 100%; }         /* height set by the renderer */
#nav-labels { position: absolute; inset: 0; pointer-events: none; }
.nav-label {
  position: absolute; transform: translate(-50%, -100%);
  opacity: 0; transition: opacity .12s ease;
  color: #ffff00; font-family: var(--font); font-style: italic; font-weight: 400; font-size: 16px;
  white-space: nowrap; text-decoration: none;
  paint-order: stroke fill; -webkit-text-stroke: 2.5px #000;
}
.nav-label.show { opacity: 1; pointer-events: auto; cursor: pointer; }
.nav-sub {
  position: absolute; transform: translateX(-12px); white-space: nowrap; pointer-events: none;
  display: inline-flex; align-items: flex-end; gap: 0;
}
.nav-sub .ns-elbow { display: block; flex: none; margin-bottom: 2px; }
.nav-sub .ns-t {
  color: #ffff00; font-family: var(--font); font-style: italic; font-size: 12px; line-height: 1;
  paint-order: stroke fill; -webkit-text-stroke: 2px #000;
}

/* mini rotating object (top-left of inner pages) — legacy, unused */
#mini-home { position: fixed; top: 8px; left: 10px; z-index: 30; width: 112px; height: 112px; display: block; }
#mini-canvas { width: 112px; height: 112px; display: block; }
#mini-label {
  position: absolute; left: 56px; top: 56px; transform: translate(-50%, -50%);
  color: #ffff00; font-family: var(--font); font-style: italic; font-weight: 400; font-size: 21px;
  white-space: nowrap; pointer-events: none; text-transform: none;
  paint-order: stroke fill; -webkit-text-stroke: 2.5px #000;
}
.has-mini header.nav { padding-left: 132px; }
@media (max-width: 760px) {
  #mini-home, #mini-canvas { width: 78px; height: 78px; }
  #mini-label { left: 39px; top: 39px; font-size: 14px; -webkit-text-stroke-width: 2px; }
  .has-mini header.nav { padding-left: 92px; }
}

/* in-place shuffle popup on the landing */
#shuffle-pop {
  position: fixed; z-index: 0; width: 46vw;   /* desktop: ~half the page (right side); below the canvas */
  opacity: 0; pointer-events: none; transition: opacity .15s ease; text-align: center;
}
@media (max-width: 600px) { #shuffle-pop { width: 88vw; } }
#shuffle-pop.show { opacity: 1; pointer-events: auto; }
#shuffle-pop .sp-img { display: block; cursor: pointer; }
#shuffle-pop .sp-img img {
  width: auto; height: auto; max-width: 100%; max-height: 82vh;   /* keep aspect, never overflow */
  display: block; margin: 0 auto; box-shadow: 0 0 0 1px #000; transition: box-shadow .12s ease;
}
#shuffle-pop:hover .sp-img img { box-shadow: 0 0 0 1px #000, 0 0 0 2px #ffe000; }   /* hovering anywhere */
#shuffle-pop .sp-cap {
  display: block; margin-top: 9px; color: #ffff00; text-decoration: none; cursor: pointer;
  font-family: var(--font); font-style: italic; font-size: 13px;
  paint-order: stroke fill; -webkit-text-stroke: 2px #000;
}
#shuffle-pop:hover .sp-cap { text-decoration: underline; }

/* Homepage mode bar + shuffle -----------------------------------------------*/
.home-bar { display: flex; gap: 22px; justify-content: center; margin: 0 0 30px; }
.home-bar button {
  background: none; border: 0; color: var(--muted);
  font: inherit; font-style: italic; cursor: pointer; padding: 2px 0;
}
.home-bar button:hover, .home-bar button.active { color: var(--fg); text-decoration: underline; }

.shuffle { max-width: 560px; margin: 6vh auto 0; text-align: center; }
/* fixed-height frame so the shuffle never jumps as images change */
.shuffle-img {
  display: flex; align-items: center; justify-content: center;
  height: 44vh; min-height: 240px;
}
.shuffle-img img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.shuffle-cap { margin: 18px 0 14px; color: var(--muted); font-size: 14px; }
.shuffle-cap a { color: var(--fg); }
.shuffle-cap a:hover { text-decoration: underline; }
.shuffle-again {
  background: none; border: 0; color: var(--muted);
  font: inherit; font-style: italic; cursor: pointer; padding: 2px 0;
}
.shuffle-again:hover { color: var(--fg); text-decoration: underline; }

/* Cover grid (uniform cropped tiles, like Adobe) ----------------------------*/
.ugrid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: var(--grid-gap);
}
.tile {
  position: relative;
  aspect-ratio: 5 / 7;          /* uniform portrait cells, like Adobe */
  background: #111;
  overflow: hidden;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-style: italic; font-size: 13px;
  text-align: center; padding: 12px;
  background: repeating-linear-gradient(45deg,#0d0d0d,#0d0d0d 10px,#141414 10px,#141414 20px);
}

/* Scattered gallery (works / wip) — random non-overlapping previews ----------*/
/* works filter — a small dropdown (sharp, upright) */
#works-filter { width: 90vw; margin: 0 auto 16px; text-align: center; }   /* mobile: centred under nav */
@media (min-width: 900px) { #works-filter { position: fixed; left: 16px; top: 150px; z-index: 8; width: auto; margin: 0; text-align: left; } }
#wf-select {
  font-family: var(--font); font-style: normal; font-size: 15px; color: var(--fg);
  background: var(--bg); border: 1.5px solid var(--fg); border-radius: 0; padding: 6px 12px; cursor: pointer;
}
#wf-select:hover { background: rgba(0,0,0,.05); }

.scatter { position: relative; width: 74vw; margin-left: calc(50% - 37vw); }
/* phones: plain straight single column (no scatter) */
.scatter-simple { width: 88vw; margin: 4px auto 0; display: flex; flex-direction: column; gap: 30px; }
.scatter-simple .scatter-card { position: relative; width: 100%; cursor: auto; }
.scatter-simple .sc-img { width: 100%; height: auto; }
.scatter-simple .sc-img img { width: 100%; height: auto; }   /* full image, natural aspect */
.scatter-simple .sc-ph { display: block; width: 100%; aspect-ratio: 3/4; }
.scatter-simple .sc-cap { display: block; text-align: center; margin-top: 7px; }
.scatter-card { position: absolute; display: block; text-decoration: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.scatter-card img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }   /* never start a native image drag */
.scatter-card.dragging { z-index: 5; cursor: grabbing; touch-action: none; }
.scatter-card.dragging .sc-img { box-shadow: 0 0 0 1px #000, 0 0 0 3px #ffe000, 0 0 0 4px #000; }
.scatter-card .sc-img { display: block; width: 100%; overflow: hidden; box-shadow: 0 0 0 1px #000; transition: box-shadow .12s ease; }
.scatter-card .sc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scatter-card .sc-ph { display: block; width: 100%; height: 100%; background: repeating-linear-gradient(45deg,#eee,#eee 8px,#e3e3e3 8px,#e3e3e3 16px); }
.scatter-card .sc-cap {
  display: block; text-align: center; margin-top: 6px; color: #ffff00;
  font-family: var(--font); font-style: italic; font-size: 13px;
  paint-order: stroke fill; -webkit-text-stroke: 2px #000;
}
.scatter-card:hover .sc-img { box-shadow: 0 0 0 1px #000, 0 0 0 2px #ffe000, 0 0 0 3px #000; }
.scatter-card:hover .sc-cap { text-decoration: underline; }

#pmedia .pblock + .pblock { margin-top: var(--gap); }   /* spacing between layout boxes */

/* Masonry — used on project pages (natural aspect, no cropping) --------------*/
.masonry { display: flex; gap: var(--gap); align-items: flex-start; }
.mcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.tile .caption {
  position: absolute; inset: auto 0 0 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: #fff;
  font-size: 13px;
  opacity: 0; transition: opacity .18s ease;
}
.tile:hover .caption { opacity: 1; }
.tile .caption .t { font-style: italic; }
.tile .caption .m { color: #cfcfcf; }

/* Text pages (about / contact) ---------------------------------------------*/
.prose { max-width: 620px; margin: 8vh auto 0; text-align: center; }
.prose p { margin: 0 0 1.2em; }
.prose .sep { color: var(--muted); margin: 1.4em 0; }
.prose a { color: var(--accent); text-decoration: underline; }

.section-title { text-align: center; font-style: italic; font-weight: normal; font-size: 14px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 6vh 0 14px; }

/* Contact form (compact / subtle) -------------------------------------------*/
.form { max-width: 340px; margin: 0 auto; display: grid; gap: 10px; }
.form label { font-size: 11px; color: var(--muted); }
.form input, .form textarea {
  width: 100%; background: transparent; color: var(--fg);
  border: 1px solid var(--muted); padding: 6px 8px;
  font: 13px var(--font); border-radius: 0;
}
.form textarea { min-height: 80px; resize: vertical; }
.form button {
  justify-self: start; background: none; color: var(--fg);
  border: 1px solid var(--fg); padding: 6px 16px; font: 13px var(--font); font-style: italic; cursor: pointer;
}
.form button:hover { background: var(--fg); color: var(--bg); }

/* Project detail page -------------------------------------------------------*/
.project-head { text-align: center; margin: 6vh auto 4vh; }
.project-head h1 { font-style: italic; font-weight: normal; font-size: 26px; margin: 0 0 6px; }
.project-head .meta { color: var(--muted); font-size: 14px; }
.project-head .ptags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.project-head .ptags span { font-size: 11px; color: var(--muted); border: 1px solid var(--muted); border-radius: 999px; padding: 1px 8px; opacity: .65; }
.project-desc { max-width: 620px; margin: 0 auto 5vh; text-align: center; }
.project-desc p { margin: 0 0 1em; }
.project-desc .fr { color: var(--muted); }

/* project videos */
.project-videos { max-width: 1000px; margin: 0 auto 28px; display: grid; gap: var(--gap); }
.project-videos .pv { position: relative; padding-top: 56.25%; }
.project-videos .pv iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* project media (uses the shared .masonry layout) */
.pmedia-wrap { max-width: 1200px; margin: 0 auto; }
.pmedia-wrap .media img { width: 100%; height: auto; display: block; }
.media-text.video-note { color: var(--muted); font-style: italic; text-align: center; margin-top: 24px; }
.media-text { text-align: center; max-width: 620px; margin: 24px auto 0; }
.project-back { text-align: center; margin: 6vh 0 0; }
.project-back a { color: var(--muted); }
.project-back a:hover { color: var(--fg); text-decoration: underline; }

/* Footer --------------------------------------------------------------------*/
footer.foot { text-align: center; color: var(--muted); padding: 40px 0 50px; font-size: 13px; }

/* Responsive ----------------------------------------------------------------*/
@media (max-width: 1100px) { :root { --cols: 4; } }
@media (max-width: 800px)  { :root { --cols: 3; } header.nav { padding: 20px; } }
@media (max-width: 540px)  { :root { --cols: 2; } main { padding: 0 14px 60px; } }
