:root {
  --accent: #5b8def;
  --bg: #070a12;
  --text: #eef0f4;
  --text-muted: #aeb6c4;
  --text-faint: #8189a0;
  --panel: #0c1322;
  --border-faint: rgba(255, 255, 255, 0.08);
  --border-row: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Spectral', serif;
  min-height: 100vh;
}

input::placeholder {
  color: #5b647c;
}

@keyframes kh-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes kh-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes kh-rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}

@keyframes kh-cue {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(9px); opacity: 1; }
}

.kh-link {
  transition: color 0.2s;
}

.kh-link:hover {
  color: var(--text) !important;
}

.kh-btn {
  transition: filter 0.2s;
}

.kh-btn:hover {
  filter: brightness(1.08);
}

.kh-ghost {
  transition: border-color 0.2s, color 0.2s;
}

.kh-ghost:hover {
  border-color: rgba(255, 255, 255, 0.6) !important;
  color: var(--text) !important;
}

.kh-row {
  position: relative;
  transition: background 0.2s;
}

.kh-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.kh-row:hover .kh-tix {
  color: var(--text) !important;
  border-color: var(--text) !important;
}

.kh-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent);
  transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.kh-row:hover::before {
  width: 3px;
}

.kh-rowin {
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.kh-row:hover .kh-rowin {
  transform: translateX(10px);
}

.kh-gimg {
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.4s;
}

.kh-gcell:hover .kh-gimg {
  transform: scale(1.06);
  filter: none;
}

.kh-strip-item {
  flex: 1 1 0;
  min-width: 0;
  transition: flex-grow 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.kh-strip-item:hover {
  flex-grow: 2.6;
}

.kh-reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.kh-reveal.kh-in {
  opacity: 1;
  transform: none;
}

.kh-rule {
  width: 54px;
  height: 1px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* Must match the fixed Header height in components/Header.tsx so anchor
   jumps land the section flush under the header — any smaller value leaves
   a strip of the previous section visible above the target. */
#home,
#afisha,
#gallery,
#recordings,
#about,
#contacts {
  scroll-margin-top: 78px;
}

/* --- Mobile (<=768px) --- */
@media (max-width: 768px) {
  /* Section content wrappers shrink horizontal padding so 320–480px viewports
     don't squeeze the body copy against the edges. */
  .kh-section { padding: 48px 22px 64px !important; }
  .kh-section-head { padding: 48px 22px 8px !important; }
  .kh-gallery-head { padding: 60px 22px 24px !important; }
  .kh-gallery-body { padding: 14px 22px 80px !important; }
  .kh-achievements-wrap { padding: 60px 22px 72px !important; }
  .kh-footer-inner { padding: 48px 22px 40px !important; gap: 24px !important; }

  /* Hero: fixed bg jitters on iOS Safari; let the bg scroll with content.
     Trim the bottom-anchored padding so CTAs sit inside the viewport. */
  .kh-hero-bg { background-attachment: scroll !important; }
  .kh-hero-inner { padding: 0 22px !important; bottom: 36px !important; }
  .kh-hero-title { white-space: normal !important; }
  .kh-hero-cta { gap: 10px !important; }
  .kh-hero-cta a { padding: 13px 20px !important; font-size: 12px !important; letter-spacing: 1.2px !important; }

  /* Header: 5 nav items at 28px gap overflow narrow screens. Tighten + shrink. */
  #kh-nav-bar { padding: 12px 16px !important; }
  .kh-nav-items { gap: 14px !important; font-size: 12px !important; flex-wrap: wrap !important; justify-content: center !important; }

  /* About: 2-col splits collapse to single column, swap order so image follows text. */
  .kh-split { grid-template-columns: 1fr !important; }
  .kh-split--reverse .kh-split-image { order: 2; }
  .kh-split-panel { padding: 56px 22px !important; }
  .kh-split-image { min-height: 320px !important; }
  .kh-panel-title { font-size: 36px !important; }

  /* Achievements: 3-col → stack. Year glyph scales down to keep one line. */
  .kh-achievements { grid-template-columns: 1fr !important; gap: 36px !important; }
  .kh-achievement-year { font-size: 46px !important; }

  /* Gallery strip: horizontal flex with hover-grow becomes a vertical stack;
     fixed 380px height looks comical on phones. */
  .kh-gallery-strip { flex-direction: column !important; height: auto !important; gap: 6px !important; }
  .kh-gallery-strip > * { min-height: 180px !important; }
  .kh-strip-item:hover { flex-grow: 1 !important; }
}

/* --- Phone (<=480px) extra trims --- */
@media (max-width: 480px) {
  .kh-nav-items { gap: 10px !important; font-size: 11px !important; }
  .kh-hero-inner { bottom: 28px !important; }
  .kh-hero-cta { flex-direction: column !important; width: 100% !important; }
  .kh-hero-cta a { width: 100% !important; justify-content: center !important; }
}
