/* ── VARIABLES ── */
:root {
  --bg: #f6f4f1;
  --bg2: #edeae6;
  --fg: #111111;
  --fg2: #888888;
  --fg3: #bbbbbb;
  --line: rgba(17, 17, 17, .09);
  --line2: rgba(17, 17, 17, .05);
  --overlay: rgba(246, 244, 241, .97);
  --card-bg: #e8e5e1;
  --lb-bg: rgba(10, 10, 9, .97);
}

[data-theme="dark"] {
  --bg: #0d0d0c;
  --bg2: #161614;
  --fg: #f0ede8;
  --fg2: #666666;
  --fg3: #383530;
  --line: rgba(240, 237, 232, .07);
  --line2: rgba(240, 237, 232, .04);
  --overlay: rgba(13, 13, 12, .97);
  --card-bg: #1a1917;
  --lb-bg: rgba(8, 8, 7, .98);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 300;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background .5s, color .5s;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#curtain, header, section, footer {
  flex-shrink: 0;
}

#work {
  flex: 1;
}
a { text-decoration: none; color: inherit; }

/* ── CURTAIN ── */
#curtain { display: none; }

/* ── HEADER ── */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  height: 96px; padding: 0 52px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--overlay); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background .5s, border-color .3s;
}
.logo { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-decoration: none; }
.logo-img { height: 36px; width: auto; display: block; object-fit: contain; object-position: left; }
.logo-img-placeholder { height: 36px; width: 36px; background: var(--fg); border-radius: 4px; opacity: .15; display: block; }
.logo-name { font-size: 9px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--fg2); line-height: 1; padding-left: 1px; }
nav { display: flex; margin-right: 16px; }
nav a { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--fg2); padding: 8px 16px; transition: color .25s; }
nav a:hover { color: var(--fg); }
.dm-toggle {
  width: 44px; height: 24px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px;
  position: relative; transition: background .4s, border-color .3s;
  flex-shrink: 0; cursor: pointer;
}
.dm-knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  background: var(--fg); border-radius: 50%;
  transition: transform .4s cubic-bezier(.16, 1, .3, 1), background .5s;
}
[data-theme="dark"] .dm-knob { transform: translateX(20px); }

/* ── TOOLBAR ── */
.toolbar {
  position: sticky; top: 96px; z-index: 400; height: 52px; padding: 0 44px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--overlay); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background .5s, border-color .3s;
}
.filter-inner { display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; }
.filter-inner::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0; padding: 0 16px; height: 52px;
  font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 300;
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--fg3); background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: color .25s, border-color .25s; white-space: nowrap;
}
.filter-btn:hover { color: var(--fg); }
.filter-btn.active { color: var(--fg); border-bottom-color: var(--fg); }
.toolbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.view-btn {
  width: 30px; height: 30px; border-radius: 5px; border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .25s; color: var(--fg3); background: none;
}
.view-btn:hover { color: var(--fg); }
.view-btn.active { color: var(--fg); border-color: var(--line); background: var(--bg2); }
.view-btn svg { width: 14px; height: 14px; }

/* ── GRID ── */
.grid-view { display: none; }
.grid-view.active { display: block; }
.grid {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 44px 0 44px;
  box-sizing: border-box;
  width: 100%;
}
.grid-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-card { margin-bottom: 0; }
.project-card img { width: 100%; height: auto; display: block; }
/* Flat 16:9 grid for filtered views */
.grid.grid-flat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 6px;
}
.grid.grid-flat .project-card {
  aspect-ratio: 16/9;
}
.grid.grid-flat .project-card img {
  width: 100%; height: 100%; object-fit: cover;
}

/* ── CARD ── */
.project-card { position: relative; overflow: hidden; background: var(--card-bg); cursor: pointer; transition: background .5s; width: 100%; }
.project-card.hidden { display: none; }
.project-card.has-canvas { aspect-ratio: 16/9; }
.project-card canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  filter: grayscale(1); object-fit: cover;
  transition: transform .9s cubic-bezier(.16, 1, .3, 1);
}
.project-card img,
.card-thumb-video {
  width: 100%; height: auto; display: block;
  transition: transform .7s cubic-bezier(.16, 1, .3, 1);
}
.project-card:hover canvas,
.project-card:hover img,
.project-card:hover .card-thumb-video { transform: scale(1.04); }
.card-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; z-index: 2;
  transition: opacity .4s ease;
}
.project-card:hover .card-video { opacity: 1; }
/* Vimeo background player thumbnail */
.card-vimeo-thumb {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
.card-vimeo-thumb iframe {
  position: absolute; top: 50%; left: 50%;
  width: 177.78%; height: 100%;
  transform: translate(-50%, -50%);
  border: 0;
}
/* HTML5 video hover preview */
.card-embed-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 2;
  opacity: 0; transition: opacity .4s ease;
}
.project-card:hover .card-embed-video { opacity: 1; }
.card-video-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 12px 16px;
  pointer-events: none; z-index: 3;
  opacity: 0; transition: opacity .3s ease;
  background: linear-gradient(to top, rgba(8, 8, 7, .6), transparent);
}
.card-video-overlay strong {
  display: block; font-size: 13px; font-weight: 400; color: #ffffff;
  line-height: 1.2; margin-bottom: 4px;
}
.card-video-overlay div {
  display: inline-block; font-family: 'DM Mono', monospace; font-size: 8px;
  letter-spacing: .12em; text-transform: uppercase;
  color: rgba(240, 237, 232, .5); line-height: 1.2;
  border: 1px solid rgba(240, 237, 232, .2); padding: 4px 8px;
}
.project-card:hover .card-video-overlay { opacity: 1; }
/* YouTube / Vimeo iframe hover preview */
.card-embed {
  position: absolute; inset: 0; overflow: hidden; z-index: 2;
  opacity: 0; transition: opacity .4s ease;
}
.project-card:hover .card-embed { opacity: 1; }
.card-embed iframe {
  position: absolute;
  /* scale up to cover card for ~16:9 video */
  width: 177.78%; height: 100%;
  min-height: 177.78%;
  min-width: 100%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: none; pointer-events: none;
}
.card-info {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px; text-align: center;
  background: rgba(246, 244, 241, 0.88);
  opacity: 0;
  transition: opacity .35s ease;
  z-index: 3;
}
[data-theme="dark"] .card-info { background: rgba(13, 13, 12, 0.82); }
.project-card:hover .card-info { opacity: 1; }
.card-cats { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.card-cat { font-family: 'DM Mono', monospace; font-size: 8px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg2); border: 1px solid var(--line); padding: 2px 6px; }
.card-title { font-size: clamp(12px, 1.2vw, 16px); font-weight: 400; line-height: 1.3; color: var(--fg); letter-spacing: .01em; }
.card-meta { margin-top: 6px; font-family: 'DM Mono', monospace; font-size: 9px; color: var(--fg3); letter-spacing: .08em; }

/* ── REEL ── */
.reel-view { display: none; }
.reel-view.active { display: block; }
.reel-section { padding: 40px 0 56px; border-bottom: 1px solid var(--line); overflow: hidden; }
.reel-label { padding: 0 44px 18px; display: flex; align-items: baseline; gap: 12px; }
.reel-label-text { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--fg2); }
.reel-label-count { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--fg3); }
.reel-hint { font-size: 10px; letter-spacing: .12em; color: var(--fg3); margin-left: auto; }
.reel-hint::after { content: ' →'; }
.reel-track {
  display: flex; gap: 1px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; padding: 0 44px;
}
.reel-track::-webkit-scrollbar { display: none; }
.reel-card { flex-shrink: 0; width: clamp(220px, 26vw, 360px); scroll-snap-align: start; background: var(--card-bg); cursor: pointer; transition: background .5s; }
.reel-card .thumb { aspect-ratio: 16/10; overflow: hidden; }
.reel-card canvas,
.reel-card img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .85s cubic-bezier(.16, 1, .3, 1); }
.reel-card canvas { filter: grayscale(1); }
.reel-card:hover canvas,
.reel-card:hover img { transform: scale(1.07); }
.reel-info { padding: 11px 13px 13px; border-top: 1px solid var(--line); }
.reel-info-title { font-size: 12px; font-weight: 400; line-height: 1.3; color: var(--fg); margin-bottom: 3px; }
.reel-info-meta { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--fg3); }

/* ── LIST ── */
.list-view { display: none; }
.list-view.active { display: block; }
.list-header {
  display: grid; grid-template-columns: 36px 1fr 200px 160px 56px;
  padding: 0 44px; height: 38px; align-items: center;
  border-bottom: 1px solid var(--line);
  font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--fg3);
}
.list-row {
  display: grid; grid-template-columns: 36px 1fr 200px 160px 56px;
  padding: 0 44px; height: 54px; align-items: center;
  border-bottom: 1px solid var(--line2);
  cursor: pointer; position: relative; overflow: hidden; transition: background .2s;
}
.list-row::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: var(--fg); transform: scaleX(0); transform-origin: left;
  transition: transform .4s cubic-bezier(.16, 1, .3, 1);
}
.list-row:hover { background: var(--bg2); }
.list-row:hover::after { transform: scaleX(1); }
.list-row.hidden { display: none; }
.lr-num   { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--fg3); }
.lr-title { font-size: 13px; font-weight: 400; color: var(--fg); }
.lr-dir   { font-size: 11px; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; }
.lr-cat   { display: flex; gap: 4px; flex-wrap: wrap; }
.lr-cat-badge { font-family: 'DM Mono', monospace; font-size: 8px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg3); border: 1px solid var(--line); padding: 2px 5px; }
.lr-year  { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--fg3); text-align: right; }

/* ── LIGHTBOX ── */
#lightbox {
  position: fixed; inset: 0; z-index: 700;
  display: flex; flex-direction: column;
  background: var(--lb-bg);
  opacity: 0; pointer-events: none;
  transition: opacity .4s cubic-bezier(.16, 1, .3, 1);
}
#lightbox.open { opacity: 1; pointer-events: all; }
.lb-header {
  flex-shrink: 0; height: auto; min-height: 80px; padding: 16px 44px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(240, 237, 232, .07);
}
.lb-title { font-size: 14px; font-weight: 400; color: #f0ede8; line-height: 1.2; }
.lb-meta  { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .12em; color: rgba(240, 237, 232, .3); margin-top: 6px; line-height: 1.5; }
.lb-header-right { display: flex; align-items: center; gap: 14px; }
.lb-cats  { display: flex; gap: 6px; }
.lb-cat   { font-family: 'DM Mono', monospace; font-size: 8px; letter-spacing: .16em; text-transform: uppercase; color: rgba(240, 237, 232, .35); border: 1px solid rgba(240, 237, 232, .12); padding: 3px 7px; }
.lb-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(240, 237, 232, .18); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(240, 237, 232, .5); font-size: 16px;
  transition: border-color .3s, color .3s;
}
.lb-close:hover { border-color: rgba(240, 237, 232, .55); color: #f0ede8; }
.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(240, 237, 232, .18); background: rgba(8, 8, 7, .55);
  backdrop-filter: blur(6px); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(240, 237, 232, .6); font-size: 16px; transition: all .25s;
}
.lb-arrow:hover { border-color: rgba(240, 237, 232, .5); color: #f0ede8; }
.lb-arrow.prev { left: 16px; }
.lb-arrow.next { right: 16px; }
.lb-body { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(240, 237, 232, .1) transparent; }
.lb-video-wrap { width: 100%; background: #000; }
.lb-video-wrap iframe { display: block; width: 100%; aspect-ratio: 16/9; border: none; }
.lb-stills-header { padding: 24px 44px 16px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(240, 237, 232, .06); }
.lb-stills-header.first { border-top: none; }
.lb-stills-label { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: rgba(240, 237, 232, .28); }
.lb-stills-count { font-family: 'DM Mono', monospace; font-size: 9px; color: rgba(240, 237, 232, .18); }
.lb-stills-grid { display: grid; gap: 1px; background: rgba(240, 237, 232, .04); }
.lb-stills-grid.g2 { grid-template-columns: repeat(2, 1fr); }
.lb-stills-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.lb-still { overflow: hidden; background: #0d0d0c; cursor: zoom-in; }
.lb-still canvas { width: 100%; height: 100%; display: block; filter: grayscale(1); object-fit: cover; }
.lb-still img { width: 100%; height: auto; display: block; transition: transform .7s cubic-bezier(.16, 1, .3, 1); }
.lb-still:hover img { transform: scale(1.04); }
.lb-footer { flex-shrink: 0; height: 48px; padding: 0 44px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(240, 237, 232, .05); }
.lb-counter { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .14em; color: rgba(240, 237, 232, .25); }
.lb-dots { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; max-width: 340px; justify-content: flex-end; }
.lb-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(240, 237, 232, .2); cursor: pointer; transition: background .25s, width .3s; }
.lb-dot.on { background: #f0ede8; width: 14px; border-radius: 2px; }

/* ── CONTACT ── */
#contact { padding: 96px 44px 80px; border-top: 1px solid var(--line); }
.contact-top { margin-bottom: 64px; max-width: 560px; }
.contact-h { font-size: clamp(48px, 6.5vw, 100px); font-weight: 300; line-height: .88; letter-spacing: -.03em; }
.contact-h strong { font-weight: 600; }
.contact-desc p { font-size: 13px; color: var(--fg2); line-height: 1.9; }
.contact-rep { margin-top: 24px; }
.rep-item { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line2); }
.rep-flag { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.rep-info { font-size: 11px; line-height: 1.8; color: var(--fg2); }
.rep-info strong { display: block; font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--fg3); margin-bottom: 2px; }
.rep-info a { color: var(--fg); transition: opacity .3s; }
.rep-info a:hover { opacity: .5; }
.contact-links { display: flex; flex-direction: column; }
.clink {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0; border-bottom: 1px solid var(--line2);
  color: var(--fg3); transition: color .3s;
  position: relative; overflow: hidden;
}
.clink::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: var(--fg); transform: scaleX(0); transform-origin: left;
  transition: transform .45s cubic-bezier(.16, 1, .3, 1);
}
.clink:first-child { border-top: 1px solid var(--line2); }
.clink:hover { color: var(--fg); }
.clink:hover::before { transform: scaleX(1); }
.clink-label { font-size: clamp(18px, 2vw, 28px); font-weight: 300; transition: color .3s; }
.clink:hover .clink-label { color: var(--fg); }
.clink-type  { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--fg3); }
.clink-arrow { font-size: 18px; transition: transform .3s; }
.clink:hover .clink-arrow { transform: translate(4px, -4px); }

/* ── FOOTER ── */
footer {
  padding: 20px 44px;
  border-top: 1px solid var(--line2);
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'DM Mono', monospace; font-size: 9px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--fg3);
}

/* ── ANIMATIONS ── */
@keyframes up { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: none } }
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .8s cubic-bezier(.16, 1, .3, 1), transform .8s cubic-bezier(.16, 1, .3, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ── RESPONSIVE ── */
/* Tablet / narrow desktop */
@media (max-width: 1024px) {
  header { height: 72px; padding: 0 24px; }
  .logo-img { height: 28px; }
  .logo-name { font-size: 8px; }
  nav a { font-size: 10px; padding: 6px 10px; }
  .toolbar { top: 72px; height: 44px; padding-left: 24px; padding-right: 24px; }
  .filter-btn { font-size: 10px; padding: 0 12px; height: 44px; }
  .grid { padding: 6px 24px 0 24px; }
  #work { padding-top: 72px !important; }
}

/* Mobile */
@media (max-width: 600px) {
  header { height: 56px; padding: 0 16px; }
  .logo-img { height: 22px; }
  .logo-name { font-size: 7px; letter-spacing: .12em; }
  nav a { font-size: 9px; padding: 5px 6px; letter-spacing: .1em; }
  .dm-toggle { width: 36px; height: 20px; }
  .dm-knob { width: 14px; height: 14px; top: 2px; left: 2px; }
  [data-theme="dark"] .dm-knob { transform: translateX(16px); }
  header, #contact, footer { padding-left: 16px; padding-right: 16px; }
  .toolbar { top: 56px; height: 40px; padding-left: 16px; padding-right: 16px; }
  .filter-btn { font-size: 9px; padding: 0 8px; height: 40px; letter-spacing: .1em; }
  .reel-label { padding-left: 16px; padding-right: 16px; }
  .reel-track { padding: 0 16px; }
  .grid { flex-direction: column; padding: 6px 16px 0 16px; }
  .grid-col { display: contents; }
  .project-card { order: var(--card-order, 0); }
  .grid.grid-flat { display: grid; grid-template-columns: repeat(2, 1fr); }
  .grid.grid-flat .project-card { order: 0; }
  .list-header, .list-row { padding: 0 16px; grid-template-columns: 28px 1fr 120px 52px; }
  .list-header span:nth-child(3), .lr-dir { display: none; }
  .contact-top { grid-template-columns: 1fr; gap: 32px; }
  .lb-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .lb-header-right { gap: 10px; }
  .lb-title { font-size: 13px; }
  .lb-meta { font-size: 8px; }
  .lb-stills-grid.g3 { grid-template-columns: repeat(2, 1fr); }
  .lb-stills-header { padding: 16px 16px 12px; }
  .lb-arrow { width: 36px; height: 36px; }
  .lb-arrow.prev { left: 8px; }
  .lb-arrow.next { right: 8px; }
  .lb-footer { padding: 0 16px; }
  #work { padding-top: 56px !important; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
