:root {
  --indigo: #1d1b6b;
  --gold: #ffd60a;
  --coral: #ff5a3c;
  --emerald: #2ecc8f;
  --final: #0b7a55;
  --on-indigo: #ecebf5;
  --paper: #f4f1ea;
  --card: #fbf9f4;
  --ink: #14142b;
  --muted: #5a5a6e;
  --line: rgba(20, 20, 43, 0.14);
  --accent: #1d1b6b;   /* text accent: must read on paper */
  --live: #1f7a4d;
  --progress: #9a6a00;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --wrap: min(1120px, 100% - 3rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e0d22;
    --card: #17163a;
    --ink: #ecebf5;
    --muted: #a3a2bd;
    --line: rgba(236, 235, 245, 0.14);
    --accent: #ffd60a;
    --live: #4cc58a;
    --progress: #ffd60a;
    --final: #4ade9f;
  }
}

/* "Flip" toggle in the header: the two colours trade places everywhere */
html.flipped { --indigo: #ffd60a; --gold: #1d1b6b; --on-indigo: #14142b; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0; }
button { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 1rem; background: var(--indigo); color: var(--gold); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .85rem max(1.5rem, (100% - 1120px) / 2);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font: 600 1.05rem var(--sans); text-decoration: none; letter-spacing: -0.01em; }
.brand b { background: var(--gold); color: var(--indigo); border-radius: 999px; padding: 0 .22em; font-weight: 700; display: inline-block; transition: transform .5s var(--ease); }
.brand:hover b { transform: rotate(180deg); }
.brand-light { font-weight: 400; color: var(--muted); }
.header-right { display: flex; align-items: center; gap: 1.5rem; }
.site-header nav { display: flex; gap: 1.5rem; }
.site-header nav a { font: 500 .8rem var(--mono); text-transform: uppercase; letter-spacing: .08em; text-decoration: none; color: var(--muted); }
.site-header nav a:hover { color: var(--ink); }
.flip-toggle {
  width: 2rem; height: 2rem; flex-shrink: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--ink);
  background: linear-gradient(90deg, var(--indigo) 50%, var(--gold) 50%);
  transition: transform .6s var(--ease);
}
.flip-toggle:hover { transform: rotate(180deg) scale(1.08); }

/* Hero: two identical layers in opposite colours, split by a draggable seam */
.hero {
  --lx: 30%; --ly: 45%; --s: 1;
  --rx: clamp(70px, 11vw, 150px); --ry: calc(var(--rx) * 1.3);
  position: relative; display: grid; overflow: hidden;
}
.side { grid-area: 1 / 1; background: var(--indigo); color: var(--gold); padding: clamp(4rem, 11vw, 8rem) 0 5.5rem; }
.side.flip {
  background: var(--gold); color: var(--indigo);
  clip-path: ellipse(calc(var(--rx) * var(--s)) calc(var(--ry) * var(--s)) at var(--lx) var(--ly));
}
.lens {
  position: absolute; left: var(--lx); top: var(--ly);
  width: calc(var(--rx) * 2 * var(--s)); height: calc(var(--ry) * 2 * var(--s));
  transform: translate(-50%, -50%) rotate(-8deg);
  border: 4px solid var(--paper); border-radius: 50%;
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(0, 0, 0, .15);
  touch-action: none; cursor: grab;
}
.lens:active { cursor: grabbing; }
@media (hover: hover) { .lens { pointer-events: none; } }
.lens-hint {
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, .9rem) rotate(8deg);
  font: 500 .7rem var(--mono); text-transform: uppercase; letter-spacing: .12em; white-space: nowrap;
  background: var(--paper); color: var(--ink); border-radius: 999px; padding: .25rem .7rem;
  transition: opacity .4s;
}
.hero.touched .lens-hint { opacity: 0; }
.side .inner { width: var(--wrap); margin: 0 auto; }
.eyebrow { font: 500 .78rem var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.title {
  font-family: var(--serif);
  font-size: clamp(4rem, 15vw, 11rem);
  line-height: .9;
  letter-spacing: -0.03em;
  margin: 1.25rem 0 2rem;
}
.title em { opacity: .92; }
.lede { font-size: clamp(1.15rem, 2.2vw, 1.5rem); max-width: 32ch; }
.flipword {
  margin-top: 2.25rem;
  display: inline-flex; gap: .75rem; align-items: baseline;
  font: 400 clamp(1.5rem, 3.5vw, 2.25rem) var(--serif);
  transition: opacity .3s, transform .3s;
}
.flipword s { opacity: .8; text-decoration-thickness: 2px; }
.flipword .arrow { font-family: var(--sans); font-size: .7em; }
.hero.out .flipword { opacity: 0; transform: translateY(6px); }

/* Antonym band: a strip of pairs running under the hero */
.band { background: var(--ink); color: var(--paper); overflow: hidden; padding: .9rem 0; }
.band-run { display: flex; width: max-content; animation: tick 50s linear infinite; }
.band-run span { font: 400 1.4rem var(--serif); white-space: nowrap; padding-right: 2rem; }
.band-run s { opacity: .8; text-decoration-color: var(--gold); }
.band-run i { color: var(--gold); font-style: normal; margin-inline: .5rem; }
.band:hover .band-run { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }

/* Sections */
.section { width: var(--wrap); margin: 0 auto; padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-head { display: grid; grid-template-columns: 4rem 1fr; gap: .25rem 1.5rem; margin-bottom: 3rem; }
.num { font: 500 .78rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); padding-top: .9rem; }
.section-head h2 { font: 400 clamp(2.5rem, 6vw, 4rem)/1 var(--serif); letter-spacing: -0.02em; }
.section-note { grid-column: 2; color: var(--muted); max-width: 52ch; margin-top: .75rem; }

/* Work stage: the section floods with the current project's colour, its word running behind */
.stage {
  --stage-bg: var(--indigo); --stage-fg: var(--gold);
  position: relative; overflow: hidden;
  background: var(--stage-bg); color: var(--stage-fg);
  transition: background-color .7s, color .7s;
  padding: clamp(4rem, 9vw, 6rem) 0 clamp(3rem, 6vw, 4rem);
}
.stage-inner { width: var(--wrap); margin: 0 auto; position: relative; }
.stage .num { color: inherit; }
.stage .section-note { color: inherit; }
.ticker { position: absolute; inset-inline: 0; top: 56%; transform: translateY(-50%); overflow: hidden; pointer-events: none; opacity: .13; }
.ticker-run { display: flex; width: max-content; animation: tick 40s linear infinite; }
.ticker-run span { font: italic 400 clamp(7rem, 20vw, 16rem)/1 var(--serif); white-space: nowrap; padding-right: 3vw; }

.track { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.25rem; }
.project { display: flex; }
.card {
  display: flex; flex-direction: column; gap: 1rem; width: 100%;
  background: var(--card); color: var(--ink);
  border-radius: 22px; padding: 1.75rem;
  box-shadow: 0 35px 60px -20px rgba(0, 0, 0, .5);
}
.pair { display: grid; grid-template-columns: 1fr 1fr; font: 400 clamp(1.3rem, 2.6vw, 1.75rem)/1.1 var(--serif); text-align: center; margin-bottom: .5rem; }
.pair > * { padding: 1.4rem .5rem; display: grid; place-items: center; text-decoration: none; }
.pair del { background: #1d1b6b; color: #ffd60a; border-radius: 999px 0 0 999px; }
.pair ins { background: #ffd60a; color: #1d1b6b; border-radius: 0 999px 999px 0; }
.pair.open del { background: var(--ink); color: var(--paper); }
.pair.open ins { background: var(--coral); color: #14142b; }
.project-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.card h3 { font: 400 2.1rem/1.1 var(--serif); }
.bn { display: block; font: 600 1rem var(--sans); color: var(--muted); margin-top: .35rem; }
.card > p { color: var(--muted); flex: 1; }
.status {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: .4rem;
  font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid currentColor; border-radius: 999px; padding: .25rem .65rem;
}
.status::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.status.live { color: var(--live); }
.status.live::before { animation: pulse 2s infinite; }
.status.progress { color: var(--progress); }
.status.open { color: var(--coral); }
.status.final { color: var(--final); }
@keyframes pulse { 50% { opacity: .25; } }
.link { font: 500 .9rem var(--sans); text-decoration: none; border-bottom: 2px solid var(--gold); align-self: flex-start; padding-bottom: 2px; }
.link:hover { color: var(--accent); }
.link.muted { color: var(--muted); border-color: var(--line); }

.stage-nav { display: none; }

/* With JavaScript the cards become a carousel: one floating in front, neighbours peeking in */
.js .track { display: grid; grid-template-columns: none; place-items: center; min-height: 31rem; touch-action: pan-y; cursor: grab; user-select: none; }
.js .track:active { cursor: grabbing; }
.js .project { grid-area: 1 / 1; width: min(84vw, 30rem); transition: transform .7s var(--ease), opacity .7s; perspective: 900px; }
.js .project[data-state="current"] { z-index: 2; }
.js .project[data-state="prev"] { transform: translateX(-80%) scale(.6) rotate(-5deg); opacity: .45; cursor: pointer; }
.js .project[data-state="next"] { transform: translateX(80%) scale(.6) rotate(5deg); opacity: .45; cursor: pointer; }
.js .project[data-state="hidden"] { transform: scale(.4); opacity: 0; pointer-events: none; }
.motion .project[data-state="current"] .card { animation: float 7s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotateX(5deg) rotateY(-8deg); }
  50% { transform: translateY(-12px) rotateX(2deg) rotateY(-3deg); }
}
.js .stage-nav { display: flex; justify-content: center; align-items: center; gap: 1.25rem; margin-top: 2.25rem; }
.stage-nav button {
  width: 2.9rem; height: 2.9rem; border-radius: 50%; cursor: pointer;
  border: 1.5px solid currentColor; background: transparent; font-size: 1.1rem;
  transition: background .2s, color .2s, transform .2s;
}
.stage-nav button:hover { background: var(--stage-fg); color: var(--stage-bg); transform: scale(1.06); }
.counter { font: 500 .8rem var(--mono); letter-spacing: .25em; min-width: 5.5rem; text-align: center; }

/* Demos */
.demos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 2rem; }
.demos-head h3 { font: 400 1.75rem var(--serif); margin-bottom: .75rem; }
.demos-head p { color: var(--muted); font-size: .92rem; }
.demo-list { list-style: none; margin: 0; padding: 0; grid-column: span 2; counter-reset: demo; }
@media (max-width: 760px) { .demo-list { grid-column: auto; } }
.demo-list li {
  position: relative; overflow: hidden;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem;
  padding: 1.1rem .75rem; border-bottom: 1px solid var(--line); counter-increment: demo;
}
.demo-list li:first-child { border-top: 3px solid var(--accent); }
.demo-list li::before {
  content: ""; position: absolute; inset: 0; background: var(--indigo);
  transform: scaleY(0); transform-origin: bottom; transition: transform .45s var(--ease); z-index: -1;
}
.demo-list li:hover::before { transform: scaleY(1); }
.demo-list li:hover { color: var(--gold); }
.demo-list li:hover p { color: var(--gold); }
/* margin (not transform) for the nudge, so the row-wide link below keeps the whole row as its box */
.demo-list h4 { font: 400 1.5rem var(--serif); transition: margin .45s var(--ease); }
.demo-list h4::before { content: counter(demo, decimal-leading-zero); font: 500 .7rem var(--mono); vertical-align: super; margin-right: .6rem; opacity: .6; }
.demo-list li:hover h4 { margin-left: .6rem; }
.demo-list h4 a { color: inherit; text-decoration: none; }
.demo-list h4 a::after { content: ""; position: absolute; inset: 0; } /* whole row is clickable */
.demo-list h4 a:focus-visible { outline: none; }
.demo-list li:has(a:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.demo-list p { font: 400 .75rem var(--mono); color: var(--muted); text-align: right; transition: color .3s; white-space: nowrap; }
.demo-list li { isolation: isolate; }
.demo-list li.soon { opacity: .6; }
.demo-list li.soon::before { display: none; }
.demo-list li.soon:hover, .demo-list li.soon:hover p { color: inherit; }
.demo-list li.soon:hover h4 { margin-left: 0; }

/* Build story: how every journal entry is written. Static list by default… */
.story-head { width: var(--wrap); margin: 0 auto; }
.story-steps { list-style: none; margin: 0 auto 2.5rem; padding: 0; width: var(--wrap); display: flex; flex-wrap: wrap; gap: .6rem; }
.story-steps li { border: 1px solid var(--line); border-radius: 999px; padding: .45rem 1rem; font-size: .9rem; }
.story-steps .step-num { font: 500 .72rem var(--mono); color: var(--accent); margin-right: .5rem; }
.story-steps .step-text, .story-word, .story-dots { display: none; }

/* …and a sticky scroll story when motion is on: one step per screen */
.motion .story { position: relative; height: calc(var(--n, 5) * 75vh + 100vh); }
.motion .story-pin {
  --sbg: var(--indigo); --sfg: var(--gold);
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  background: var(--sbg); color: var(--sfg);
  transition: background-color .7s, color .7s;
}
.motion .story-word {
  display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font: italic 400 clamp(7rem, 24vw, 20rem)/1 var(--serif); opacity: .1; white-space: nowrap; pointer-events: none;
}
.motion .story-word.pop { animation: pop .6s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.9); } }
.motion .story-head { position: absolute; top: 5.5rem; left: 0; right: 0; }
.motion .story-head .section-head { display: block; margin: 0; }
.motion .story-head .num, .motion .story-head .section-note { color: inherit; padding: 0; }
.motion .story-head .section-note { margin: .75rem auto 0; }
.motion .story-head h2 { font-size: clamp(2rem, 5vw, 3.25rem); }
.motion .story-steps { display: grid; width: min(36rem, 100% - 3rem); margin: 6rem 0 0; }
.motion .story-steps li { grid-area: 1 / 1; border: 0; padding: 0; opacity: 0; transform: translateY(24px); transition: opacity .5s, transform .5s var(--ease); }
.motion .story-steps li.on { opacity: 1; transform: none; }
.motion .story-steps .step-num { display: block; color: inherit; letter-spacing: .25em; margin: 0 0 .5rem; }
.motion .story-steps .step-title { display: block; font: 400 clamp(2.25rem, 6vw, 3.75rem)/1.05 var(--serif); }
.motion .story-steps .step-text { display: block; margin-top: .9rem; font-size: 1.1rem; }
.motion .story-dots { display: flex; flex-direction: column; gap: .5rem; position: absolute; right: 1.25rem; top: 50%; transform: translateY(-50%); }
.story-dots span { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .25; transition: opacity .3s, transform .3s; }
.story-dots span.on { opacity: 1; transform: scale(1.3); }

/* Journal entries */
.entries { display: grid; gap: 1.25rem; }
.entry { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: .5rem 2rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1.75rem; transition: border-color .3s, transform .3s; }
.entry:hover { border-color: var(--accent); transform: translateY(-3px); }
.entry time { font: 400 .8rem var(--mono); color: var(--muted); padding-top: .6rem; }
.entry h3 { font: 400 2rem/1.15 var(--serif); margin-bottom: .5rem; }
.entry p { color: var(--muted); max-width: 62ch; margin-top: .5rem; }
.entry b { font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-right: .4rem; }
@media (max-width: 640px) { .entry { grid-template-columns: 1fr; } .entry time { padding-top: 0; } }

/* Contact */
.contact { background: var(--indigo); color: var(--on-indigo); }
.contact .section-head { margin-bottom: 1.5rem; }
.contact .num { color: var(--gold); }
.contact h2 { color: var(--gold); }
.contact-inner { width: var(--wrap); margin: 0 auto; padding: clamp(3.5rem, 8vw, 5.5rem) 0; }
.contact-lede { font: 400 clamp(1.4rem, 3vw, 2rem)/1.3 var(--serif); max-width: 28ch; margin-bottom: 2rem; }
.contact ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.contact li { font-size: .95rem; }
.contact li a {
  display: inline-block; text-decoration: none;
  background: var(--gold); color: var(--indigo); border-radius: 999px; padding: .75rem 1.4rem;
  font: 600 .95rem var(--sans); overflow-wrap: anywhere;
  transition: background .2s, transform .2s;
}
.contact li a:hover { background: #fff; color: #1d1b6b; transform: translateY(-2px); }
.contact li a:focus-visible { outline-color: #fff; }

/* Going between pages, the portrait morphs from one oval into the other (Chrome/Edge; others just navigate) */
@view-transition { navigation: auto; }
.portrait img { view-transition-name: portrait; }
::view-transition-group(portrait) { animation-duration: .7s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }

/* Portrait: a tall oval like the 0 in Ant0nym, with a yellow ring behind that shifts on hover */
.portrait-link { display: block; text-decoration: none; color: inherit; text-align: center; }
.portrait-link .more { display: inline-block; margin-top: .9rem; font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--on-indigo); border-bottom: 2px solid var(--gold); padding-bottom: 2px; transition: transform .3s var(--ease); }
.portrait-link:hover .more { transform: translateX(4px); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3rem; align-items: center; }
.portrait { margin: 0; position: relative; width: clamp(13rem, 24vw, 17rem); text-align: center; }
.portrait::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 3 / 4;
  border-radius: 50%; border: 10px solid var(--gold);
  transform: translate(14px, 10px); transition: transform .5s var(--ease);
}
.portrait img {
  position: relative; display: block; width: 100%; height: auto; aspect-ratio: 3 / 4;
  object-fit: cover; object-position: 50% 25%;
  border-radius: 50%; border: 4px solid var(--gold);
  transition: transform .5s var(--ease);
}
.portrait:hover img { transform: translate(-6px, -4px) rotate(-3deg); }
.portrait:hover::before { transform: translate(20px, 14px) rotate(4deg); }
.portrait figcaption { margin-top: 1.75rem; font: 400 1.5rem/1.2 var(--serif); color: var(--on-indigo); }
.portrait figcaption span { display: block; margin-top: .35rem; font: 500 .75rem var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--gold); }
.portrait figcaption b { background: var(--gold); color: var(--indigo); border-radius: 999px; padding: 0 .3em; }
@media (max-width: 720px) {
  .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .portrait-link { order: -1; }
  .portrait { width: min(15rem, 70%); margin-inline: auto; }
}

/* Footer */
.site-footer {
  width: var(--wrap); margin: 0 auto; padding: 2rem 0 3rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font: 400 .8rem var(--mono); color: var(--muted);
}

/* Scroll reveal */
.motion .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s, transform .8s var(--ease); }
.motion .reveal.in { opacity: 1; transform: none; }

@media (max-width: 560px) {
  .header-right { gap: .8rem; }
  .site-header nav { gap: .75rem; }
  .site-header nav a { font-size: .68rem; letter-spacing: .03em; }
  .brand-light { display: none; }
  .section-head { grid-template-columns: 1fr; }
  .num { padding-top: 0; }
  .section-note { grid-column: 1; }
  .card { padding: 1.4rem; }
  .card h3 { font-size: 1.8rem; }
  .js .track { min-height: 33rem; }
  .motion .story-dots { right: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before { animation: none !important; transition: none !important; }
}
