:root {
  --bg: #fff;
  --ink: #111;
  --muted: #8a8a8a;
  --line: #ececec;
  --soft: #f6f6f5;
  --side: 248px;
  --gap: 20px;
  --pad: 32px;
  --grad: linear-gradient(90deg, #EC2B7A, #FE7BBF, #CEFF32, #FE7BBF, #EC2B7A); /* the logo's Neon Petal colours */
  --font: "Satoshi", "IBM Plex Sans Thai", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
h1, h2, p, dl, dd, ol { margin: 0; padding: 0; }
.muted { color: var(--muted); }
.ph { color: #b5b5b5; letter-spacing: .04em; }
.th { font-family: "IBM Plex Sans Thai", var(--font); }

/* ---------- sidebar ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); padding: var(--pad) 24px var(--pad) var(--pad);
  display: flex; flex-direction: column; gap: 28px; z-index: 10; background: var(--bg); }
.logo { font-size: 22px; font-weight: 700; letter-spacing: .14em; }
/* liquid logo mark; the canvas overhangs so the drawn logo lines up with the text column */
.logo canvas { display: none; width: 104px; aspect-ratio: 1; margin: -14px 0 -14px -12px; }
.has-motion-logo .logo canvas { display: block; }
.has-motion-logo .logo-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- liquid cursor (mouse devices only; set up by cursor.js) ---------- */
.liquid-cursor, .liquid-cursor * { cursor: none !important; }
.liquid-cursor-layer { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 200; pointer-events: none; }

/* ---------- loader ---------- */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); cursor: pointer;
  transition: opacity .6s ease;
  animation: loader-fallback .4s 8s forwards; /* never trap the page if the script fails */ }
.loader canvas { width: min(80vmin, 580px); aspect-ratio: 1; }
.loader.out { opacity: 0; pointer-events: none; }
@keyframes loader-fallback { to { opacity: 0; visibility: hidden; } }
.intro { color: #555; max-width: 190px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { color: var(--muted); width: max-content; transition: color .2s; }
.nav a:hover, .nav a.on { color: var(--ink); }
.nav a.on::before { content: "— "; }
.contact { margin-top: auto; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.contact a:hover { text-decoration: underline; }

.main { margin-left: var(--side); padding: var(--pad) var(--pad) 80px 0; min-height: 100vh; }

/* ---------- hero (motion covers) ---------- */
.hero { position: relative; aspect-ratio: 16 / 9; max-height: calc(100vh - 2 * var(--pad) - 56px); width: 100%;
  background: #0b0b0b; overflow: hidden; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.slide.on { opacity: 1; pointer-events: auto; }
.slide video, .slide img.vid { width: 100%; height: 100%; object-fit: cover; }
/* square pieces sit centered on their own background instead of being cropped */
.slide[style*="1/1"] { background: #1d1c21; }
.slide[style*="1/1"] video, .slide[style*="1/1"] img.vid { object-fit: contain; }
.hero-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: end; justify-content: space-between;
  gap: 16px; padding: 48px 20px 16px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.45));
  pointer-events: none; }
.hero-titles { position: relative; flex: 1; height: 20px; }
.ht { position: absolute; left: 0; bottom: 0; opacity: 0; transform: translateY(6px); transition: .6s; white-space: nowrap; }
.ht.on { opacity: 1; transform: none; pointer-events: auto; }
.ht b { font-weight: 500; }
.ht span { opacity: .7; margin-left: 8px; }
.dots { display: flex; gap: 6px; pointer-events: auto; }
.dots button { width: 36px; height: 14px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.dots button::before, .dots i { content: ""; position: absolute; left: 0; top: 6px; height: 2px; background: rgba(255,255,255,.35); width: 100%; }
.dots i { background: #fff; width: 0; }
.dots button:not(.on) i { width: 0 !important; transition: none !important; }

/* ---------- running images ---------- */
.reels { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 0; overflow: hidden; }
.reel { overflow: hidden; }
.reel-track { display: flex; gap: 10px; width: max-content; animation: run 80s linear infinite; }
.reel.right .reel-track { animation-direction: reverse; animation-duration: 95s; }
.reels:hover .reel-track { animation-play-state: paused; }
.reel img { height: 220px; width: auto; max-width: none; background: var(--soft); transition: opacity .3s; }
.reel a:hover img { opacity: .75; }
@keyframes run { to { transform: translateX(-50%); } }

/* ---------- blocks / grid ---------- */
.block { margin-top: 72px; }
.block.first { margin-top: 0; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.block-head h2 { font-size: 13px; font-weight: 500; }
.block-head a { color: var(--muted); }
.block-head a:hover { color: var(--ink); }

/* hand-set rows (HOME in works.js): every card in a row is the same height, widths follow each cover's proportions */
.grid { display: flex; flex-direction: column; gap: 48px; min-height: 60vh; }
.grid-row { display: flex; gap: var(--gap); }
.card { flex: var(--r) 1 0; min-width: 0; }
.card-media { overflow: hidden; background: var(--soft); aspect-ratio: var(--r); }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1); }
/* white-background covers get a hairline so they don't melt into the page */
.card-media.contain { background: #fff; outline: 1px solid var(--line); outline-offset: -1px; }
.trim { width: 100%; aspect-ratio: 1466 / 834; overflow: hidden; }
.card-media div.trim video, div.trim video, div.trim img.vid { width: calc(100% * 1476 / 1466); max-width: none; height: auto; object-fit: initial; transform: none; }
/* the Victory export has a dark 2px line on its right and bottom; scale it so a safe margin falls outside */
.hero:has(.trim-edge) { overflow: hidden; }
.slide.trim-edge { overflow: hidden; }
.slide.trim-edge video, .slide.trim-edge img.vid { width: calc(100% * 1476 / 1466); height: calc(100% * 842 / 834); max-width: none; object-fit: cover; }
.card:hover .card-media img, .card:hover .card-media video { transform: scale(1.035); }
.card-cap { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; margin-top: 10px; }
.card-cap .t { font-weight: 500; }
.card-cap .c { grid-column: 1; color: var(--muted); }
.card-cap .t, .card-cap .c { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-cap .y { grid-row: 1; grid-column: 2; color: var(--muted); }

/* ---------- works index ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.filters button { font: inherit; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.filters button:hover { color: var(--ink); border-color: var(--muted); }
.filters button.on { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.filters sup { font-size: 10px; margin-left: 3px; vertical-align: super; line-height: 0; opacity: .7; }

.works-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.list { list-style: none; }
.list a { position: relative; display: grid; grid-template-columns: 32px 1fr 1fr 40px; gap: 16px; padding: 14px 0;
  border-bottom: 1px solid var(--line); transition: padding .3s, color .3s;
  animation: rise .6s cubic-bezier(.2,.7,.2,1) backwards; animation-delay: calc(var(--i) * 40ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
/* a thin gradient line draws under the row that is showing on the stage */
.list a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad);
  background-size: 200% 100%; transform: scaleX(0); transform-origin: left; transition: transform .5s cubic-bezier(.2,.7,.2,1);
  animation: flow 4s linear infinite; }
.list a.cur::after { transform: scaleX(1); }
.list a.cur { padding-left: 10px; }
.list .n, .list .c, .list .y { color: var(--muted); }
.list a.cur .n { color: transparent; background: var(--grad); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text;
  animation: flow 4s linear infinite; font-weight: 500; }
@keyframes flow { to { background-position: -200% 0; } }
.list .y { text-align: right; }
.list .t { font-weight: 500; }

/* every piece of one work at once, each at its own proportions */
.stage { position: sticky; top: var(--pad); display: block; height: min(calc(100vh - 2 * var(--pad)), 780px); }
.collage { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; opacity: 0; transition: opacity .5s; }
.collage.on { opacity: 1; }
.cl-row { display: flex; gap: 8px; justify-content: center; }
.cl-row img, .cl-row video { flex: none; max-width: none; object-fit: cover; background: var(--soft); }
.cl-row .light { outline: 1px solid var(--line); outline-offset: -1px; }

/* ---------- project page ---------- */
.back { color: var(--muted); display: inline-block; margin-bottom: 40px; }
.back:hover { color: var(--ink); }
.work-head h1 { font-size: clamp(32px, 4.4vw, 64px); font-weight: 500; letter-spacing: -.02em; line-height: 1.05; }
.work-head .sub { color: var(--muted); font-size: 16px; margin-top: 8px; }
.work-info { display: grid; grid-template-columns: 1fr 1.5fr; gap: 40px; margin: 40px 0 56px; }
.meta .row { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.meta .row:last-child { border-bottom: 1px solid var(--line); }
.meta dt { color: var(--muted); }
.work-info .meta .row { grid-template-columns: 1fr; }
.desc { display: flex; flex-direction: column; gap: 14px; font-size: 15px; line-height: 1.6; max-width: 620px; }
.desc { font-size: 14px; gap: 12px; }
.desc p:first-child { font-size: 16px; line-height: 1.55; }
.desc b { font-weight: 500; }
.desc ul { margin: -4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.desc li::marker { color: var(--muted); }

.gallery { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); }
.g { margin: 0; grid-column: span 12; }
.g.half { grid-column: span 6; }
.g.narrow { grid-column: 3 / span 8; }
.g.small { grid-column: 4 / span 6; }
.g.tiny { grid-column: 5 / span 4; }
.g.label { margin: 48px 0 -8px; font-size: 13px; color: var(--muted); }
.g.stack { display: flex; flex-direction: column; gap: var(--gap); }
.g.stack figure { margin: 0; flex: 1 1 0; min-height: 0; }
.g.stack img { height: 100%; object-fit: cover; }
.g.stack.small { gap: 4px; margin-bottom: 24px; }
.g.stack.small figure { flex: none; }
.g.stack.small img { height: auto; }
.g.row { display: flex; gap: var(--gap); align-items: flex-start; }
.g.row figure { margin: 0; min-width: 0; }
.g.row.crop figure { flex: 1 1 0; overflow: hidden; }
.g.row.crop img, .g.row.crop video { height: 100%; object-fit: cover; }
.g.third { grid-column: span 4; }
.g.quarter { grid-column: span 3; }
.g img, .g video { width: 100%; height: auto; }
.g figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }
.g img { cursor: zoom-in; }

.next { display: flex; flex-direction: column; gap: 6px; margin-top: 96px; padding-top: 20px; border-top: 1px solid var(--line); }
.next .t { font-size: clamp(24px, 3vw, 40px); font-weight: 500; letter-spacing: -.01em; }
.next:hover .t { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

/* ---------- interactive ---------- */
.play { margin: 0 0 var(--gap); padding: 28px; background: var(--soft); }
.play.plain { padding: 0; background: none; }
.play-label { color: #555; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--ink); border-radius: 99px; padding: 2px 9px; color: var(--ink); }
.frame { width: 100%; background: #fff; }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.open { display: inline-block; margin-top: 12px; color: var(--muted); }
.open:hover { color: var(--ink); }

.flipcard { perspective: 2400px; cursor: pointer; max-width: 900px; margin: 0 auto; outline: none; }
.flipcard .inner { position: relative; aspect-ratio: 3 / 2; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.3,.1,.2,1); }
.flipcard:hover .inner { translate: 0 -6px; }
.flipcard.flipped .inner { transform: rotateY(180deg); }
.flipcard .face { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; backface-visibility: hidden;
  -webkit-backface-visibility: hidden; box-shadow: 0 24px 50px rgba(0,0,0,.18), 0 3px 8px rgba(0,0,0,.08); }
.flipcard .face.back { transform: rotateY(180deg); }
.flipcard:focus-visible .inner { outline: 2px solid var(--ink); outline-offset: 6px; }

/* the render sits centred; the spirits run beneath it as small cut-outs, each named */
.crystal { display: flex; flex-direction: column; align-items: center; text-align: center; }
.crystal .play-label { justify-content: center; color: var(--muted); }
.crystal-stage { width: min(100%, 560px); aspect-ratio: 1; background: #5d565d; overflow: hidden; }
.crystal-stage img { width: 100%; height: 100%; object-fit: cover; transition: opacity .16s, transform .4s; }
.crystal-stage img.swap { opacity: 0; transform: scale(.98); }
.spirits { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 22px; margin-top: 28px; }
.spirits button { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 8px; transition: color .2s; }
.spirits img { height: 26px; width: auto; display: block; opacity: .55; transition: opacity .2s, transform .25s; }
.spirits span { font-size: 11px; }
.spirits button:hover img, .spirits button.on img { opacity: 1; }
.spirits button:hover img { transform: translateY(-2px); }
.spirits button.on { color: var(--ink); }
.spirit-name { margin-top: 14px; font-size: 12px; color: var(--muted); min-height: 1.5em; }
.seg { display: flex; justify-content: center; gap: 18px; margin-top: 14px; }
.seg button { border: 0; background: none; font: inherit; padding: 0 0 2px; cursor: pointer; color: var(--muted); }
.seg button.on { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- about ---------- */
.about .big { font-size: clamp(48px, 9vw, 140px); font-weight: 500; letter-spacing: .04em; line-height: 1; }
.about .intro { display: flex; align-items: flex-start; gap: 32px; max-width: 820px; margin-top: 40px; }
.about .portrait { display: block; width: 180px; flex: none; }
.about .lead + .lead { margin-top: .8em; }
.about .lead { font-size: clamp(18px, 1.8vw, 24px); line-height: 1.45; max-width: 820px; }
@media (max-width: 480px) { .about .intro { gap: 16px; } .about .portrait { width: 110px; } .about .lead { font-size: 16px; } }
.about .lead.th { color: #555; font-size: 17px; margin-top: 14px; }
.about .meta { max-width: 820px; margin-top: 56px; }
.about .edu { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.about .edu li { display: grid; grid-template-columns: 100px 1fr; gap: 16px; }
.about .edu span { color: var(--muted); }
.about .meta .row { grid-template-columns: 140px 1fr; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(255,255,255,.97); display: flex;
  align-items: center; justify-content: center; padding: 40px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-close { position: absolute; top: 20px; right: 24px; border: 0; background: none; font: inherit; cursor: pointer; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g.quarter { grid-column: span 4; }
}
@media (max-width: 820px) {
  :root { --pad: 16px; --gap: 10px; }
  .side { position: sticky; top: 0; width: auto; flex-direction: row; align-items: center; justify-content: space-between;
    padding: 14px var(--pad); border-bottom: 1px solid var(--line); gap: 12px; }
  .logo { font-size: 17px; }
  .logo canvas { width: 52px; margin: -10px 0 -10px -6px; }
  .intro, .contact { display: none; }
  .nav { flex-direction: row; gap: 14px; }
  .nav a.on::before { content: none; }
  .nav a.on { text-decoration: underline; text-underline-offset: 4px; }
  .main { margin-left: 0; padding: var(--pad) var(--pad) 60px; }
  .hero { aspect-ratio: 4 / 5; max-height: none; }
  .ht span { display: none; }
  .reel img { height: 140px; }
  .grid { gap: 28px; }
  .grid-row { flex-wrap: wrap; row-gap: 28px; }
  .grid-row .card { flex-basis: calc(var(--r) * 170px); }
  .work-info { grid-template-columns: 1fr; gap: 24px; }
  .g.half, .g.third, .g.narrow, .g.small, .g.tiny { grid-column: span 12; }
  .g.stack figure { flex: none; }
  .g.stack img { height: auto; }
  .g.row.crop { flex-wrap: wrap; }
  .g.row.crop figure { flex: 1 1 calc(50% - var(--gap)); }
  .g.quarter { grid-column: span 6; }
  .play { padding: 14px; margin-left: calc(-1 * var(--pad)); margin-right: calc(-1 * var(--pad)); }
  .spirits { gap: 10px 16px; }
  .play.plain { margin-left: 0; margin-right: 0; }
  .list a { grid-template-columns: 28px 1fr 44px; }
  .list .c { display: none; }
  .works-split { grid-template-columns: 1fr; }
  .stage { display: none; }
}
@media (max-width: 480px) {
  .grid-row .card { flex: 1 1 100%; } /* one per row on phones */
}
@media (prefers-reduced-motion: reduce) {
  .reel-track { animation: none; }
  .reel { overflow-x: auto; }
  .list a, .list a::after, .list a.cur .n { animation: none; }
}
