:root {
  --bg: #0b0b0c;
  --bg-2: #141415;
  --ink: #efece6;
  --ink-2: #8e8c86;
  --line: rgba(239, 236, 230, 0.14);
  --accent: #8e6bf5;
  --accent-hi: #b9a6ff; /* lighter tint for thin, semi-transparent canvas lines */
  --display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --gutter: clamp(20px, 5vw, 80px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
html.has-cur, html.has-cur * { cursor: none; }

/* Preloader */
.pre {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: var(--gutter); font-family: var(--display);
  transition: transform 700ms var(--ease-in-out), visibility 0s linear 700ms;
}
.pre.is-done { transform: translateY(-100%); visibility: hidden; }
.pre-word { color: var(--ink-2); font-weight: 500; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; }
/* Morph loader (port of 21st.dev "morph-loading"): four squares trading places and shapes. */
.pre-morph { position: absolute; left: 50%; top: 50%; width: 128px; height: 128px; margin: -64px 0 0 -64px; }
.pre-morph i { position: absolute; left: 56px; top: 56px; width: 16px; height: 16px; background: var(--ink); animation: morph-0 2s ease-in-out infinite; }
.pre-morph i:nth-child(2) { animation-name: morph-1; animation-delay: 0.2s; }
.pre-morph i:nth-child(3) { animation-name: morph-2; animation-delay: 0.4s; }
.pre-morph i:nth-child(4) { animation-name: morph-3; animation-delay: 0.6s; background: var(--accent); }
@keyframes morph-0 {
  0%, 100% { transform: translate(0, 0) scale(1); border-radius: 0%; }
  25% { transform: translate(20px, -20px) scale(1.2); border-radius: 50%; }
  50% { transform: translate(40px, 0) scale(0.8); border-radius: 25%; }
  75% { transform: translate(20px, 20px) scale(1.1); border-radius: 75%; }
}
@keyframes morph-1 {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); border-radius: 0%; }
  25% { transform: translate(-20px, -20px) scale(1.3) rotate(90deg); border-radius: 50%; }
  50% { transform: translate(-40px, 0) scale(0.7) rotate(180deg); border-radius: 25%; }
  75% { transform: translate(-20px, 20px) scale(1.2) rotate(270deg); border-radius: 75%; }
}
@keyframes morph-2 {
  0%, 100% { transform: translate(0, 0) scale(1); border-radius: 0%; }
  25% { transform: translate(-20px, 20px) scale(0.9); border-radius: 100%; }
  50% { transform: translate(0, 40px) scale(1.4); border-radius: 0%; }
  75% { transform: translate(20px, 20px) scale(0.8); border-radius: 50%; }
}
@keyframes morph-3 {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); border-radius: 0%; }
  25% { transform: translate(20px, 20px) scale(1.1) rotate(-90deg); border-radius: 25%; }
  50% { transform: translate(0, -40px) scale(1.3) rotate(-180deg); border-radius: 100%; }
  75% { transform: translate(-20px, -20px) scale(0.9) rotate(-270deg); border-radius: 75%; }
}

/* Cursor */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none;
  width: 12px; height: 12px; border-radius: 50%; background: var(--ink);
  transform: translate(-50%, -50%); mix-blend-mode: difference;
  display: flex; align-items: center; justify-content: center;
  transition: width 220ms var(--ease-out), height 220ms var(--ease-out), background-color 160ms ease;
}
.cursor span { font-size: 12px; font-weight: 600; color: var(--bg); opacity: 0; transition: opacity 160ms ease; font-family: var(--body); }
.cursor.is-link { width: 56px; height: 56px; background: var(--accent); mix-blend-mode: normal; }
.cursor.is-view { width: 84px; height: 84px; background: var(--accent); mix-blend-mode: normal; }
.cursor.is-view span, .cursor.is-link span { opacity: 1; }
@media (hover: none) { .cursor { display: none; } }

/* Header */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px var(--gutter);
  background: linear-gradient(var(--bg) 55%, rgba(11, 11, 12, 0));
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; display: block; }
.nav { display: flex; gap: 28px; font-weight: 500; font-size: 15px; }
.nav a { position: relative; padding: 4px 0; }
.nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform 320ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .nav a:hover::after { transform: scaleX(1); transform-origin: left; } }
.lang { font-weight: 600; font-size: 13px; letter-spacing: 0.04em; padding: 8px 12px; border: 1px solid currentColor; border-radius: 999px; transition: transform 160ms var(--ease-out); }
.lang:active { transform: scale(0.96); }
.burger { display: none; width: 40px; height: 40px; flex-direction: column; justify-content: center; gap: 6px; align-items: center; }
.burger span { display: block; width: 22px; height: 2px; background: currentColor; transition: transform 240ms var(--ease-out); }
.burger[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* Hero */
.hero {
  min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 var(--gutter) calc(28px + var(--safe-b));
  position: relative;
}
.wordmark { margin: 0; line-height: 0.82; font-family: var(--display); font-weight: 800; letter-spacing: -0.055em; font-size: clamp(88px, 19.5vw, 390px); overflow: hidden; }
.wm { display: block; }
.wm .ch { display: inline-block; transform: translateY(110%); transition: transform 900ms var(--ease-out); transition-delay: calc(var(--i) * 40ms); }
body.is-ready .wm .ch { transform: translateY(0); }
.wordmark { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.wordmark.tt-on .wm { color: transparent; }
.tt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.hero-lines { margin-top: 28px; max-width: 780px; }
.hero-line { margin: 0; font-family: var(--display); font-weight: 500; font-size: clamp(22px, 3vw, 40px); letter-spacing: -0.02em; line-height: 1.12; }
.hero-line.muted { color: var(--ink-2); }
.hero-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 48px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.scroll-cue { display: inline-flex; align-items: center; gap: 10px; }
.scroll-cue::before { content: ''; width: 36px; height: 1px; background: var(--ink-2); animation: cue 1.8s var(--ease-in-out) infinite; transform-origin: left; }
@keyframes cue { 0% { transform: scaleX(0); } 50% { transform: scaleX(1); } 100% { transform: scaleX(0); transform-origin: right; } }

/* Marquee */
.marquee { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; }
.marquee-track { display: flex; gap: 0; width: max-content; animation: marquee 40s linear infinite; }
.marquee-track span { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 3.2vw, 44px); letter-spacing: -0.02em; white-space: nowrap; padding: 0 28px; display: inline-flex; align-items: center; gap: 28px; }
.marquee-track span::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (hover: hover) and (pointer: fine) { .marquee:hover .marquee-track { animation-play-state: paused; } }

/* Sections */
.sec { padding: clamp(96px, 14vw, 200px) var(--gutter) 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(32px, 5vw, 72px); border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.sec h2 { margin: 0; font-family: var(--display); font-weight: 800; letter-spacing: -0.04em; line-height: 0.95; font-size: clamp(44px, 8vw, 128px); }
.hint { margin: 0; color: var(--ink-2); font-size: 14px; }
.lead { font-family: var(--display); font-weight: 500; font-size: clamp(22px, 2.6vw, 36px); letter-spacing: -0.02em; line-height: 1.2; margin: 0; max-width: 26ch; }
.body { color: var(--ink-2); margin: 0; max-width: 56ch; font-size: 17px; }

.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: start; }
.stats { list-style: none; margin: clamp(56px, 8vw, 110px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.stats li { padding: 26px 0 0; border-right: 1px solid var(--line); padding-right: 20px; margin-right: 20px; }
.stats li:last-child { border: 0; }
.stats b { display: block; font-family: var(--display); font-weight: 800; letter-spacing: -0.04em; font-size: clamp(40px, 5.5vw, 84px); line-height: 1; }
.stats small { color: var(--ink-2); font-size: 14px; }

/* Services: accordion rows */
.svc { list-style: none; margin: 0; padding: 0; }
.svc li { border-bottom: 1px solid var(--line); }
.svc button { width: 100%; display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 24px; text-align: left; padding: 26px 0; }
.svc .idx { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.svc .t { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(26px, 3.6vw, 56px); line-height: 1; transition: transform 320ms var(--ease-out), color 200ms ease; }
.svc .plus { width: 28px; height: 28px; position: relative; }
.svc .plus::before, .svc .plus::after { content: ''; position: absolute; left: 50%; top: 50%; background: currentColor; transform: translate(-50%, -50%); transition: transform 320ms var(--ease-out); }
.svc .plus::before { width: 18px; height: 2px; }
.svc .plus::after { width: 2px; height: 18px; }
.svc li.is-open .plus::after { transform: translate(-50%, -50%) rotate(90deg); }
@media (hover: hover) and (pointer: fine) { .svc button:hover .t { transform: translateX(10px); } }
.svc .d { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 420ms var(--ease-out); }
.svc .d > p { overflow: hidden; margin: 0; color: var(--ink-2); max-width: 60ch; padding-left: 80px; }
.svc li.is-open .d { grid-template-rows: 1fr; }
.svc li.is-open .d > p { padding-bottom: 28px; }

/* Works: list with floating preview */
.works { position: relative; }
.wk { list-style: none; margin: 0; padding: 0; }
.wk li { border-bottom: 1px solid var(--line); }
.wk a, .wk button { width: 100%; display: grid; grid-template-columns: 56px 1fr auto auto; align-items: baseline; gap: 24px; padding: 28px 0; text-align: left; transition: opacity 240ms ease; }
.wk .idx { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wk .t { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(24px, 3.4vw, 52px); line-height: 1.02; transition: transform 320ms var(--ease-out); }
.wk .s, .wk .y { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.wk.has-hover li:not(.is-hot) button { opacity: 0.35; }
@media (hover: hover) and (pointer: fine) { .wk li.is-hot .t { transform: translateX(14px); } }
.wk-preview {
  position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none;
  width: min(420px, 36vw); aspect-ratio: 900 / 640; border-radius: 6px; overflow: hidden;
  opacity: 0; transform: translate(-50%, -50%) scale(0.92) rotate(-2deg);
  transition: opacity 260ms var(--ease-out), transform 420ms var(--ease-out);
  will-change: transform;
}
.wk-preview.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
.wk-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (hover: none) { .wk-preview { display: none; } }

/* Process */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; counter-reset: s; }
.steps li { border-top: 1px solid var(--line); padding-top: 20px; }
.steps b { display: block; font-family: var(--display); font-weight: 700; font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -0.02em; margin-bottom: 10px; }
.steps b::before { counter-increment: s; content: counter(s, decimal-leading-zero); display: block; color: var(--ink-2); font-size: 13px; font-weight: 500; margin-bottom: 18px; font-family: var(--body); }
.steps p { margin: 0; color: var(--ink-2); font-size: 15px; }

/* Contact */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 40px; max-width: 980px; }
.form label { display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--ink-2); }
.form .wide { grid-column: 1 / -1; }
.form input, .form textarea {
  font: inherit; font-size: 20px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 0; border-radius: 0; transition: border-color 200ms ease; resize: vertical;
}
.form input:focus, .form textarea:focus { outline: none; border-bottom-color: var(--accent); }
.hp { position: absolute; left: -9999px; }
.form-foot { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 12px; padding: 18px 28px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 16px;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.btn::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.6; }
.form-alt { margin: 0; color: var(--ink-2); font-size: 15px; }
.form-alt a { color: var(--ink); border-bottom: 1px solid var(--line); }
.form-status { margin: 0; min-height: 1.5em; color: var(--ink-2); }
.form-status.ok { color: var(--accent); }

/* Footer */
.foot { margin-top: clamp(96px, 14vw, 200px); padding: 0 var(--gutter) calc(28px + var(--safe-b)); }
.foot-big { border-top: 1px solid var(--line); padding-top: 40px; overflow: hidden; }
.wm-sm { display: block; font-family: var(--display); font-weight: 800; letter-spacing: -0.055em; font-size: clamp(88px, 19.5vw, 390px); line-height: 0.82; color: var(--bg-2); -webkit-text-stroke: 1px rgba(239, 236, 230, 0.28); }
.foot-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; margin-top: 40px; font-size: 15px; }
.foot-grid p { margin: 0 0 6px; }
.foot-social { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.foot-meta { color: var(--ink-2); text-align: right; font-size: 13px; }

/* Case dialog */
.case { border: 0; padding: 0; background: var(--bg-2); color: var(--ink); width: min(760px, 100%); max-height: 100svh; margin: 0 0 0 auto; height: 100svh; }
.case::backdrop { background: rgba(11, 11, 12, 0.6); backdrop-filter: blur(4px); }
.case[open] { animation: case-in 420ms cubic-bezier(0.32, 0.72, 0, 1); }
@keyframes case-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.case-inner { padding: 72px var(--gutter) 48px; overflow-y: auto; height: 100%; }
.case-close { position: absolute; top: 20px; right: var(--gutter); font-size: 14px; font-weight: 600; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; }
.case-cover { width: 100%; aspect-ratio: 900/640; object-fit: cover; border-radius: 6px; margin-bottom: 32px; }
.case-kicker { margin: 0 0 8px; color: var(--accent); font-size: 13px; font-weight: 600; }
.case h3 { margin: 0 0 16px; font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(28px, 4vw, 44px); line-height: 1.02; }
.case-summary { margin: 0 0 28px; color: var(--ink); font-size: 17px; }
.case-meta { display: grid; grid-template-columns: 90px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.case-meta dt { color: var(--ink-2); }
.case-meta dd { margin: 0; }

/* Reveal */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 600ms var(--ease-out), transform 800ms var(--ease-out); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* Mobile */
@media (max-width: 820px) {
  .nav { position: fixed; inset: 0; background: var(--bg); flex-direction: column; justify-content: center; padding: var(--gutter); gap: 8px; font-family: var(--display); font-size: clamp(40px, 11vw, 64px); font-weight: 800; letter-spacing: -0.04em; transform: translateY(-100%); transition: transform 480ms var(--ease-in-out); z-index: -1; }
  .nav.is-open { transform: none; }
  .burger { display: flex; }
  .top { mix-blend-mode: normal; }
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:nth-child(2n) { border-right: 0; }
  .stats li { margin-bottom: 24px; }
  .svc button, .wk button { grid-template-columns: 40px 1fr; gap: 12px 16px; }
  .svc .plus { display: none; }
  .svc .d > p { padding-left: 56px; }
  .wk .s, .wk .y { grid-column: 2; font-size: 13px; }
  .wk .y { display: none; }
  .steps { grid-template-columns: 1fr 1fr; }
  .form { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; }
  .foot-meta { text-align: left; }
  .case { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  .scroll-cue::before { animation: none; transform: none; }
  .wm .ch { transition: none; transform: none; }
  [data-reveal] { transition: opacity 200ms ease; transform: none; }
  .pre { transition: opacity 200ms ease; }
  .pre-morph i { animation: none; }
  .pre.is-done { transform: none; opacity: 0; }
  .wk-preview { transition: opacity 200ms ease; }
}
