* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --font-en: "Archivo", system-ui, sans-serif;
  --font-ja: "Zen Kaku Gothic New", sans-serif;
  --font-hand: "Caveat", cursive;
}

html { scroll-behavior: auto; }

body {
  background: #fff;
  font-family: var(--font-en);
  overflow-x: hidden;
}

@media (pointer: fine) {
  body, body * { cursor: none; }
}

#spacer { height: 600vh; }

#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* ============ UI layer ============ */
.ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.blend {
  color: #fff;
  mix-blend-mode: difference;
}

/* header */
.header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px 36px;
}

.logo {
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -0.04em;
}
.logo-bang { display: inline-block; animation: bang 3s ease-in-out infinite; }
@keyframes bang {
  0%, 84%, 100% { transform: rotate(0deg); }
  88% { transform: rotate(14deg) translateY(-2px); }
  94% { transform: rotate(-8deg); }
}

.counter {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* section headlines */
.sec {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  will-change: transform, opacity;
}
.pos-center { align-items: center; text-align: center; }
.pos-left   { align-items: flex-start; text-align: left;  padding-left: 7vw; }
.pos-right  { align-items: flex-end;   text-align: right; padding-right: 7vw; }

.kicker {
  font-style: italic;
  font-weight: 900;
  font-size: clamp(18px, 2.4vw, 30px);
  letter-spacing: 0.02em;
  margin-bottom: 0.4em;
  opacity: 0;
  transform: translateY(26px) rotate(-2deg);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.08s, opacity 0.5s 0.08s;
}
.sec.is-in .kicker { opacity: 1; transform: none; }

.kicker::before {
  content: "✳";
  display: inline-block;
  margin-right: 0.45em;
  font-style: normal;
  animation: spin 7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.title {
  position: relative;
  font-weight: 900;
  font-size: clamp(52px, 11vw, 150px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.title-next {
  font-size: clamp(34px, 6.4vw, 92px);
  white-space: normal;
  line-height: 1.02;
}

.ja {
  font-family: var(--font-ja);
  font-weight: 700;
  font-size: clamp(13px, 1.4vw, 18px);
  letter-spacing: 0.34em;
  margin-top: 2.2em;
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.55s, opacity 0.4s 0.5s;
}
.sec.is-in .ja { opacity: 1; clip-path: inset(0 -3% 0 0); }

/* ---- per-char machinery ---- */
.ch {
  display: inline-block;
  white-space: pre;
  transform: translateY(115%) rotate(9deg);
  opacity: 0;
  transition:
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--i) * 42ms + 120ms),
    opacity 0.35s linear calc(var(--i) * 42ms + 120ms);
}
.sec.is-in .ch { transform: none; opacity: 1; }
.ci { display: inline-block; }

/* mixed solid / outline letters */
.sec[data-i="0"] .title .ch:nth-child(3n + 2) .ci,
.sec[data-i="1"] .title .ch:nth-child(2n + 1) .ci,
.sec[data-i="3"] .title .ch:nth-child(4n + 3) .ci {
  -webkit-text-stroke: 2.5px #fff;
  color: transparent;
}

/* giant ghost section number behind the headline */
.ghost {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -72%) scale(1.18);
  font-weight: 900;
  font-size: 30vw;
  line-height: 1;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.28);
  z-index: -1;
  opacity: 0;
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s;
}
.sec.is-in .ghost { opacity: 1; transform: translate(-50%, -72%) scale(1); }
.pos-left .ghost { left: auto; right: 4vw; transform: translate(0, -72%) scale(1.18); }
.pos-left.is-in .ghost { transform: translate(0, -72%) scale(1); }
.pos-right .ghost { left: 4vw; transform: translate(0, -72%) scale(1.18); }
.pos-right.is-in .ghost { transform: translate(0, -72%) scale(1); }

/* 01 GRAPHIC — lazy per-char wobble */
.sec[data-i="0"].is-in .ci {
  animation: chWob 4.2s ease-in-out calc(var(--i) * 0.12s) infinite;
}
@keyframes chWob {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  30% { transform: rotate(2.4deg) translateY(-2%); }
  70% { transform: rotate(-2deg) translateY(1.5%); }
}

/* 02 FLEXIBLE — jelly skew */
.sec[data-i="1"].is-in .ci {
  animation: chJelly 2.8s ease-in-out calc(var(--i) * 0.11s) infinite;
}
@keyframes chJelly {
  0%, 100% { transform: skewX(0deg) scaleY(1); }
  30% { transform: skewX(-11deg) scaleY(0.93); }
  62% { transform: skewX(8deg) scaleY(1.06); }
}

/* 03 TECHNICAL — glitch slices + flicker */
.glitch-copy {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  white-space: nowrap;
}
.sec[data-i="2"].is-in .glitch-copy { display: block; }
.glitch-a {
  color: #28f7ff;
  animation: glitchA 2.7s steps(1) infinite;
}
.glitch-b {
  color: #ff2d8a;
  animation: glitchB 3.1s steps(1) infinite;
}
@keyframes glitchA {
  0%, 8%, 100% { clip-path: inset(100% 0 0 0); transform: none; opacity: 0.85; }
  2% { clip-path: inset(12% 0 76% 0); transform: translateX(-0.04em); }
  5% { clip-path: inset(58% 0 28% 0); transform: translateX(0.05em) skewX(4deg); }
  44% { clip-path: inset(100% 0 0 0); }
  46% { clip-path: inset(32% 0 52% 0); transform: translateX(0.05em); }
  49% { clip-path: inset(78% 0 8% 0); transform: translateX(-0.06em); }
  52% { clip-path: inset(100% 0 0 0); }
}
@keyframes glitchB {
  0%, 10%, 100% { clip-path: inset(0 0 100% 0); transform: none; opacity: 0.85; }
  3% { clip-path: inset(66% 0 18% 0); transform: translateX(0.045em); }
  7% { clip-path: inset(8% 0 80% 0); transform: translateX(-0.05em) skewX(-5deg); }
  60% { clip-path: inset(0 0 100% 0); }
  63% { clip-path: inset(44% 0 40% 0); transform: translateX(-0.045em); }
  66% { clip-path: inset(0 0 100% 0); }
}
.sec[data-i="2"].is-in .ci {
  animation: chFlicker 4.6s steps(1) calc(var(--i) * 0.35s) infinite;
}
@keyframes chFlicker {
  0%, 4.4%, 100% { opacity: 1; }
  4.5%, 4.9% { opacity: 0.15; }
  5% { opacity: 1; }
}

/* 04 FRIENDLY — bouncing crowd */
.sec[data-i="3"].is-in .ci {
  animation: chBounce 1.7s cubic-bezier(0.36, 0, 0.64, 1) calc(var(--i) * 0.075s) infinite;
}
@keyframes chBounce {
  0%, 100% { transform: translateY(0) scaleY(1); }
  18% { transform: translateY(2%) scaleY(0.94); }
  50% { transform: translateY(-13%) scaleY(1.04); }
  82% { transform: translateY(2%) scaleY(0.95); }
}

/* 05 VISIONARY — flowing light through the glyphs */
.sec[data-i="4"] .title {
  background: linear-gradient(105deg, #fff 30%, #ffe2a8 45%, #8fd6ff 55%, #fff 70%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 4.6s linear infinite;
}
.sec[data-i="4"] .title .ci { color: transparent; }
@keyframes shine {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}
.sec[data-i="4"].is-in .ch {
  animation: chBreath 5s ease-in-out calc(var(--i) * 0.1s) infinite;
}
@keyframes chBreath {
  0%, 100% { letter-spacing: -0.035em; }
  50% { letter-spacing: 0.01em; }
}

/* 06 NEXT — dawn gradient + ember glow */
.sec[data-i="5"] .title {
  background: linear-gradient(180deg, #ffffff 25%, #ffc56b 62%, #ff5a2a 96%);
  -webkit-background-clip: text;
  background-clip: text;
  animation: emberGlow 3.2s ease-in-out infinite;
}
.sec[data-i="5"] .title .ci { color: transparent; }
@keyframes emberGlow {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(255, 110, 30, 0.25)); }
  50% { filter: drop-shadow(0 0 36px rgba(255, 130, 40, 0.55)); }
}

.sec-team .title { font-size: clamp(44px, 9vw, 120px); }

.totop {
  pointer-events: auto;
  margin-top: 3.5em;
  background: none;
  border: 1px solid #fff;
  color: #fff;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.18em;
  padding: 14px 34px;
  border-radius: 999px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.totop:hover { transform: scale(1.08); }

/* marquee — section 2 */
.marquee {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12vh 0 14vh;
  opacity: 0;
  overflow: hidden;
}
.marquee-row {
  display: flex;
  white-space: nowrap;
  font-weight: 900;
  font-size: 9vw;
  letter-spacing: -0.02em;
  -webkit-text-stroke: 2px #fff;
  color: transparent;
}
.marquee-row span { animation: slide 26s linear infinite; padding-right: 0; }
.row-b { font-family: var(--font-ja); font-size: 6.5vw; -webkit-text-stroke: 1.5px #fff; }
.row-b span { animation-direction: reverse; animation-duration: 32s; }
@keyframes slide {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* back text — section 3 */
.backtext {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 4vw;
  font-weight: 900;
  font-size: 16vw;
  line-height: 0.86;
  letter-spacing: -0.04em;
  opacity: 0;
}

/* footer */
.footer { position: absolute; inset: 0; }

.sidelabel {
  position: absolute;
  left: 30px; top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5em;
  opacity: 0.7;
  font-family: var(--font-ja);
}

.credit {
  position: absolute;
  left: 36px; bottom: 26px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  opacity: 0.85;
}
.credit em { font-style: normal; border-bottom: 1px solid currentColor; }

.scrollhint {
  position: absolute;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.42em;
  transition: opacity 0.5s;
}
.scrollline {
  width: 1px; height: 44px;
  background: #fff;
  overflow: hidden;
  position: relative;
  display: block;
}
.scrollline::after {
  content: "";
  position: absolute;
  left: 0; top: -100%;
  width: 100%; height: 100%;
  background: #888;
  animation: scrolldrop 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes scrolldrop {
  from { top: -100%; }
  to   { top: 100%; }
}

.progress {
  position: absolute;
  right: 30px; top: 50%;
  transform: translateY(-50%);
  width: 1px; height: 38vh;
  background: rgba(255,255,255,0.35);
}
.progress-dot {
  position: absolute;
  left: 50%; top: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

/* hand note near baku */
.handnote {
  position: absolute;
  font-family: var(--font-hand);
  font-size: 26px;
  transform: rotate(-8deg);
  opacity: 0;
  transition: opacity 0.6s;
}

/* ============ cursor ============ */
.cursor {
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  pointer-events: none;
  mix-blend-mode: difference;
}
.cursor-dot, .cursor-ring {
  position: absolute;
  border-radius: 50%;
  translate: -50% -50%;
  display: block;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid #fff;
  transition: scale 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
}
.cursor.is-hover .cursor-ring { scale: 1.7; }
@media (pointer: coarse) { .cursor { display: none; } }

/* ============ loading ============ */
.loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #0b0b0e;
  color: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 1s cubic-bezier(0.83, 0, 0.17, 1);
}
.loading.done { transform: translateY(-101%); }

.loading-logo {
  font-style: italic;
  font-weight: 900;
  font-size: clamp(40px, 7vw, 96px);
  letter-spacing: -0.03em;
}
.loading-pct {
  position: absolute;
  right: 40px; bottom: 34px;
  font-weight: 900;
  font-size: clamp(40px, 6vw, 80px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.loading-bar {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 3px;
  background: rgba(255,255,255,0.12);
}
.loading-bar i {
  display: block;
  width: 100%; height: 100%;
  background: #fff;
  transform-origin: left;
  transform: scaleX(0);
}
.loading-note {
  position: absolute;
  left: 40px; bottom: 38px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  opacity: 0.6;
}

@media (max-width: 640px) {
  .header { padding: 18px 20px; }
  .credit { left: 20px; bottom: 18px; font-size: 8px; }
  .progress { right: 14px; }
  .title { white-space: normal; }
}
