/* ========================================
   LIQUID MORPHOLOGY — Split Frame Layout
   ======================================== */

:root {
  /* Typography */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-mono: "DM Mono", "SF Mono", monospace;

  /* Colors */
  --color-bg: #0a0a0a;
  --color-sidebar: #0f0f0f;
  --color-text: #e8e8e8;
  --color-text-muted: rgba(232, 232, 232, 0.45);
  --color-text-dim: rgba(232, 232, 232, 0.2);
  --color-border: rgba(232, 232, 232, 0.08);
  --color-dot-active: #e8e8e8;
  --color-dot-inactive: rgba(232, 232, 232, 0.2);

  /* Layout */
  --sidebar-width: 280px;
  --spacing-lg: 40px;
  --spacing-md: 24px;
  --spacing-sm: 16px;
  --spacing-xs: 8px;
}

/* ========================================
   RESET & BASE
   ======================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-mono);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* ========================================
   LAYOUT — Overlay Frame
   ======================================== */

.layout {
  position: relative;
  width: 100vw;
  height: 100vh;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.layout.loaded {
  opacity: 1;
}

/* ========================================
   VISUAL FRAME
   ======================================== */

.visual-frame {
  position: absolute;
  inset: 0;
  background: var(--color-bg);
  cursor: pointer;
  overflow: hidden;
}

.webgl-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================
   SIDEBAR — Frosted Glass Overlay
   ======================================== */

.sidebar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(32px) saturate(1.4);
  -webkit-backdrop-filter: blur(32px) saturate(1.4);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow: hidden;

  /* Override colors for light surface */
  --color-text: rgba(0, 0, 0, 0.85);
  --color-text-muted: rgba(0, 0, 0, 0.5);
  --color-text-dim: rgba(0, 0, 0, 0.25);
  --color-border: rgba(0, 0, 0, 0.1);
  --color-dot-active: rgba(0, 0, 0, 0.8);
  --color-dot-inactive: rgba(0, 0, 0, 0.2);
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-lg) var(--spacing-md);
  min-height: 0;
  overflow: hidden;
}

/* ========================================
   TITLE BLOCK
   ======================================== */

.title-block {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  flex-shrink: 0;
}

.slide-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  transition: opacity 0.4s ease;
}

.slide-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-top: var(--spacing-xs);
}

/* ========================================
   NAVIGATION BLOCK
   ======================================== */

/* ========================================
   NAVIGATION OVERLAY - Circular Progress
   ======================================== */

.nav-overlay {
  position: absolute;
  bottom: var(--spacing-lg);
  right: calc(var(--sidebar-width) + var(--spacing-lg));
  z-index: 5;
}

.progress-ring-container {
  position: relative;
  width: 52px;
  height: 52px;
  cursor: pointer;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 5;
}

.progress-ring-fill {
  fill: none;
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 163.36;
  transition: stroke-dashoffset 0.05s linear;
}

.progress-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
}

.progress-ring-text .nav-current {
  color: rgba(255, 255, 255, 0.95);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.progress-ring-text .nav-separator {
  color: rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.progress-ring-text .nav-total {
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ========================================
   SIDEBAR FOOTER
   ======================================== */

/* ========================================
   LOGO BADGE
   ======================================== */

.logo-badge {
  position: absolute;
  top: var(--spacing-lg);
  left: var(--spacing-lg);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.logo-badge:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.15);
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.9);
}

.logo-separator {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   HINT OVERLAY
   ======================================== */

.hint-overlay {
  position: absolute;
  bottom: var(--spacing-lg);
  left: var(--spacing-lg);
  z-index: 5;
  pointer-events: none;
  height: 52px;
  display: flex;
  align-items: center;
}

.hint {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: color 0.3s ease;
}

.visual-frame:hover ~ .hint-overlay .hint {
  color: rgba(255, 255, 255, 0.7);
}

/* ========================================
   CONTROLS BLOCK
   ======================================== */

.controls-block {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: var(--spacing-md) calc(-1 * var(--spacing-md));
  padding: 0 var(--spacing-md);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.controls-block::-webkit-scrollbar {
  display: none;
}

/* ========================================
   CUSTOM CONTROLS
   ======================================== */

.control-section {
  padding: 14px 0;
  position: relative;
}

.control-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: calc(-1 * var(--spacing-md));
  right: calc(-1 * var(--spacing-md));
  height: 1px;
  background: rgba(0, 0, 0, 0.05);
}

.control-section:first-child {
  padding-top: 0;
}

.control-section:last-child::after {
  display: none;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

/* Pill buttons */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.pill.active {
  background: var(--color-text);
  border-color: var(--color-text);
  color: rgba(255, 255, 255, 0.95);
}

.btn-random {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  border: 1px dashed var(--color-border);
  border-radius: 100px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  margin-top: 4px;
}

.btn-random:hover {
  border-style: solid;
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

/* Slider rows */
.slider-row {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.slider-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: var(--color-text);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s ease;
  transform: rotate(45deg);
}

.slider::-webkit-slider-thumb:hover {
  transform: rotate(45deg) scale(1.15);
}

.slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: var(--color-text);
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transform: rotate(45deg);
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  text-align: right;
}

/* Effect-specific controls */
.effect-controls {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   MOBILE TOGGLE BUTTON
   ======================================== */

.sidebar-toggle {
  display: none;
  position: absolute;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 15;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: rgba(0, 0, 0, 0.6);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  z-index: 20;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar-close:hover {
  background: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.8);
}

.sidebar-close svg {
  width: 18px;
  height: 18px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --spacing-lg: 24px;
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-close {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-left: none;
    border-top: none;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .sidebar-content {
    padding: var(--spacing-lg);
    padding-top: 60px;
    height: 100%;
    overflow-y: auto;
  }

  .title-block {
    flex-direction: column;
    align-items: flex-start;
  }

  .slide-title {
    font-size: 28px;
  }

  .slide-subtitle {
    display: block;
  }

  .controls-block {
    margin: var(--spacing-md) 0;
    max-height: none;
    flex: 1;
    overflow-y: auto;
  }

  .nav-overlay {
    bottom: calc(var(--spacing-lg) + 60px);
    right: var(--spacing-lg);
  }

  .hint-overlay {
    display: none;
  }

  .logo-badge {
    top: var(--spacing-md);
    left: var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .slide-title {
    font-size: 24px;
  }

  .sidebar-content {
    padding: var(--spacing-md);
    padding-top: 56px;
  }

  .logo-badge {
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    padding: 8px 12px;
  }

  .logo-text {
    font-size: 10px;
  }
}

/* ========================================
   PRELOADER
   ======================================== */

.preloader {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10000;
  transition: opacity 0.6s ease;
}

.preloader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.preloader-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.preloader-bar {
  width: 120px;
  height: 1px;
  background: var(--color-border);
  overflow: hidden;
}

.preloader-progress {
  height: 100%;
  width: 0%;
  background: var(--color-text-muted);
  transition: width 0.1s linear;
}
