/* Jack Sazonov – minimal typographic (Chiara Luzzana–inspired rhythm) */
:root {
  --bg: #070707;
  --text: #ebe6df;
  --text-muted: rgba(235, 230, 223, 0.5);
  --line: rgba(235, 230, 223, 0.14);
  --line-strong: rgba(235, 230, 223, 0.28);
  --font-display: "Cormorant Garamond", "Georgia", serif;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --space: 1.5rem;
  --transition: 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  --scrollbar-thumb: #000000;
  --scrollbar-thumb-hover: #1c1c1c;
}

/* Scrollbars — black thumb, track aligned with page background (incl. playlist drawer) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--bg);
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: var(--bg);
}
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.has-audio-player {
  padding-bottom: 7.5rem;
}

@media (max-width: 640px) {
  body.has-audio-player { padding-bottom: 9rem; }
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2.75rem, 10vw, 5.5rem); line-height: 1.02; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition), color var(--transition);
}
a:hover { opacity: 0.72; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  padding: var(--space) clamp(1.25rem, 4vw, 2.5rem);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  transition: background var(--transition), border-color var(--transition);
}
.site-header.scrolled {
  background: rgba(7, 7, 7, 0.88);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.nav-links {
  display: flex;
  align-items: baseline;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}
.nav-links a {
  font-size: 0.78rem;
  text-transform: lowercase;
  letter-spacing: 0.14em;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}
.nav-roman {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0;
  opacity: 0.85;
  font-variant-numeric: lining-nums;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle span { display: block; width: 22px; height: 1px; background: currentColor; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .menu-toggle { display: flex; }
}

/* Menu overlay — must stack above .site-header (z-index 100) so close works and burger is covered */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.menu-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.menu-nav { display: flex; flex-direction: column; align-items: center; gap: 1.75rem; }
.menu-nav a {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.menu-social {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}
.menu-social a { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.menu-close {
  position: absolute;
  top: var(--space);
  right: clamp(1.25rem, 4vw, 2.5rem);
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Main */
main { padding-top: 5.5rem; min-height: 100vh; }

/* Home hero – panoramic sphere + depth displacement (three.js panorama_depth pattern) */
.home-hero {
  position: relative;
  min-height: min(88vh, 52rem);
  overflow: clip;
}
.hero-pano-host {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.hero-pano-host.hero-pano-ready {
  opacity: 1;
}
.hero-pano-host canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.home-hero .hero-typo {
  position: relative;
  z-index: 1;
}

/* Typographic hero */
.hero-typo {
  padding: clamp(3rem, 12vw, 7rem) clamp(1.25rem, 4vw, 2.5rem) clamp(4rem, 14vw, 8rem);
  max-width: 52rem;
  margin: 0 auto;
}
.home-hero .hero-lines .line {
  text-shadow: 0 0.12em 0.85em rgba(7, 7, 7, 0.92), 0 0 2.5rem rgba(7, 7, 7, 0.65);
}
.home-hero .hero-lines .line-muted {
  text-shadow: 0 0.12em 0.85em rgba(7, 7, 7, 0.88);
}
.home-hero .hero-lede {
  text-shadow: 0 0.08em 0.65em rgba(7, 7, 7, 0.85);
}
.hero-lines { margin: 0; }
.hero-lines .line {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 11vw, 6.25rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 400;
}
.hero-lines .line-muted {
  color: var(--text-muted);
  font-size: clamp(1.5rem, 5vw, 2.75rem);
  line-height: 1.15;
  margin-top: 0.35em;
}
.hero-lede {
  margin: clamp(2rem, 6vw, 3.5rem) 0 0;
  max-width: 28rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.65;
}

/* Index – work list */
.work-block {
  padding: 0 clamp(1.25rem, 4vw, 2.5rem) clamp(2rem, 6vw, 3rem);
  border-top: 1px solid var(--line);
}
.work-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1.5rem;
  padding: 2.5rem 0 2rem;
}
.work-block-head h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.work-list li { border-bottom: 1px solid var(--line); }
.work-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem 2rem;
  align-items: baseline;
  padding: 1.75rem 0;
  transition: background var(--transition);
}
@media (min-width: 640px) {
  .work-list a { padding: 2rem 1.25rem; margin: 0 -1.25rem; }
  .work-list a:hover { background: rgba(235, 230, 223, 0.03); }
}
.work-num {
  font-family: var(--font-display);
  font-size: 1.15rem;
  opacity: 0.7;
  min-width: 2.5rem;
}
.work-title { font-family: var(--font-display); font-size: clamp(1.35rem, 3vw, 1.85rem); }
.work-meta { font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted); text-align: right; }

/* Footer */
.site-footer {
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 4vw, 2.5rem) 2rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1.5rem;
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-transform: lowercase;
  letter-spacing: 0.06em;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.footer-legal a { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  font-size: 0.78rem;
}
.footer-social a { color: var(--text-muted); letter-spacing: 0.06em; }
.footer-copy { margin: 0; font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.04em; }

.to-top {
  position: fixed;
  bottom: 2rem;
  right: clamp(1.25rem, 4vw, 2.5rem);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 90;
}
body.has-audio-player .to-top { bottom: 6.5rem; }
.to-top.visible { opacity: 1; pointer-events: auto; }

/* Fixed music player */
.site-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  background: rgba(7, 7, 7, 0.94);
  border-top: 1px solid var(--line-strong);
  backdrop-filter: blur(16px) saturate(140%);
  transition: transform 0.4s ease, opacity 0.4s ease;
}
.site-player.is-hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}
.site-player-inner {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem clamp(1.25rem, 4vw, 2.5rem) 1.25rem;
}
.site-player-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-player-row-controls {
  margin-top: 0.65rem;
  align-items: center;
  gap: 1.25rem;
}
.site-player-step {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: border-color var(--transition), background var(--transition);
}
.site-player-step:hover { border-color: var(--text-muted); background: rgba(235, 230, 223, 0.04); }
.site-player-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.site-player-label {
  font-size: 0.65rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.site-player-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.8vw, 1.45rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-player-play {
  flex-shrink: 0;
  padding: 0.55rem 1.35rem;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.site-player-play:hover { background: rgba(235, 230, 223, 0.06); border-color: var(--text-muted); }
.site-player-progress-host {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.site-player-progress {
  height: 3px;
  background: var(--line);
  cursor: pointer;
  position: relative;
}
.site-player-progress:focus-visible {
  outline: 1px solid var(--text-muted);
  outline-offset: 4px;
}
.site-player-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--text);
  pointer-events: none;
}
.site-player-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.site-player-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
  align-items: center;
}
.site-player-playlist-btn {
  flex-shrink: 0;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.site-player-playlist-btn:hover {
  background: rgba(235, 230, 223, 0.06);
  border-color: var(--text-muted);
}

.site-player-playlist-drawer {
  border-bottom: 1px solid var(--line);
  margin: 0 0 0.75rem;
  min-height: 0;
}
.site-player-playlist-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: min(40vh, 14rem);
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
.site-player-playlist-item { margin: 0; }
.site-player-playlist-track {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.25rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--transition);
}
.site-player-playlist-item.is-current {
  background: rgba(235, 230, 223, 0.06);
}
.site-player-playlist-item.is-current .site-player-playlist-track {
  color: var(--text);
}
.site-player-playlist-track:hover {
  background: rgba(235, 230, 223, 0.04);
}

#playerAudio {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .site-player-row-controls { flex-direction: column; align-items: stretch; }
  .site-player-actions { width: 100%; }
  .site-player-actions .site-player-play,
  .site-player-actions .site-player-playlist-btn { flex: 1; min-width: 0; }
}

/* Page hero */
.page-hero {
  padding: clamp(3rem, 10vw, 5rem) clamp(1.25rem, 4vw, 2.5rem) 2rem;
  max-width: 42rem;
  margin: 0 auto;
}
.page-hero h1 { margin: 0 0 0.75rem; }
.page-hero p { color: var(--text-muted); margin: 0; }

/* Article */
.page-article { padding: 0 clamp(1.25rem, 4vw, 2.5rem) clamp(4rem, 12vw, 6rem); }
.page-article article { max-width: 38rem; margin: 0 auto; }
.article-header { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.article-header h1 { margin: 0 0 0.75rem; }
.article-header time, .read-time { font-size: 0.8rem; color: var(--text-muted); letter-spacing: 0.06em; }
.read-time::before { content: '· '; }
.article-body { font-size: 1.02rem; color: rgba(235, 230, 223, 0.88); }
.article-body h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.35rem;
}
.article-body p { margin: 0 0 1.1rem; }
.article-body strong { color: var(--text); font-weight: 500; }

/* About – organic glass blob + glitch (three.js + CSS) */
.about-hero {
  position: relative;
  min-height: min(78vh, 44rem);
  overflow: clip;
  perspective: 1400px;
}
.about-glass-host {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 1s ease, transform 0.6s ease;
  transform-style: preserve-3d;
  transform: translateZ(0);
  touch-action: manipulation;
}
.about-glass-host.about-glass-ready {
  opacity: 1;
}
.about-glass-host::before,
.about-glass-host::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.about-glass-host::before {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(180, 220, 255, 0.04) 2px,
    rgba(180, 220, 255, 0.04) 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.55;
  animation: about-glitch-scan 7s linear infinite;
}
.about-glass-host::after {
  opacity: 0;
  mix-blend-mode: screen;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 80, 160, 0.07) 50%,
    transparent 60%
  );
  animation: about-glitch-flicker 5s steps(3, end) infinite;
}
.about-glass-host.about-glass-hover {
  transform: scale3d(1.015, 1.015, 1) translateZ(12px);
}
.about-glass-host.about-glass-hover::after {
  animation-duration: 0.12s;
}
.about-glass-host.about-glass-hover canvas {
  filter:
    drop-shadow(3px 0 0 rgba(255, 60, 140, 0.22))
    drop-shadow(-3px 0 0 rgba(60, 220, 255, 0.18));
}
.about-glass-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  transition: filter 0.35s ease;
}
@keyframes about-glitch-scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(6px); }
}
@keyframes about-glitch-flicker {
  0%, 88%, 100% { opacity: 0; transform: translateX(0); }
  89% { opacity: 0.5; transform: translateX(-3px); }
  90% { opacity: 0.35; transform: translateX(4px); }
  91% { opacity: 0.6; transform: translateX(-2px); }
}
.about-glass-host.about-glass-hover::before {
  animation-duration: 2.8s;
  opacity: 0.72;
}
.about-hero-copy {
  position: relative;
  z-index: 1;
  min-height: min(78vh, 44rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem) clamp(2rem, 6vw, 3.5rem);
  pointer-events: none;
}
.about-hero .page-hero {
  max-width: 42rem;
  margin: 0;
  padding: clamp(1.5rem, 4vw, 2.25rem) 0 0;
  pointer-events: auto;
  background: linear-gradient(
    to top,
    rgba(7, 7, 7, 0.94) 0%,
    rgba(7, 7, 7, 0.45) 50%,
    transparent 100%
  );
}
.about-glass-hint {
  margin: 0 0 0.65rem;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.about-hero:has(.about-glass-host:hover) .about-glass-hint {
  color: rgba(235, 220, 255, 0.75);
  text-shadow:
    0.06em 0 0 rgba(255, 100, 180, 0.45),
    -0.06em 0 0 rgba(100, 220, 255, 0.4);
  animation: about-hint-glitch 3.2s steps(2, end) infinite;
}
@keyframes about-hint-glitch {
  0%, 92%, 100% { transform: translateX(0); }
  93% { transform: translateX(-1px); }
  94% { transform: translateX(2px); }
  95% { transform: translateX(-1px); }
}

/* About */
.page-about .page-hero { padding-bottom: 3rem; }
.about-names {
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}
.about-bio { margin: 0; color: rgba(235, 230, 223, 0.82); line-height: 1.65; }
