:root, [data-theme="dark"] {
  --bg: #0c0c0c;
  --ink: #f1efea;
  --ink-2: #a9a6a0;
  --ink-3: #6a6863;
  --line: #262523;
  --card: #1a1a1a;
}
[data-theme="light"] {
  --bg: #fdfcfa;
  --ink: #0b0b0b;
  --ink-2: #5f5f5f;
  --ink-3: #a3a3a3;
  --line: #e7e5e1;
  --card: #e9e7e3;
}
:root {
  --f: "Archivo", system-ui, -apple-system, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --pad: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--f); font-size: 13px; line-height: 1.35; letter-spacing: -.005em;
  background: var(--bg); color: var(--ink);
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color .6s var(--ease), color .6s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; }
.u { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.label { color: var(--ink-3); margin-bottom: 8px; }
.tri { display: inline-block; width: 0; height: 0; border-left: 7px solid currentColor; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }

/* ---------- loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg);
  font-variant-numeric: tabular-nums; transition: opacity .8s var(--ease), visibility .8s;
}
.loader.is-done { opacity: 0; visibility: hidden; }

/* ---------- corners + nav: Archivo 12px, difference blend like the reference (no plates, no glow) ---------- */
.corner, .nav { color: #fff; mix-blend-mode: difference; }
.corner { position: fixed; z-index: 70; top: var(--pad); font-size: calc(12px * var(--s, 1)); font-weight: 400; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.corner--tl { left: var(--pad); }
.corner--tr { right: var(--pad); }
.corner:hover { text-decoration: underline; text-underline-offset: 3px; }
body.is-playing .corner { opacity: 0; pointer-events: none; }
body.is-intro .corner { opacity: 0; }

.nav {
  position: fixed; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: baseline; gap: 10px; white-space: nowrap;
  font-size: calc(12px * var(--s, 1)); font-weight: 400; letter-spacing: .01em; line-height: 1; gap: .85em;
  transition: top .9s var(--ease);
}
.nav > * { position: relative; font-weight: 400; transition: opacity .4s var(--ease); }
.nav .is-dim { opacity: .55; }
.nav a::after, .nav button::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease);
}
.nav a:hover::after, .nav button:hover::after, .nav .is-on::after { transform: scaleX(1); transform-origin: left; }
.nav .nav__title { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.nav .nav__time { font-variant-numeric: tabular-nums; }
.nav__intro { display: inline-block; animation: wordIn .5s var(--ease) both; }
@keyframes wordIn { from { opacity: 0; transform: translateY(70%); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
body.is-ready .nav > * { animation: navIn .6s var(--ease) both; }
body.is-ready .nav > *:nth-child(2) { animation-delay: .06s; } body.is-ready .nav > *:nth-child(3) { animation-delay: .12s; }
body.is-ready .nav > *:nth-child(4) { animation-delay: .18s; } body.is-ready .nav > *:nth-child(5) { animation-delay: .24s; }
@keyframes navIn { from { opacity: 0; } to { opacity: 1; } }
body.is-ready.is-settled .nav > * { animation: none; }
body[data-view="home"] .nav { top: 50%; }
body[data-view="about"] .nav, body[data-view="contact"] .nav { top: 34px; }
body.is-playing .nav { top: 50% !important; }

/* ---------- roles + brands: small and quiet, along the bottom edge ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.roles {
  position: fixed; z-index: 40; left: var(--pad); bottom: var(--pad);
  font-size: calc(12px * var(--s, 1)); color: var(--ink-2); letter-spacing: .01em;
  transition: opacity .8s var(--ease);
}
.roles__track { display: block; animation: none; }
.roles__set { display: flex; align-items: baseline; gap: .55em; }
.roles__set[aria-hidden] { display: none; }
.roles__set span, .roles__set em { font-family: var(--f); font-style: normal; font-size: 1em; line-height: 1; color: var(--ink-2); }
.roles__set i { font-style: normal; font-size: .7em; color: var(--ink-3); }
.roles__set i:last-child { display: none; }
body.is-intro .roles, body[data-view="about"] .roles, body[data-view="contact"] .roles, body[data-view="works"] .roles, body.is-playing .roles { opacity: 0; pointer-events: none; }
.brands {
  position: fixed; z-index: 40; right: var(--pad); bottom: calc(var(--pad) - 6px); width: min(46vw, 640px); height: 26px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  transition: opacity .6s var(--ease);
}
.brands__track { display: flex; flex-direction: row; width: max-content; height: 100%; animation: brandsSide 46s linear infinite; }
.brands:hover .brands__track { animation-play-state: paused; }
.brands__set { display: flex; flex-direction: row; align-items: center; gap: 7px; padding-right: 26px; height: 100%; }
.b-logo { display: block; object-fit: contain; object-position: center; margin: 0 0 0 26px; opacity: .55; max-height: 15px !important; width: auto !important; }
[data-theme="dark"] .b-logo { filter: invert(1); }
.b-name { font-size: calc(11px * var(--s, 1)); color: var(--ink-3); white-space: nowrap; }
.b-word { margin-left: 26px; font-size: calc(11px * var(--s, 1)); font-weight: 600; letter-spacing: 0; line-height: 1; opacity: .55; white-space: nowrap; }
.b-word br { display: none; }
.b-word--wide { letter-spacing: .22em; font-size: calc(10px * var(--s, 1)); }
@keyframes brandsSide { from { transform: translateX(-50%); } to { transform: translateX(0); } }
body[data-view="about"] .brands, body[data-view="contact"] .brands, body[data-view="works"] .brands, body.is-playing .brands, body.is-intro .brands { opacity: 0; pointer-events: none; }

/* ---------- Works side panel ---------- */
/* Works side panel — placed by script.js (placeSide): steps up from the bottom, one step per project */
.side {
  position: absolute; z-index: 4; left: 0; top: 0; width: 40vw; height: 22.5vw; background: #000; overflow: hidden;
  opacity: 0; transform: translateY(34px) scale(.97); pointer-events: none;
  transition: opacity .32s var(--ease), transform .5s var(--ease);
}
.side.is-on { opacity: 1; transform: none; pointer-events: auto; transition: opacity .8s var(--ease), transform 1.1s var(--ease); }
.side__media, .side__media video, .side__media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.side__media video { object-fit: cover; background: #000; cursor: pointer; }
.detail.is-above { transform: translateY(-100%); }
/* seek bar: click or drag anywhere on it */
.scrub {
  position: absolute; z-index: 3; left: var(--pad); right: var(--pad); bottom: 6px; height: 26px;
  display: flex; align-items: center; gap: 14px; cursor: pointer; touch-action: none; color: #fff;
  opacity: 0; transition: opacity .4s var(--ease);
}
.player.is-on .scrub, .side.is-on .scrub { opacity: 1; }
.player.is-on.is-idle .scrub { opacity: 0; }                 /* hides while the mouse rests, like a normal player */
@media (max-width: 760px) { .player .scrub { bottom: 96px; } .player.is-on.is-idle .scrub { opacity: 1; } }
.scrub__bar { position: relative; flex: 1; height: 2px; background: rgba(255, 255, 255, .22); transition: height .2s var(--ease); }
.scrub:hover .scrub__bar, .scrub.is-drag .scrub__bar { height: 6px; }
.scrub__bar i { position: absolute; inset: 0; background: #fff; transform-origin: 0 50%; transform: scaleX(0); }
.scrub__bar b { position: absolute; top: 50%; left: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fff;
  transform: scale(0); transition: transform .2s var(--ease); }
.scrub:hover .scrub__bar b, .scrub.is-drag .scrub__bar b { transform: scale(1); }
.scrub__t { font-size: 11px; color: rgba(255, 255, 255, .8); font-variant-numeric: tabular-nums; min-width: 76px; text-align: right; }
.scrub--side { left: 0; right: 0; bottom: 0; height: 30px; padding: 0 12px; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); }
.scrub--side .scrub__t { min-width: 70px; }
body.has-side .detail .detail__meta { max-height: 80px; opacity: 1; transform: none; }
/* ---------- views + transitions ---------- */
.view {
  position: fixed; inset: 0; z-index: 1; opacity: 0; visibility: hidden;
  transform: scale(1.025);
  transition: opacity .7s var(--ease), transform .9s var(--ease), visibility .7s;
}
.view.is-on { opacity: 1; visibility: visible; transform: none; }

/* ---------- HOME: fan ---------- */
.arc { position: absolute; inset: 0; }
body.is-intro:not(.is-cards) .arc { opacity: 0; }
.arc { transition: opacity .6s var(--ease); }
.arc__card {
  position: absolute; left: 50%; top: 50%; background: var(--card);
  overflow: hidden; cursor: pointer; transform-origin: 50% 50%; will-change: transform;
}
.arc__card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.arc__color { opacity: var(--c, 0); }
.arc__card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s; }
.arc__card.is-live video { opacity: 1; }

/* ---------- WORKS: artifacts column ---------- */
.wheel { position: absolute; inset: 0; z-index: 2; }
.obj { position: absolute; left: 0; top: 0; cursor: pointer; will-change: transform, opacity; transform-origin: 50% 50%; }
.obj img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.obj__b1, .obj__b2 { left: -12% !important; top: -12% !important; width: 124% !important; height: 124% !important; object-fit: fill !important; }   /* blurred copies carry padding */
.obj__s { opacity: var(--s0, 1); transition: opacity .5s var(--ease); }
.obj__b1 { opacity: var(--b1, 0); }
.obj__b2 { opacity: var(--b2, 0); }
.obj__vid {
  position: absolute; left: 50%; top: 50%; width: 118%; max-width: 46vw; aspect-ratio: 16 / 9; transform: translate(-50%, -50%) scale(.92);
  opacity: 0; pointer-events: none; transition: opacity .6s var(--ease), transform .8s var(--ease); background: #000;
}
.obj__vid.is-v { width: auto; height: 118%; aspect-ratio: 9 / 16; }
.obj__vid video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.obj.is-hover .obj__vid { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.obj.is-hover .obj__s { opacity: 0; }
.obj--logo { cursor: default; }

.bgobj { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.bgobj img { position: absolute; left: 0; top: 0; width: 520px; height: auto; transform-origin: 0 0; will-change: transform; }

.detail {
  position: absolute; left: 62%; top: 50%; width: min(330px, 24vw); z-index: 3;
  transition: left .9s var(--ease), top .9s var(--ease);
}
.detail > * { transition: opacity .6s var(--ease), transform .7s var(--ease); }
.detail.is-swap > * { opacity: 0; transform: translateY(18px); }
.detail > *:nth-child(2) { transition-delay: .06s; } .detail > *:nth-child(3) { transition-delay: .12s; }
.detail__num { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.detail__desc { margin: 3px 0 10px; }
.detail__meta { color: var(--ink-3); white-space: pre-line; }
.detail__meta { max-height: 0; overflow: hidden; opacity: 0; transform: translateY(12px); }
.detail.is-open .detail__meta { max-height: 80px; opacity: 1; transform: none; }
.detail__hint { margin-top: 10px; color: var(--ink-3); opacity: 0; transform: translateY(10px); }
.detail.is-open .detail__hint { opacity: 1; transform: none; }

/* ---------- ABOUT ---------- */
.about {
  position: absolute; left: var(--pad); right: var(--pad); top: 120px; bottom: 40px; overflow: auto;
  display: grid; grid-template-columns: 200px repeat(3, minmax(0, 1fr)); gap: 0 40px; scrollbar-width: none;
}
.about::-webkit-scrollbar { display: none; }
.about__photo img { width: 100%; aspect-ratio: 100 / 142; object-fit: cover; filter: grayscale(1); }
.about__col p + p { margin-top: 10px; }
.about__col .label { margin-top: 26px; }
.about__col .label:first-child { margin-top: 0; }
.about__lead { font-family: var(--serif); font-size: 26px; line-height: 1.1; letter-spacing: -.01em; margin-bottom: 18px; }
.about { right: calc(var(--pad) + min(300px, 21vw) + 44px); }
/* side rail: showreel tile + links */
.rail {
  position: fixed; z-index: 2; right: var(--pad); top: 120px; width: min(300px, 21vw);
  display: flex; flex-direction: column; gap: 18px;
}
.rail__reel { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; padding: 0; border: 0; cursor: pointer; }
.rail__reel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform 1.2s var(--ease); }
.rail__reel:hover video { transform: scale(1.07); }
.rail__play {
  position: absolute; left: 10px; bottom: 8px; color: #fff; font-size: 12px; mix-blend-mode: difference;
  display: flex; gap: 8px; align-items: baseline;
}
.rail__play i, .rail__links i { font-style: normal; font-size: .72em; transition: transform .5s var(--ease); }
.rail__links button i { font-size: .45em; align-self: center; }
.rail__links { list-style: none; border-top: 1px solid var(--line); }
.rail__links li { border-bottom: 1px solid var(--line); }
.rail__links a, .rail__links button {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: baseline; width: 100%; padding: 9px 0 7px;
  font-family: var(--serif); font-size: clamp(22px, 1.75vw, 30px); line-height: 1; letter-spacing: -.01em; text-align: left; color: var(--ink);
  transition: padding .5s var(--ease), color .3s;
}
.rail__links em { font-family: var(--f); font-style: normal; font-size: 11px; color: var(--ink-3); align-self: center; font-variant-numeric: tabular-nums; }
.rail__links a:hover, .rail__links button:hover { padding-left: 8px; }
.rail__links a:hover i, .rail__links button:hover i, .rail__reel:hover .rail__play i { transform: translate(3px, -3px); }
.rail__note { color: var(--ink-3); font-size: 12px; }
.list { list-style: none; }
.list li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.list li:last-child { border-bottom: 1px solid var(--line); }
.list b { font-weight: 600; }
.list span { grid-column: 1; color: var(--ink-2); }
.list em { grid-column: 2; grid-row: 1 / span 2; font-style: normal; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- CONTACT ---------- */
.contact { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); text-align: center; width: 92vw; }
.contact__mail {
  display: inline-block; font-family: var(--serif); font-size: clamp(40px, 7.4vw, 120px); line-height: 1; letter-spacing: -.02em;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .5s var(--ease);
}
.contact__mail:hover { background-size: 100% 2px; }
.contact__via { margin: 16px 0 34px; display: flex; justify-content: center; gap: 18px; color: var(--ink-3); font-size: 12px; }
.contact__via a:hover, .contact__via button:hover { color: var(--ink); }
.contact__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 26px; font-weight: 600; }
.contact__links a:hover, .contact__links button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- veil + player ---------- */
.veil { position: fixed; inset: 0; z-index: 55; background: #000; opacity: 0; pointer-events: none; transition: opacity .7s var(--ease); }
.veil.is-on { opacity: 1; }
.player { position: fixed; inset: 0; z-index: 60; background: #000; opacity: 0; visibility: hidden; transition: opacity .8s var(--ease), visibility .8s; }
.player.is-on { opacity: 1; visibility: visible; }
.player__media, .player__media video, .player__media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player__media video { object-fit: cover; }
.player__media video.is-contain { object-fit: contain; }

/* ---------- toast & cursor ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 95; transform: translate(-50%, 20px); opacity: 0;
  font-size: 12px; font-weight: 600; transition: opacity .3s, transform .3s var(--ease); pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.cursor {
  position: fixed; left: 0; top: 0; z-index: 96; pointer-events: none;
  font-size: 12px; font-weight: 500; letter-spacing: .01em; color: #fff; mix-blend-mode: difference;
  opacity: 0; transform: translate(-100px, -100px); transition: opacity .2s;
}.cursor.is-on { opacity: 1; }
@media (pointer: coarse) { .cursor { display: none; } }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  :root { --pad: 16px; }
  .nav { gap: 11px; font-size: 12px; }
  .nav .nav__name { display: none; }
  .nav .nav__title { max-width: 110px; }

  .roles { top: auto; bottom: 46px; left: var(--pad); right: var(--pad); width: auto; height: auto;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
  .roles { -webkit-mask-image: none; mask-image: none; text-align: center; }
  .roles__set { justify-content: center; }
  .roles__track { animation: none; }
  .roles__set { flex-direction: row; align-items: center; gap: 14px; padding: 0 14px 0 0; }
  .roles__set span, .roles__set em { font-size: 12px; white-space: nowrap; }
  @keyframes rolesSide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
  body.is-playing .nav { top: auto !important; bottom: 18px; transform: translateX(-50%); flex-wrap: wrap; justify-content: center; width: 92vw; row-gap: 6px; }
  body[data-view="works"] .nav { top: 56px; }
  .detail { left: var(--pad) !important; right: var(--pad); top: auto !important; bottom: 28px; width: auto; }
  .bgobj img { width: 300px; }
  .about { top: 80px; bottom: 20px; right: var(--pad); grid-template-columns: 1fr; gap: 26px; }
  .about__photo { width: 55%; }
  .rail { position: static; width: 100%; padding-bottom: 60px; }
  .player__media video { object-fit: contain; }
  /* phones: brands become a thin row at the bottom of the home screen */
  .brands { top: auto; bottom: 14px; left: 0; right: 0; width: auto; height: 22px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
  .brands__track { flex-direction: row; width: max-content; animation: brandsSide 30s linear infinite; }
  .brands__set { flex-direction: row; align-items: center; gap: 8px; padding: 0 14px 0 0; }
  .b-logo, .b-word { margin-top: 0; margin-left: 14px; }
  .b-logo { object-position: center; }
  body[data-view="works"] .brands { opacity: 0; pointer-events: none; }
  @keyframes brandsSide { from { transform: translateX(-50%); } to { transform: translateX(0); } }
}

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