:root {
  --bg: #0b0c0e;
  --fg: #ebe7df;
  --dim: rgba(235, 231, 223, .5);
  --faint: rgba(235, 231, 223, .16);
  --accent: #ff5a1f;
  --pad: clamp(16px, 2.4vw, 36px);
  --font: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--bg); }
body.has-cursor, body.has-cursor * { cursor: none !important; }

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; font-size: 12px; }

/* ---------- loader ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity .9s ease, visibility .9s;
}
#loader.done { opacity: 0; visibility: hidden; }
.ld { display: flex; flex-direction: column; gap: 14px; letter-spacing: .06em; }
.ld-top, .ld-bottom { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); }
.ld-top span:first-child { color: var(--fg); font-weight: 500; letter-spacing: .18em; }
.ld-bar { font-size: 13px; white-space: pre; }
#loader.fail .ld-bottom span:first-child { color: var(--accent); }

/* ---------- ui layer ---------- */
#ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  font-size: 11px;
  letter-spacing: .06em;
  touch-action: none;
}
#ui a, #ui button { pointer-events: auto; }
#ui .panel a { pointer-events: none; }
#ui .panel.is-active a { pointer-events: auto; }

.intro-el { opacity: 0; transition: opacity 1.4s ease; }
body.is-ready .intro-el { opacity: 1; }

[data-reveal] { white-space: pre-wrap; }

.top {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  right: var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; letter-spacing: .18em; }
.logo i { width: 8px; height: 8px; background: var(--accent); animation: blink 2.6s steps(1) infinite; }
@keyframes blink { 0%, 72% { opacity: 1; } 73%, 100% { opacity: .15; } }

.nav { display: flex; gap: clamp(14px, 2.6vw, 38px); }
.nav a { position: relative; padding: 6px 0; color: var(--dim); transition: color .3s; }
.nav a:hover, .nav a.is-active { color: var(--fg); }
.nav a::before {
  content: '';
  position: absolute;
  left: -11px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  background: var(--accent);
  transform: scale(0);
  transition: transform .35s var(--ease);
}
.nav a.is-active::before { transform: scale(1); }

.panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
}

.label { color: var(--accent); margin-bottom: 24px; }

/* hero */
.hero-copy {
  position: absolute;
  left: var(--pad);
  bottom: calc(var(--pad) + 64px);
  width: min(660px, calc(100% - 2 * var(--pad)));
}
.kicker { color: var(--dim); margin-bottom: 20px; }
.title { margin: 0; font-weight: 500; font-size: clamp(32px, 5.2vw, 84px); line-height: 1; letter-spacing: -.03em; }
.title span { display: block; }
.desc { margin: 22px 0 0; max-width: 400px; font-size: 12px; line-height: 1.7; letter-spacing: .02em; color: var(--dim); }
.status {
  position: absolute;
  right: calc(var(--pad) + 64px);
  top: calc(var(--pad) + 64px);
  display: grid;
  gap: 6px;
  text-align: right;
}
.st-row { display: flex; justify-content: flex-end; gap: 14px; }
.st-row .k { color: var(--dim); }
.st-row .v { display: inline-block; min-width: 10ch; font-weight: 500; }

/* manifesto */
.p-manifesto .wrap { position: absolute; left: var(--pad); right: calc(var(--pad) + 64px); top: clamp(96px, 18vh, 210px); }
.lines { font-size: clamp(22px, 3.7vw, 60px); font-weight: 500; line-height: 1.08; letter-spacing: -.02em; }
.lines .line { display: block; }
.lines .line:nth-child(2n) { padding-left: clamp(24px, 9vw, 170px); }
.note { margin: 30px 0 0; max-width: 380px; font-size: 12px; line-height: 1.7; letter-spacing: .02em; color: var(--dim); }

/* work */
.p-work .wrap { position: absolute; top: 50%; transform: translateY(-50%); width: min(440px, 40vw); }
.p-work.left .wrap { left: var(--pad); }
.p-work.right .wrap { right: calc(var(--pad) + 64px); text-align: right; }
.num { color: var(--dim); }
.name { margin: 16px 0 26px; font-weight: 500; font-size: clamp(44px, 8vw, 132px); line-height: .92; letter-spacing: -.04em; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 0; }
.meta dt { color: var(--dim); }
.meta dd { margin: 0; }
.p-work.right .meta { grid-template-columns: 1fr max-content; }
.summary { margin: 24px 0 0; font-size: 12px; line-height: 1.7; letter-spacing: .02em; color: var(--dim); }
.cta { display: inline-block; margin-top: 28px; padding: 10px 0; font-weight: 500; border-bottom: 1px solid var(--faint); transition: border-color .3s, color .3s; }
.cta:hover { color: var(--accent); border-color: var(--accent); }

/* contact */
.ct-top { position: absolute; left: var(--pad); top: calc(var(--pad) + 72px); }
.ct-title { margin: 0; font-weight: 500; font-size: clamp(22px, 3vw, 46px); letter-spacing: -.02em; }
.p-contact .wrap {
  position: absolute;
  left: var(--pad);
  right: calc(var(--pad) + 64px);
  bottom: calc(var(--pad) + 56px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 28px;
}
.mail { display: inline-block; padding-bottom: 6px; font-weight: 500; font-size: clamp(18px, 2.4vw, 34px); letter-spacing: -.01em; border-bottom: 1px solid var(--faint); transition: border-color .3s; }
.mail:hover { border-color: var(--accent); }
.socials { display: flex; gap: 22px; margin-top: 18px; }
.socials a { color: var(--dim); transition: color .3s; }
.socials a:hover { color: var(--fg); }
.ct-right { display: grid; gap: 10px; text-align: right; }
.copy { color: var(--dim); }
.totop:hover { color: var(--accent); }

/* rail */
.rail {
  position: absolute;
  right: var(--pad);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  font-size: 10px;
}
.rail .track { position: absolute; right: -12px; top: 2px; bottom: 2px; width: 1px; background: var(--faint); }
.rail .fill { position: absolute; inset: 0; background: var(--fg); transform-origin: top; transform: scaleY(0); }
.r-item { display: flex; align-items: center; gap: 12px; color: var(--dim); transition: color .3s; }
.r-item .nm { opacity: 0; transform: translateX(8px); transition: opacity .35s, transform .35s var(--ease); }
.r-item:hover .nm, .r-item.is-active .nm { opacity: 1; transform: none; }
.r-item.is-active { color: var(--fg); }

/* bottom */
.bottom {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sound { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 11px; letter-spacing: .06em; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 10px; }
.bars i { display: block; width: 2px; height: 2px; background: currentColor; transition: height .3s; }
.sound.on .bars i { animation: bar .8s ease-in-out infinite alternate; }
.sound.on .bars i:nth-child(2) { animation-delay: -.3s; }
.sound.on .bars i:nth-child(3) { animation-delay: -.55s; }
.sound.on .bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes bar { from { height: 2px; } to { height: 10px; } }
.hud { font-size: 10px; color: var(--dim); white-space: pre; text-align: right; }

.hint { position: absolute; left: 50%; bottom: var(--pad); transform: translateX(-50%); }
.hint-in { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 10px; letter-spacing: .14em; color: var(--dim); }
.hint-in i { display: block; width: 1px; height: 36px; background: var(--fg); animation: hint 1.8s cubic-bezier(.7, 0, .3, 1) infinite; }
@keyframes hint {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- detail sheet ---------- */
.detail { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.detail .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 10, .5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .6s ease;
}
.detail .sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  padding: calc(var(--pad) + 64px) var(--pad) var(--pad);
  overflow-y: auto;
  background: rgba(15, 16, 19, .94);
  border-left: 1px solid var(--faint);
  font-size: 11px;
  letter-spacing: .06em;
  transform: translate3d(101%, 0, 0);
  transition: transform .8s cubic-bezier(.75, 0, .15, 1);
  user-select: text;
  -webkit-user-select: text;
}
.detail.open { pointer-events: auto; }
.detail.open .backdrop { opacity: 1; }
.detail.open .sheet { transform: none; }
.close { position: absolute; top: var(--pad); right: var(--pad); padding: 6px 0; font-size: 11px; letter-spacing: .06em; color: var(--dim); transition: color .3s; }
.close:hover { color: var(--fg); }
.d-num { color: var(--accent); }
.d-name { margin: 14px 0 30px; font-weight: 500; font-size: clamp(40px, 6vw, 88px); line-height: .92; letter-spacing: -.04em; white-space: pre; }
.d-body { margin: 30px 0 0; font-size: 13px; line-height: 1.8; letter-spacing: .01em; color: rgba(235, 231, 223, .78); }
.d-stats { display: grid; gap: 10px; margin-top: 40px; }
.d-stat { display: grid; grid-template-columns: 11ch 1fr auto; gap: 14px; white-space: pre; }
.d-stat .k { color: var(--dim); }
.d-stat .b { overflow: hidden; }
.d-link { display: inline-block; margin-top: 40px; padding: 10px 0; font-weight: 500; border-bottom: 1px solid var(--faint); }
.d-link:empty { display: none; }
.d-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- cursor ---------- */
#cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  mix-blend-mode: difference;
  transition: opacity .3s;
}
#cursor.is-hidden { opacity: 0; }
.c-dot, .c-ring { position: absolute; left: 0; top: 0; will-change: transform; }
.c-dot i { position: absolute; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #fff; }
.c-ring-in {
  position: absolute;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 50%;
  transition: transform .45s var(--ease), background-color .3s, border-color .3s;
}
#cursor.is-hover .c-ring-in { transform: scale(1.9); background: rgba(255, 255, 255, .08); border-color: #fff; }
#cursor.is-down .c-ring-in { transform: scale(.7); }
#cursor.is-hover.is-down .c-ring-in { transform: scale(1.6); }
.c-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 10px;
  letter-spacing: .08em;
  white-space: nowrap;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
}
#cursor.has-label .c-label { opacity: 1; }
.c-coord { position: absolute; left: 26px; top: 14px; font-size: 9px; white-space: nowrap; color: rgba(255, 255, 255, .55); transition: opacity .3s; }
#cursor.is-hover .c-coord { opacity: 0; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .nav { gap: 14px; font-size: 10px; }
  .status, .rail, .hud { display: none; }
  .hero-copy { bottom: calc(var(--pad) + 52px); }
  .p-manifesto .wrap { right: var(--pad); }
  .p-work .wrap, .p-work.right .wrap {
    left: var(--pad);
    right: var(--pad);
    top: auto;
    bottom: calc(var(--pad) + 52px);
    width: auto;
    transform: none;
    text-align: left;
  }
  .p-work.right .meta { grid-template-columns: max-content 1fr; }
  .name { margin: 10px 0 16px; }
  .summary { display: none; }
  .p-contact .wrap { right: var(--pad); }
  .ct-right { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .hint-in i, .logo i, .sound.on .bars i { animation: none; }
}
