:root {
  color-scheme: dark;
  --bg: #13110f;            /* banner's black */
  --cream: #eee8df;         /* banner's cream */
  --plate: #1c1a17;
  --ink: #ece6dc;
  --muted: #8f887e;
  --faint: #5a554e;
  --line: rgba(236, 230, 220, 0.1);
  --accent: #f0b24a;        /* banner's amber */
  --split: 70.85%;          /* where black turns cream in the banner (1417 / 2000) */
  --rail: 76px;
  --pad: clamp(24px, 5.5vw, 96px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: 'Rubik', 'Noto Sans SC', 'PingFang SC', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { background: linear-gradient(90deg, var(--bg) var(--split), var(--cream) var(--split)); scroll-behavior: smooth; }

body {
  margin: 0;
  position: relative;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.is-loading body { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
html:is([lang="he"], [lang="ar"], [lang="hi"], [lang="zh"]) .mono:not([dir="ltr"], [dir="ltr"] *) { letter-spacing: 0; font-family: var(--sans); font-size: 12.5px; }
html:is([lang="he"], [lang="ar"], [lang="hi"], [lang="zh"]) .tags span { letter-spacing: 0; font-family: var(--sans); font-size: 12px; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--bg); }

/* ---------- background layers ---------- */
.bg {
  /* the banner at its true proportions, full width, never cropped; the page behind it continues its two colours */
  position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 10 / 3; z-index: 0; pointer-events: none;
  background: url('./bg.webp') center / 100% 100% no-repeat;
  -webkit-mask-image: linear-gradient(#000 82%, transparent);
  mask-image: linear-gradient(#000 82%, transparent);
}
.grain {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; gap: 22px; justify-items: center;
  background: var(--bg);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.1s var(--ease);
}
html.is-in .intro { clip-path: inset(0 0 100% 0); pointer-events: none; }
.intro-word { display: flex; overflow: hidden; font-size: clamp(34px, 6vw, 64px); font-weight: 500; letter-spacing: -0.03em; }
.intro-word span { display: inline-block; transform: translateY(110%); animation: rise 0.9s var(--ease) forwards; }
.intro-word span:nth-child(1) { animation-delay: 0.05s; } .intro-word span:nth-child(2) { animation-delay: 0.09s; }
.intro-word span:nth-child(3) { animation-delay: 0.13s; } .intro-word span:nth-child(4) { animation-delay: 0.17s; }
.intro-word span:nth-child(5) { animation-delay: 0.21s; } .intro-word span:nth-child(6) { animation-delay: 0.25s; color: var(--accent); }
.intro-word span:nth-child(7) { animation-delay: 0.29s; } .intro-word span:nth-child(8) { animation-delay: 0.33s; }
.intro-word span:nth-child(9) { animation-delay: 0.37s; }
.intro-bar { width: 160px; height: 1px; background: var(--line); overflow: hidden; }
.intro-bar i { display: block; height: 100%; width: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease); }
@keyframes rise { to { transform: translateY(0); } }

/* ---------- rails ---------- */
.rail {
  position: fixed; top: 0; bottom: 0; width: var(--rail); z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 28px 0;
}
.rail-title { left: 0; border-right: 1px solid var(--line); }
.rail-foot { color: var(--faint); }

.mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #d9d1c4, #8a8278 60%, #4d4842); box-shadow: 0 6px 14px rgba(0,0,0,.5); }
.mark i { width: 6px; height: 6px; border-radius: 50%; background: var(--bg); transition: transform .5s var(--ease); }
.mark:hover i { transform: scale(1.8); }

.side-title {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 22px; font-weight: 500; letter-spacing: 0.02em; white-space: nowrap;
  display: flex;
}
.side-title span { display: inline-block; transition: transform 0.6s var(--ease), color 0.4s; transition-delay: calc(var(--i) * 35ms); }
.side-title span.dot { color: var(--accent); }
.side-title:hover span { transform: translateX(-6px); }
.side-title:hover span.dot { transform: translateX(-6px) scale(1.6); }

.lang { position: fixed; top: 22px; right: 28px; z-index: 30; direction: ltr; }
.lang-toggle {
  display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
  background: var(--plate); border: 1px solid var(--line); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 24px rgba(0,0,0,.4);
  transition: background .3s, border-color .3s;
}
.lang-toggle:hover { background: #22201d; border-color: rgba(236,230,220,.18); }
.lang-toggle i { width: 6px; height: 6px; border-right: 1px solid; border-bottom: 1px solid; rotate: 45deg; translate: 0 -2px; transition: rotate .3s; }
.lang-toggle[aria-expanded="true"] i { rotate: -135deg; translate: 0 2px; }
.langs {
  list-style: none; margin: 0; padding: 8px; position: absolute; top: 48px; right: 0; width: 212px;
  background: var(--plate); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: top right; pointer-events: none; visibility: hidden;
  transition: opacity .25s, transform .4s var(--ease), visibility 0s .4s;
}
.langs.open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.langs button {
  display: flex; justify-content: space-between; align-items: center; width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--muted); font-size: 15px; transition: background .25s, color .25s;
}
.langs button:hover, .langs button:focus-visible { background: rgba(236,230,220,.06); color: var(--ink); }
.langs button[aria-pressed="true"] { color: var(--accent); }
.langs button .code { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--faint); }
.langs button[aria-pressed="true"] .code { color: var(--accent); }

/* ---------- cursor ---------- */
.cursor { display: none; }
html.has-cursor, html.has-cursor a, html.has-cursor button { cursor: none; }
html.has-cursor .cursor { display: block; position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; mix-blend-mode: difference; }
.cursor-dot, .cursor-ring { position: fixed; left: 0; top: 0; border-radius: 50%; will-change: transform; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; }
.cursor-ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid rgba(255,255,255,.7);
  display: grid; place-items: center;
  transform: translate(var(--x, 0px), var(--y, 0px)) scale(var(--s, 1));
  transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), background .35s, border-color .35s;
}
html.cursor-link .cursor-ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: rgba(255,255,255,.9); }
html.cursor-down .cursor-ring { --s: .85; }
html.cursor-out .cursor { opacity: 0; }

/* ---------- layout ---------- */
main { position: relative; z-index: 10; margin: 0 0 0 var(--rail); padding: 0 var(--pad); }

.hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px 0 110px; position: relative;
  padding-top: calc(30vw + 16px);
  justify-content: flex-start;
}
.kicker { color: var(--muted); margin: 0 0 28px; display: flex; align-items: center; gap: 12px; }
.kicker::before { content: ''; width: 28px; height: 1px; background: var(--muted); }

.headline {
  margin: 0; font-weight: 400;
  font-size: clamp(44px, 5.6vw, 96px); line-height: 0.98; letter-spacing: -0.035em;
}
.headline .line { display: block; overflow: clip; padding: 0.12em 0 0.08em; margin: -0.12em 0 -0.08em; }
.headline .w { display: inline-block; white-space: nowrap; }
.headline .c, .headline .ww {
  display: inline-block; transform: translateY(115%);
  transition: transform 1.1s var(--ease), color 0.4s;
  transition-delay: calc(var(--i) * 28ms + 120ms);
}
html.is-in .headline.on .c, html.is-in .headline.on .ww { transform: translateY(calc(var(--lift, 0) * -1em)); }
.headline.settled .c, .headline.settled .ww { transition: transform .35s var(--ease), color .4s; transition-delay: 0s; }
.headline em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -0.01em; padding-inline-end: 0.04em; }
html[lang="zh"] .headline em, html[lang="hi"] .headline em, html[lang="ar"] .headline em, html[lang="he"] .headline em, html[lang="ru"] .headline em { font-family: var(--sans); font-style: normal; }
html[lang="zh"] .headline, html[lang="hi"] .headline { letter-spacing: 0; line-height: 1.12; font-size: clamp(40px, 5vw, 88px); }

.lede { margin: 34px 0 0; max-width: 460px; color: var(--muted); font-size: 18px; line-height: 1.6; font-weight: 300; }

.hero-foot {
  position: absolute; left: 0; right: 0; bottom: 34px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  width: calc(100vw - var(--rail) - 2 * var(--pad));
}
.hint { margin: 0; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.pulse::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--accent); animation: ping 2.2s var(--ease) infinite; }
@keyframes ping { from { transform: scale(.4); opacity: 1; } to { transform: scale(2); opacity: 0; } }
.scroll { display: flex; align-items: center; gap: 14px; color: var(--muted); transition: color .3s; }
.scroll:hover { color: var(--ink); }
.scroll i { width: 1px; height: 46px; background: var(--line); position: relative; overflow: hidden; }
.scroll i::after { content: ''; position: absolute; left: 0; top: 0; width: 1px; height: 40%; background: var(--ink); animation: drip 2s var(--ease) infinite; }
@keyframes drip { from { transform: translateY(-100%); } to { transform: translateY(260%); } }

/* fade-swap for language changes */
.swap { transition: opacity .35s, filter .35s, transform .5s var(--ease); }
html.swapping .swap { opacity: 0; filter: blur(6px); transform: translateY(6px); }
html.swapping .headline .c, html.swapping .headline .ww { transition: transform .35s cubic-bezier(.5,0,.75,0); transition-delay: 0s; }
html.swapping .row { opacity: 0; transition: opacity .3s; }

/* ---------- work ---------- */
.work { padding: 14vh 0 10vh; max-width: min(900px, 64%); }
.work-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.work-head h2 { margin: 0; font-size: clamp(28px, 3.4vw, 44px); font-weight: 400; letter-spacing: -0.02em; }
.count { color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; }
.work-section + .work-section { margin-top: clamp(64px, 11vh, 120px); }

.row {
  --mx: 50%; --my: 50%;
  position: relative; display: grid; align-items: center;
  grid-template-columns: 56px 1fr auto; gap: 8px 24px;
  margin: 14px 0; padding: 30px 28px; border-radius: 22px;
  background: var(--plate);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035), inset 0 -1px 0 rgba(0,0,0,.4), 0 18px 40px -20px rgba(0,0,0,.7);
  isolation: isolate; overflow: hidden;
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.row::before { /* matte spotlight that follows the cursor */
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(236,230,220,.075), transparent 60%);
  opacity: 0; transition: opacity .4s;
}
.row::after { /* soft edge highlight */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 1px; background: radial-gradient(260px circle at var(--mx) var(--my), rgba(227,160,74,.45), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .4s;
}
a.row:hover { transform: translateY(-4px) scale(1.005); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 30px 60px -24px rgba(0,0,0,.85); }
a.row:hover::before, a.row:hover::after, a.row:focus-visible::before { opacity: 1; }

.row-num { color: var(--faint); align-self: start; padding-top: 10px; transition: color .4s; }
a.row:hover .row-num { color: var(--accent); }
.row-title { margin: 0; font-size: clamp(26px, 3.2vw, 46px); font-weight: 400; letter-spacing: -0.025em; line-height: 1.1; }
.roll { display: inline-grid; overflow: clip; vertical-align: top; }
.roll > span { grid-area: 1 / 1; transition: transform .6s var(--ease); }
.roll > span + span { transform: translateY(105%); color: var(--accent); }
a.row:hover .roll > span:first-child { transform: translateY(-105%); }
a.row:hover .roll > span + span { transform: translateY(0); }
.row-desc { grid-column: 2; margin: 6px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.6; font-weight: 300; max-width: 520px; }
.tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tags span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); transition: border-color .4s, color .4s; }
a.row:hover .tags span { border-color: rgba(236,230,220,.18); color: var(--ink); }
.go {
  grid-column: 3; grid-row: 1 / span 3;
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, #24221f, #1a1917);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 22px rgba(0,0,0,.5);
  font-size: 22px; transition: background .5s, color .5s, transform .6s var(--ease);
}
.go span { display: inline-block; transition: transform .6s var(--ease); }
a.row:hover .go { background: var(--accent); color: var(--bg); }
a.row:hover .go span { transform: rotate(-45deg); }
html[dir="rtl"] .go span { scale: -1 1; }
html[dir="rtl"] a.row:hover .go span { transform: rotate(45deg); }

.row.soon { background: transparent; box-shadow: none; border: 1px dashed rgba(236,230,220,.14); }
.row.soon .row-title { color: var(--muted); }
.row.soon .go { background: transparent; box-shadow: none; border: 1px dashed rgba(236,230,220,.16); }
.row.soon .go span { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.8); opacity: .4; } }

/* ---------- footer ---------- */
.foot { padding: 12vh 0 48px; max-width: min(900px, 64%); }
.foot-big { margin: 0 0 56px; font-family: var(--serif); font-style: italic; font-size: clamp(40px, 6vw, 96px); line-height: 1; letter-spacing: -0.02em; }
html[lang="zh"] .foot-big, html[lang="hi"] .foot-big, html[lang="ar"] .foot-big, html[lang="he"] .foot-big, html[lang="ru"] .foot-big { font-family: var(--sans); font-style: normal; font-weight: 300; }
.foot-row { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); }
.totop { display: inline-block; padding: 12px 18px; border-radius: 999px; background: var(--plate); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 24px rgba(0,0,0,.45); transition: background .4s, color .4s; }
.totop:hover { background: var(--ink); color: var(--bg); }
.magnetic { transition: transform .5s var(--ease), background .4s, color .4s; }

/* scroll reveal */
.reveal, .row { opacity: 0; transform: translateY(40px); }
.reveal.seen, .row.seen { opacity: 1; transform: none; transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
a.row.seen:hover { transform: translateY(-4px) scale(1.005); transition: transform .6s var(--ease), box-shadow .6s var(--ease); }

/* on desktop the right edge of the page is the banner's cream half */
@media (min-width: 821px) {
  .scroll { --muted: #6c655b; --ink: #14120f; --line: rgba(20,18,15,.2); }
  .lang-toggle { background: var(--plate); }
}

/* right-to-left languages: mirror the banner so the text column stays on its black half */
html[dir="rtl"] { background: linear-gradient(90deg, var(--cream) calc(100% - var(--split)), var(--bg) calc(100% - var(--split))); }
html[dir="rtl"] .bg { transform: scaleX(-1); }
@media (min-width: 821px) {
  html[dir="rtl"] .rail-title { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--line); }
  html[dir="rtl"] main { margin: 0 var(--rail) 0 0; }
  html[dir="rtl"] .lang { right: auto; left: 28px; }
  html[dir="rtl"] .langs { right: auto; left: 0; transform-origin: top left; }
}

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  :root { --rail: 0px; --pad: 16px; }
  .rail { bottom: auto; width: auto; height: 60px; padding: 0 16px; flex-direction: row; border: 0; }
  .rail-title { left: 0; gap: 12px; }
  .rail-foot { display: none; }
  .side-title { writing-mode: horizontal-tb; transform: none; font-size: 18px; }
  .lang { top: 10px; right: 16px; }
  body::before { content: ''; position: fixed; inset: 0 0 auto; height: 84px; z-index: 15; pointer-events: none;
    background: linear-gradient(var(--bg) 30%, rgba(19,17,15,0)); }
  .bg { top: 56px; }
  html, html[dir="rtl"] { background: var(--bg); }
  .hero { padding: calc(30vw + 84px) 0 120px; min-height: 100svh; justify-content: flex-start; }
  .hero-foot { width: auto; bottom: 28px; }
  .scroll i { height: 30px; }
  .lede { font-size: 16px; margin-top: 22px; }
  .kicker { margin-bottom: 18px; }
  .work, .foot { max-width: none; }
  .work { padding-top: 8vh; }
  .row { grid-template-columns: 1fr auto; padding: 22px 20px; border-radius: 18px; }
  .row-num { grid-column: 1 / -1; padding: 0; }
  .row-desc, .tags { grid-column: 1 / -1; }
  .go { grid-column: 2; grid-row: 2; width: 48px; height: 48px; font-size: 18px; }
  .foot-row { flex-direction: column; gap: 18px; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse::after, .scroll i::after, .row.soon .go span { animation: none; }
  .intro { display: none; }
  .reveal, .row { opacity: 1; transform: none; }
}
