/* =========================================================
   Top Thanakorn — Editor
   v3d-r2-quieter visual system
   Antonio (display) + Archivo Black (sub-display) + IBM Plex Mono (labels)
   ========================================================= */

:root {
  --ink:    #0a0a0a;
  --paper:  #ffffff;
  --soft:   #f4f4f4;
  --rule:   2px;
  --gutter: clamp(32px, 5vw, 72px);
  --ease:   cubic-bezier(.2,.7,.2,1);
}

*  { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--paper); color: var(--ink); }
body {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* =========================================================
   Top bar
   ========================================================= */

.topbar {
  border-bottom: var(--rule) solid var(--ink);
  padding: clamp(20px, 2.4vw, 28px) var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 30;
}
.topbar .mark {
  font-family: "Archivo Black", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}
.topbar nav a {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-left: 24px;
  transition: opacity .2s var(--ease);
}
.topbar nav a:hover { opacity: 0.55; }

/* =========================================================
   Hero — quiet eyebrow, loud type
   ========================================================= */

.hero {
  padding: clamp(96px, 14vh, 180px) var(--gutter) clamp(120px, 16vh, 200px);
  border-bottom: var(--rule) solid var(--ink);
}
.hero .role {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: clamp(40px, 6vh, 80px);
}
.hero h1 {
  font-family: "Antonio", sans-serif;
  font-weight: 700;
  font-size: clamp(72px, 17vw, 280px);
  line-height: 0.86;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.hero .bio {
  margin-top: clamp(40px, 6vh, 72px);
  max-width: 56ch;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* =========================================================
   Section header
   ========================================================= */

.section-head {
  padding: clamp(56px, 8vh, 112px) var(--gutter) clamp(40px, 5vh, 72px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(20px, 2vw, 28px);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}

/* =========================================================
   Filter chips — quiet, mono, no pill
   ========================================================= */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  padding: 0 var(--gutter) clamp(40px, 5vh, 64px);
}
.filter-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 0 4px;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  opacity: 0.45;
  transition: opacity .2s var(--ease), border-color .2s var(--ease);
  white-space: nowrap;
  background: none;
}
.filter-pill:hover { opacity: 1; }
.filter-pill.is-active {
  opacity: 1;
  border-bottom-color: var(--ink);
}
.filter-pill .count {
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}

/* =========================================================
   Work — Mosaic mixed-density wall
   6-up baseline grid, every-7th-tile = 2×1.5 featured.
   16:9-ish via fixed row height. Project + director label
   sits inside a hover overlay; featured tiles read inline.
   ========================================================= */

.work {
  padding: 0 var(--gutter) clamp(80px, 10vh, 140px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: clamp(110px, 11vw, 150px);
  gap: clamp(8px, 0.9vw, 12px);
}

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--ink);
  cursor: pointer;
  border: 1px solid var(--ink);
  grid-column: span 2;
  grid-row: span 2;
}
.tile.feat {
  grid-column: span 4;
  grid-row: span 3;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.05);
  transition: filter .42s var(--ease), transform .6s var(--ease);
}
.tile:hover img {
  filter: grayscale(0%) contrast(1.02);
  transform: scale(1.04);
}

.tile .play {
  position: absolute;
  left: 10px; bottom: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper);
  opacity: 0;
  transition: opacity .22s var(--ease);
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}
.tile:hover .play { opacity: 1; }

.tile .feat-tag {
  position: absolute;
  top: 10px; left: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper);
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 8px;
}

.tile .label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px 14px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0) 60%);
  color: var(--paper);
  opacity: 0;
  transition: opacity .22s var(--ease);
  pointer-events: none;
  gap: 4px;
}
.tile:hover .label { opacity: 1; }

.tile .label .name {
  font-family: "Archivo Black", sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.18;
  word-break: break-word;
}
.tile .label .meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.tile .label .meta .director { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .label .meta .year { flex-shrink: 0; opacity: 0.85; }

/* Featured tiles get bigger type and the label always-visible (not just on hover) */
.tile.feat .label {
  opacity: 1;
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0) 55%);
  padding: 18px 20px 18px;
}
.tile.feat .label .name { font-size: 18px; letter-spacing: 0.02em; line-height: 1.1; }
.tile.feat .label .meta { font-size: 10.5px; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.55;
}

/* =========================================================
   Contact
   ========================================================= */

.contact {
  border-top: var(--rule) solid var(--ink);
  padding: clamp(96px, 14vh, 180px) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 5vh, 64px);
}
.contact .label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.contact a.email {
  font-family: "Antonio", sans-serif;
  font-weight: 700;
  font-size: clamp(36px, 8vw, 128px);
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  word-break: break-word;
  align-self: flex-start;
  transition: opacity .2s var(--ease);
}
.contact a.email:hover { opacity: 0.7; }
.contact .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-top: var(--rule) solid var(--ink);
  padding-top: clamp(20px, 3vh, 32px);
}
.contact .row .links { display: flex; gap: 24px; }
.contact .row a { transition: opacity .2s var(--ease); }
.contact .row a:hover { opacity: 0.55; }

/* =========================================================
   Modal — fullscreen video player
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.96);
  z-index: 100;
  display: none;
  overflow-y: auto;
}
.modal.is-open { display: block; }
.modal-inner {
  max-width: 1280px;
  margin: 4vh auto;
  padding: 0 var(--gutter) 80px;
  color: var(--paper);
}
.modal-close {
  position: sticky;
  top: 20px;
  margin-left: auto;
  display: block;
  width: 44px;
  height: 44px;
  border: var(--rule) solid var(--paper);
  color: var(--paper);
  font-size: 20px;
  line-height: 1;
  background: transparent;
  z-index: 2;
  font-family: "IBM Plex Mono", monospace;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.modal-close:hover { background: var(--paper); color: var(--ink); }

.modal-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  margin-top: 12px;
}
.modal-video iframe { width: 100%; height: 100%; border: 0; }
.modal-poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-top: 12px;
}

.modal-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 64px;
  margin-top: 64px;
}
@media (max-width: 760px) {
  .modal-body { grid-template-columns: 1fr; gap: 32px; }
}

.modal-tag {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 20px;
}
.modal-title {
  font-family: "Antonio", sans-serif;
  font-weight: 700;
  font-size: clamp(36px, 5vw, 72px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 24px;
}
.modal-desc {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
  white-space: pre-wrap;
}
.spec dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-top: 16px;
}
.spec dd {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  margin: 4px 0 0;
  color: var(--paper);
}
.spec dt:first-child { margin-top: 0; }

.tags {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.tag::before { content: "·  "; opacity: 0.4; }
.tag:first-child::before { content: ""; }

/* =========================================================
   Animation
   ========================================================= */

.fade-up {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.fade-up.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1280px) {
  .work {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: clamp(110px, 12vw, 140px);
  }
}
@media (max-width: 760px) {
  :root { --gutter: 22px; }
  .work {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: clamp(96px, 26vw, 130px);
  }
  /* On phones, drop featured back to the standard span so layout doesn't break */
  .tile, .tile.feat { grid-column: span 2; grid-row: span 2; }
  .tile.feat .label .name { font-size: 13px; }
  /* Always show label on small screens — no reliable hover */
  .tile .label { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0) 55%); }
  .topbar nav a { margin-left: 14px; }
  .hero h1 { font-size: clamp(56px, 18vw, 120px); }
}
