/* ------------------------------------------------------------------
   Kseniya Galper — Paintings
   Flat text layer over a 3D stage. Text is plain white; a soft
   vignette on the stage keeps it legible over any room.
   ------------------------------------------------------------------ */

:root {
  --font: 'Inter Tight', 'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --fg: #fff;
  --bg: #000;
  --gutter: clamp(16px, 3.2vw, 48px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --track: 0.28em;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; height: 100dvh; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  background: #000;
}

/* Visually hidden but rendered so iOS Safari never throttles live webcam decoding */
.cam-feed {
  position: fixed;
  left: -10px;
  top: -10px;
  width: 1px;
  height: 1px;
  opacity: 0.001;
  pointer-events: none;
}

#vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    linear-gradient(to top, rgba(0,0,0,0.42), rgba(0,0,0,0) 26%),
    linear-gradient(to bottom, rgba(0,0,0,0.30), rgba(0,0,0,0) 18%),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 58%, rgba(0,0,0,0.28) 100%);
}

#veil {
  position: fixed; inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

/* ---------- UI chrome ---------- */
.ui {
  position: fixed;
  z-index: 10;
  color: var(--fg);
  text-shadow: 0 1px 2px rgba(0,0,0,0.45), 0 0 24px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.8s var(--ease);
  pointer-events: none;
}
body.ready .ui { opacity: 1; }
.ui a, .ui button { pointer-events: auto; }

.ui a, .ui button, .link {
  color: inherit;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.ui-top {
  top: calc(var(--gutter) + var(--safe-t));
  left: calc(var(--gutter) + var(--safe-l));
  right: calc(var(--gutter) + var(--safe-r));
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; font-weight: 500;
}
.wordmark { white-space: nowrap; }
.topnav { display: flex; gap: clamp(1.2em, 2.2em, 2.4em); }
.link { position: relative; }
.link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.link:hover::after, .link:focus-visible::after { transform: scaleX(1); }

.ui-side {
  top: 50%; transform: translateY(-50%);
  font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; font-weight: 500;
}
.ui-side-left { left: calc(var(--gutter) + var(--safe-l)); }
.ui-side-right { right: calc(var(--gutter) + var(--safe-r)); }
.arrow {
  display: inline-flex; align-items: center; gap: 0.9em;
  padding: 1.2em 0.4em;
  opacity: 0.7; transition: opacity 0.3s var(--ease), transform 0.5s var(--ease);
}
.arrow:hover, .arrow:focus-visible { opacity: 1; }
.ui-side-right .arrow:hover { transform: translateX(4px); }
.ui-side-left .arrow:hover { transform: translateX(-4px); }
.arrow-glyph { font-size: 18px; font-weight: 200; line-height: 1; }
.arrow-text { display: none; }
@media (min-width: 720px) { .arrow-text { display: inline; } }

.ui-bottom {
  left: calc(var(--gutter) + var(--safe-l));
  right: calc(var(--gutter) + var(--safe-r));
  bottom: calc(var(--gutter) + var(--safe-b));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: clamp(12px, 2vw, 24px);
}

.caption { min-width: 0; }
.index {
  font-size: clamp(56px, 9vw, 128px);
  font-weight: 200;
  line-height: 0.85;
  letter-spacing: -0.04em;
  margin-bottom: 0.18em;
  font-variant-numeric: tabular-nums;
}
.index .of {
  font-size: 0.18em; font-weight: 400; letter-spacing: 0.12em;
  vertical-align: top; margin-left: 0.6em; position: relative; top: 0.2em;
  opacity: 0.75;
}
.title {
  margin: 0;
  font-size: 13px; font-weight: 500; letter-spacing: var(--track); text-transform: uppercase;
}
.meta {
  margin: 0.55em 0 0;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.7;
}

.caption > * { transition: opacity 0.5s var(--ease), transform 0.6s var(--ease); }
body.switching .caption > * { opacity: 0; transform: translateY(6px); }

.dots {
  list-style: none; margin: 0 0 6px; padding: 0;
  display: flex; gap: 6px; align-self: end;
}
.dots li { width: 22px; height: 13px; background: currentColor; opacity: 0.35; transition: opacity 0.3s, transform 0.4s var(--ease); pointer-events: auto; cursor: pointer; padding: 6px 0; background-clip: content-box; }
.dots li.on { opacity: 1; transform: scaleY(2); }
.dots li { position: relative; }
.dots li button { position: absolute; inset: -8px 0; width: 100%; }
.tracking-controls { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.tracking-actions { display: flex; align-items: center; gap: 16px; }
.ui .recenter[hidden] { display: none; }
.ui .recenter { font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; opacity: 0.6; }
.ui .recenter:hover { opacity: 1; }
@media (max-width: 719px) {
  .dots { display: none; }
  .ui-bottom { grid-template-columns: 1fr auto; }
  .index { font-size: clamp(44px, 12vw, 72px); }
  .hint { bottom: auto; top: calc(var(--gutter) + var(--safe-t) + 42px); }
  .ui .status, .ui .recenter { padding: 8px 0; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .index { font-size: clamp(36px, 8vh, 56px); }
  .dots { display: none; }
  .ui-bottom { grid-template-columns: 1fr auto; }
  .hint { top: auto; bottom: calc(var(--gutter) + var(--safe-b) + 8px); font-size: 10px; }
}

.ui .status {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 0.8em;
  font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; font-weight: 500;
  opacity: 0.75; padding: 6px 0;
}
.status:hover { opacity: 1; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid currentColor; }
.status.on .dot { background: currentColor; animation: pulse 2.4s infinite; }
.status.busy .dot { animation: blink 0.9s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 2px rgba(255,255,255,0.15);} 50% { box-shadow: 0 0 0 6px rgba(255,255,255,0.0);} }
@keyframes blink { 50% { opacity: 0.2; } }

.hint {
  left: 50%; transform: translateX(-50%); bottom: calc(var(--gutter) + 56px);
  margin: 0; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0; transition: opacity 0.6s var(--ease);
  width: min(86vw, 560px); text-align: center; line-height: 1.5;
}
body.ready .hint.show { opacity: 0.8; }

/* ---------- Panels (landing / about) ---------- */
.panel {
  position: fixed; inset: 0; z-index: 20;
  background: #000;
  color: #fff;
  display: grid; place-items: center;
  padding: var(--gutter);
  overflow: auto;
  transition: opacity 0.9s var(--ease), visibility 0s linear 0.9s;
}
.panel[hidden] { display: none; }
.panel.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.about { background: rgba(0,0,0,0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

.landing-inner, .about-inner { max-width: 720px; width: 100%; }

.eyebrow {
  margin: 0 0 1.6em;
  font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; font-weight: 500; opacity: 0.7;
}
.display {
  margin: 0 0 0.35em;
  font-size: clamp(64px, 13vw, 168px);
  font-weight: 200;
  line-height: 0.88;
  letter-spacing: -0.045em;
}
.display.sm { font-size: clamp(44px, 7vw, 88px); }
.lede, .about-body {
  max-width: 52ch;
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.5;
  font-weight: 300;
  margin: 0 0 1.4em;
}
.about-text p { max-width: 58ch; font-size: clamp(15px, 1.4vw, 18px); line-height: 1.55; font-weight: 300; margin: 0 0 1.2em; }
.keys { opacity: 0.7; font-size: 13px; }
kbd { font: inherit; border: 1px solid rgba(255,255,255,0.35); padding: 0 0.5em; border-radius: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 2.2em 0 1.4em; }
.btn {
  font: inherit; font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; font-weight: 500;
  color: #fff; background: transparent; border: 1px solid rgba(255,255,255,0.55);
  padding: 1.25em 2.2em; cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s;
}
.btn:hover, .btn:focus-visible { border-color: #fff; }
.btn-solid { background: #fff; color: #000; border-color: #fff; }
.btn-solid:hover { background: transparent; color: #fff; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.fine { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.5; margin: 0; }

.close {
  position: fixed;
  top: calc(var(--gutter) + var(--safe-t));
  right: calc(var(--gutter) + var(--safe-r));
  font: inherit; font-size: 11px; letter-spacing: var(--track); text-transform: uppercase; font-weight: 500;
  color: #fff; background: none; border: 0; cursor: pointer; padding: 6px 0;
}

/* ---------- Motion / a11y ---------- */
@media (prefers-reduced-motion: reduce) {
  .ui, .panel, .caption > *, .arrow { transition: none; }
}
:focus-visible { outline: 1px solid #fff; outline-offset: 4px; }
