/* ==========================================================
   AKSHAY KRISHNA SIRIGANA — cinematic scenes
   A pinned point field morphs from scene to scene while each
   scene's words arrive line by line. Colours are set per scene
   by script.js; the values below are the opening scene.
   ========================================================== */

@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-var.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }

:root {
  --bg: #ECE8DF;
  --fg: #171614;
  --panel: #F7F4EE;
  --panel-fg: #171614;
  --panel-2: #5C5850;
  --panel-rule: #DDD8CD;
  --sq-light: #8F8A7C;
  --sq-dark: #6C675B;
  --pc-light: #F7F5F0;
  --pc-dark: #161715;
  --sq-sel: #1B6A4E;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .15, 1);
  --gut: clamp(20px, 5vw, 72px);
  color-scheme: light;
}
html[data-theme="ink"] {
  --bg: #111110;
  --fg: #EDE9E0;
  --panel: #1A1918;
  --panel-fg: #EDE9E0;
  --panel-2: #A7A298;
  --panel-rule: #302E2B;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 11px; height: 11px; display: inline-block; flex: none; }

/* ---------- the field ---------- */
#field { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
html.rm #field, html:not(.js) #field { display: none; }

/* ---------- header ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--gut);
  color: var(--fg);
}
.name { font-family: var(--serif); font-size: 24px; line-height: 1; text-decoration: none; white-space: nowrap; }
.top-r { display: flex; align-items: center; gap: 10px; }
#factsBtn .sm { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border: 1px solid currentColor; border-radius: 999px; background: transparent;
  font-family: var(--sans); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.pill:hover { background: var(--fg); color: var(--bg); }
.pill.solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pill.solid:hover { background: transparent; color: var(--fg); }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid currentColor; background: transparent; display: grid; place-items: center; cursor: pointer; transition: transform .6s var(--ease); }
.icon-btn:hover { transform: rotate(180deg); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .i-sun { display: none; }
html[data-theme="ink"] .icon-btn .i-sun { display: block; }
html[data-theme="ink"] .icon-btn .i-moon { display: none; }
@media (max-width: 640px) {
  .name { font-size: 19px; }
  #factsBtn .lg { display: none; }
  #factsBtn .sm { display: inline; }
  #factsBtn { padding: 0 12px; }
  .top-r .pill.solid { display: none; }
}

/* ---------- scenes ---------- */
.scene { position: relative; z-index: 1; height: 170vh; }
.pin {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; align-items: center;
  padding: 96px var(--gut) 64px;
}
.copy { max-width: 820px; }
.eyebrow, .kicker { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; letter-spacing: .01em; margin-bottom: 26px; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: currentColor; display: inline-block; }
.big {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(46px, 7.2vw, 124px); line-height: .98; letter-spacing: -.02em;
  text-wrap: balance;
}
.big .line { display: block; }
.big em { font-style: italic; }
.sub { margin-top: 28px; max-width: 34ch; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.45; }
.cue { position: absolute; left: var(--gut); bottom: 32px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.cue::after { content: ""; display: block; width: 1px; height: 40px; background: currentColor; margin-top: 10px; animation: cue 2.2s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform: scaleY(1); transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

.nums { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; column-gap: clamp(28px, 4vw, 64px); row-gap: 16px; margin-top: 40px; }
.nums dt { font-family: var(--serif); font-size: clamp(38px, 4.6vw, 72px); line-height: 1; letter-spacing: -.02em; }
.nums dd { margin-top: 6px; font-size: 14px; }
@media (max-width: 520px) { .nums { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; } }

.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 40px; }
.open {
  display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 24px;
  border-radius: 999px; border: 1px solid currentColor; background: transparent; cursor: pointer;
  font-size: 15px; font-weight: 500;
  transition: background-color .25s var(--ease), color .25s var(--ease), gap .3s var(--ease);
}
.open:hover { background: var(--fg); color: var(--bg); gap: 16px; }
.lnk { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 15px; font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.lnk:hover { text-decoration-thickness: 2px; }
.as-btn { background: none; border: 0; padding: 0; cursor: pointer; }

/* seven more */
.more { margin-top: 36px; border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent); max-width: 760px; }
.more li { border-bottom: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.more button {
  display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; width: 100%; padding: 14px 0;
  background: none; border: 0; text-align: left; cursor: pointer;
  transition: padding-left .4s var(--ease);
}
.more b { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 38px); line-height: 1.05; }
.more span { font-size: 15px; }
.more button:hover, .more button:focus-visible { padding-left: 14px; }
@media (max-width: 520px) { .more button { padding: 10px 0; gap: 2px 12px; } .more span { font-size: 14px; } }

/* contact */
.mail { margin-top: 36px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 20px; }
.mail a { font-family: var(--serif); font-size: clamp(30px, 4.4vw, 64px); line-height: 1.05; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 8px; overflow-wrap: anywhere; }
.mail a:hover { text-decoration-thickness: 2px; }

/* reveal: hidden until script.js brings each line in (only when motion is on) */
html.js:not(.rm) .rv { opacity: 0; will-change: opacity, transform; }

/* ---------- chess scene ---------- */
.scene-chess .pin { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: clamp(32px, 6vw, 96px); align-items: center; }
.chess-copy .big { font-size: clamp(56px, 8vw, 132px); }
.chess-status { margin-top: 28px; font-size: 18px; font-weight: 500; min-height: 1.5em; max-width: 30ch; }
.small-acts { margin-top: 16px; }
.rules { margin-top: 8px; font-size: 14px; max-width: 34ch; }
.board-wrap { width: min(520px, 40vw); }
.board-sq { position: relative; aspect-ratio: 1; width: 100%; border-radius: 6px; overflow: hidden; }
@media (max-width: 860px) {
  .scene-chess .pin { grid-template-columns: 1fr; align-content: center; row-gap: 20px; padding-top: 84px; }
  .scene-chess .big { font-size: clamp(44px, 12vw, 72px); }
  .scene-chess .kicker { margin-bottom: 12px; }
  .scene-chess .sub { margin-top: 12px; }
  .chess-status { margin-top: 12px; font-size: 16px; }
  .rules { display: none; }
  .board-wrap { width: min(88vw, 44vh, 420px); order: 2; }
}
.cb { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.cb-row, .cb-cell { display: contents; }
.cb-sq { position: relative; border: 0; margin: 0; padding: 0; background: var(--sq-light); cursor: default; border-radius: 0; }
.cb-sq.dark { background: var(--sq-dark); }
.cb.live .cb-sq { cursor: pointer; }
.cb-sq:focus-visible { outline: 3px solid var(--pc-light); outline-offset: -3px; box-shadow: inset 0 0 0 6px var(--pc-dark); border-radius: 0; z-index: 2; }
.cb-sq.cb-selected { background: var(--sq-sel); box-shadow: inset 0 0 0 3px var(--pc-light); }
.cb-sq.cb-last::before { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--pc-dark); pointer-events: none; }
.cb-sq.cb-target::after { content: ""; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: var(--pc-light); box-shadow: 0 0 0 2px var(--pc-dark); pointer-events: none; z-index: 3; }
.cb-sq.cb-cap::after { content: ""; position: absolute; inset: 7%; border: 3px solid var(--pc-light); border-radius: 50%; box-shadow: 0 0 0 2px var(--pc-dark), inset 0 0 0 2px var(--pc-dark); pointer-events: none; z-index: 3; }
.cb-pieces { position: absolute; inset: 0; pointer-events: none; }
.cb-piece { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; padding: 1.2%; transform: translate(calc(var(--f) * 100%), calc(var(--r) * 100%)); transition: transform 260ms var(--ease), opacity 120ms; z-index: 4; }
.cb-piece.cb-reply { transition-duration: 420ms, 120ms; }
.cb-piece.gone { opacity: 0; }
.cb-piece svg { width: 100%; height: 100%; overflow: visible; }
.cb-piece.w { --pc-fill: var(--pc-light); --pc-stroke: var(--pc-dark); --pc-slit: var(--pc-dark); }
.cb-piece.b { --pc-fill: var(--pc-dark); --pc-stroke: var(--pc-dark); --pc-slit: var(--pc-light); }
.pc { fill: var(--pc-fill); stroke: var(--pc-stroke); stroke-width: 1.5; stroke-linejoin: round; }
.pc-slit { fill: none; stroke: var(--pc-slit); stroke-width: 1.5; stroke-linecap: round; }
.pc-eye { fill: var(--pc-slit); }

/* ---------- footer ---------- */
.foot { position: relative; z-index: 1; padding: 40px var(--gut) 48px; font-size: 13px; display: grid; gap: 4px; }

/* ---------- drawers (case files + facts) ---------- */
dialog.drawer {
  margin: 0 0 0 auto; padding: 0; border: 0;
  width: min(600px, 100vw); max-width: 100vw; height: 100vh; height: 100dvh; max-height: none;
  background: var(--panel); color: var(--panel-fg);
  overflow-y: auto; overscroll-behavior: contain;
}
dialog.drawer[open] { animation: slideIn .55s var(--ease) both; }
dialog.drawer::backdrop { background: rgba(10, 10, 9, .45); animation: fadeIn .4s var(--ease) both; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
html:not(.js) dialog.drawer { display: block; position: static; width: auto; height: auto; margin: 0; }
.drawer-in { position: relative; padding: 72px clamp(24px, 5vw, 56px) 56px; }
.close { position: absolute; top: 20px; right: 20px; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--panel-rule); background: transparent; display: grid; place-items: center; cursor: pointer; }
.close svg { width: 16px; height: 16px; }
.close:hover { border-color: var(--panel-fg); }
.d-kick { font-size: 13px; color: var(--panel-2); }
.drawer h2 { margin-top: 10px; font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5vw, 60px); line-height: 1; letter-spacing: -.02em; }
.d-dek { margin-top: 16px; font-family: var(--serif); font-size: 24px; line-height: 1.25; }
.case, .facts { margin-top: 32px; border-top: 1px solid var(--panel-rule); }
.case > div, .facts > div { padding: 16px 0; border-bottom: 1px solid var(--panel-rule); }
.case dt, .facts dt { font-size: 13px; font-weight: 500; color: var(--panel-2); margin-bottom: 4px; }
.case dd, .facts dd { font-size: 16px; line-height: 1.55; }
.d-nums { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.d-nums span { font-size: 13px; font-weight: 500; border: 1px solid var(--panel-rule); border-radius: 999px; padding: 6px 12px; }
.d-stack { margin-top: 16px; font-size: 13px; color: var(--panel-2); line-height: 1.6; }
.d-links { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.drawer .pill { color: var(--panel-fg); }
.drawer .pill.solid { background: var(--panel-fg); color: var(--panel); border-color: var(--panel-fg); }
.tag { font-size: 13px; color: var(--panel-2); border: 1px dashed var(--panel-rule); border-radius: 999px; padding: 6px 12px; }

/* ---------- reduced motion / no script: plain stacked scenes ---------- */
html.rm .scene, html:not(.js) .scene { height: auto; min-height: 100vh; background: var(--scene-bg, transparent); color: var(--scene-fg, inherit); }
html.rm .pin, html:not(.js) .pin { position: relative; min-height: 100vh; height: auto; }
html.rm .cue, html:not(.js) .cue { display: none; }
html.rm .top, html:not(.js) .top { position: absolute; }
[tabindex="-1"]:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- chess controls ---------- */
.chess-ctl { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-top: 24px; }
.seg { display: inline-flex; padding: 3px; border: 1.5px solid currentColor; border-radius: 999px; }
.seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.seg.small button { min-height: 30px; padding: 0 11px; font-size: 13px; }
.cb-sq.cb-check { background: #B5483B; }
.cb-sq.dark.cb-check { background: #9C3A2F; }
@media (max-width: 860px) { .chess-ctl { margin-top: 14px; } .seg button { padding: 0 11px; } }
