/* Material You 3 Expressive Design System - Original Implementation */

:root {
  /* Core Palette - Vibrant Blues & Purples */
  --tone-royal: #5B4FC8;
  --tone-royal-nums: 91, 79, 200;
  --tone-ocean: #00A5BA;
  --tone-ocean-nums: 0, 165, 186;
  --tone-bloom: #C7358F;
  --tone-bloom-nums: 199, 53, 143;
  
  /* Background Layers */
  --layer-base: #FDFCFF;
  --layer-base-nums: 253, 252, 255;
  --layer-raised: #F5F3F9;
  --layer-elevated: #EDE9F2;
  --layer-sunken: #E6E1EB;
  
  /* Text Colors */
  --text-emphasis: #1C1A21;
  --text-subtle: #47454E;
  --text-muted: #79757F;
  
  /* Shape Tokens */
  --radius-tight: 10px;
  --radius-cozy: 18px;
  --radius-roomy: 26px;
  --radius-grand: 42px;
  --radius-infinite: 999px;
  
  /* Depth System */
  --depth-low: 0 1px 4px 0 rgba(28, 26, 33, 0.14);
  --depth-medium: 0 3px 8px 0 rgba(28, 26, 33, 0.18), 0 1px 3px 0 rgba(28, 26, 33, 0.12);
  --depth-high: 0 6px 16px 0 rgba(28, 26, 33, 0.22), 0 2px 6px 0 rgba(28, 26, 33, 0.16);
  --depth-extreme: 0 12px 28px 0 rgba(28, 26, 33, 0.28), 0 4px 10px 0 rgba(28, 26, 33, 0.20);
  
  /* Blur Effects */
  --haze-soft: 16px;
  --haze-moderate: 24px;
  --haze-strong: 36px;
}

[data-luminance="nocturnal"] {
  --tone-royal: #BFB3FF;
  --tone-royal-nums: 191, 179, 255;
  --tone-ocean: #5DDDEC;
  --tone-ocean-nums: 93, 221, 236;
  --tone-bloom: #F7A6CF;
  --tone-bloom-nums: 247, 166, 207;
  
  --layer-base: #131218;
  --layer-base-nums: 19, 18, 24;
  --layer-raised: #1F1D26;
  --layer-elevated: #28262F;
  --layer-sunken: #323038;
  
  --text-emphasis: #E8E4EC;
  --text-subtle: #C7C3CC;
  --text-muted: #A09DA6;
  
  --depth-low: 0 1px 4px 0 rgba(0, 0, 0, 0.35);
  --depth-medium: 0 3px 8px 0 rgba(0, 0, 0, 0.42), 0 1px 3px 0 rgba(0, 0, 0, 0.28);
  --depth-high: 0 6px 16px 0 rgba(0, 0, 0, 0.50), 0 2px 6px 0 rgba(0, 0, 0, 0.35);
  --depth-extreme: 0 12px 28px 0 rgba(0, 0, 0, 0.58), 0 4px 10px 0 rgba(0, 0, 0, 0.42);
}

/* Spring-based Motion System */
@keyframes breathe-gently {
  0%, 100% { 
    transform: scale(1);
    filter: drop-shadow(0 0 14px rgba(var(--tone-royal-nums), 0.45));
  }
  50% { 
    transform: scale(1.018);
    filter: drop-shadow(0 0 22px rgba(var(--tone-royal-nums), 0.65));
  }
}

@keyframes float-organic {
  0% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(22px, -16px) rotate(2deg); }
  66% { transform: translate(-18px, 28px) rotate(-2deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes entrance-spring {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ripple-expand {
  from {
    transform: scale(0);
    opacity: 0.5;
  }
  to {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes shimmer-slide {
  from { background-position: -180% center; }
  to { background-position: 180% center; }
}

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

body {
  font-family: 'SF Pro Display', 'Inter Variable', system-ui, -apple-system, sans-serif;
  background: var(--layer-base);
  background-image: 
    radial-gradient(ellipse at 18% 82%, rgba(var(--tone-royal-nums), 0.11) 0%, transparent 45%),
    radial-gradient(ellipse at 82% 18%, rgba(var(--tone-ocean-nums), 0.09) 0%, transparent 45%),
    radial-gradient(ellipse at 48% 52%, rgba(var(--tone-bloom-nums), 0.06) 0%, transparent 55%);
  color: var(--text-emphasis);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow-x: hidden;
  font-feature-settings: 'tnum';
  -webkit-font-smoothing: antialiased;
}

.zenith-wrapper {
  width: 100%;
  max-width: 580px;
  padding: 1.75rem 1.25rem;
  animation: entrance-spring 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Control Buttons */
.luminance-shifter {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 46px;
  height: 46px;
  border: none;
  background: var(--layer-elevated);
  backdrop-filter: blur(var(--haze-moderate));
  -webkit-backdrop-filter: blur(var(--haze-moderate));
  border-radius: var(--radius-infinite);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-emphasis);
  box-shadow: var(--depth-medium);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.28s ease-out;
  z-index: 100;
  overflow: hidden;
}

.luminance-shifter::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(var(--tone-royal-nums), 0.18) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.32s cubic-bezier(0.25, 0.8, 0.5, 1);
  border-radius: inherit;
}

.luminance-shifter:hover {
  transform: rotate(180deg) scale(1.12);
  box-shadow: var(--depth-high);
}

.luminance-shifter:hover::before {
  opacity: 1;
}

.luminance-shifter svg {
  position: relative;
  z-index: 1;
  width: 21px;
  height: 21px;
}

.realm-activator {
  position: fixed;
  top: 1.25rem;
  right: 4.75rem;
  width: 46px;
  height: 46px;
  border: none;
  background: var(--layer-elevated);
  backdrop-filter: blur(var(--haze-moderate));
  -webkit-backdrop-filter: blur(var(--haze-moderate));
  border-radius: var(--radius-roomy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-emphasis);
  box-shadow: var(--depth-medium);
  transition: all 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
  overflow: hidden;
}

.realm-activator::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(var(--tone-ocean-nums), 0.20) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 0.32s cubic-bezier(0.25, 0.8, 0.5, 1);
  border-radius: inherit;
}

.realm-activator:hover {
  transform: scale(1.1);
  box-shadow: var(--depth-high);
}

.realm-activator:hover::before {
  opacity: 1;
}

.realm-activator svg {
  position: relative;
  z-index: 1;
  width: 21px;
  height: 21px;
}

/* Navigation Tabs */
.voyage-selector {
  backdrop-filter: blur(var(--haze-strong));
  -webkit-backdrop-filter: blur(var(--haze-strong));
  background: var(--layer-raised);
  box-shadow: var(--depth-medium);
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
  margin-bottom: 1.75rem;
  padding: 0.875rem;
  border-radius: var(--radius-grand);
  position: relative;
  overflow: hidden;
}

.voyage-selector::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, 
    transparent 0%, 
    rgba(var(--tone-royal-nums), 0.04) 48%, 
    transparent 100%);
  background-size: 210% 100%;
  animation: shimmer-slide 5.5s linear infinite;
}

.voyage-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-cozy);
  font-weight: 650;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.voyage-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(var(--tone-royal-nums), 0.08);
  opacity: 0;
  transition: opacity 0.28s ease-out;
  border-radius: inherit;
}

.voyage-tab::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--tone-royal-nums), 0.28) 0%, transparent 68%);
  transform: scale(0);
  transition: transform 0.48s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.voyage-tab:hover::before {
  opacity: 1;
}

.voyage-tab:active::after {
  animation: ripple-expand 0.52s ease-out;
}

.voyage-tab--chosen {
  background: linear-gradient(128deg, #5B4FC8 0%, #7A6FD8 100%);
  color: white;
  box-shadow: var(--depth-medium);
  animation: breathe-gently 3.8s ease-in-out infinite;
}

.voyage-tab--chosen::before {
  display: none;
}

.voyage-tab svg {
  width: 23px;
  height: 23px;
  position: relative;
  z-index: 1;
}

/* Main Stage Container */
.horizon-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  padding: 1.75rem 1.375rem;
  background: var(--layer-raised);
  border-radius: var(--radius-grand);
  box-shadow: var(--depth-medium);
  backdrop-filter: blur(var(--haze-strong));
  -webkit-backdrop-filter: blur(var(--haze-strong));
  transition: all 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.horizon-stage::before {
  content: '';
  position: absolute;
  top: -55%;
  left: -55%;
  width: 210%;
  height: 210%;
  background: radial-gradient(circle, rgba(var(--tone-ocean-nums), 0.07) 0%, transparent 58%);
  animation: float-organic 28s ease-in-out infinite;
  pointer-events: none;
}

.horizon-stage.morphing {
  transform: perspective(950px) rotateX(2.5deg) scale(0.975);
  opacity: 0.72;
}

/* Hero Time Display */
.quantum-display {
  background: linear-gradient(132deg, var(--layer-elevated) 0%, var(--layer-sunken) 100%);
  padding: clamp(1.125rem, 3.5vw, 1.875rem) clamp(1.875rem, 5.5vw, 2.75rem);
  border-radius: var(--radius-roomy);
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.085), var(--depth-low);
  font-size: clamp(2.75rem, 7.5vw, 3.75rem);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  position: relative;
  backdrop-filter: blur(10px);
  letter-spacing: 0.025em;
  line-height: 1.15;
}

.quantum-display::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(132deg, transparent 0%, rgba(var(--tone-royal-nums), 0.09) 100%);
  pointer-events: none;
}

.flux-glyph {
  display: inline-flex;
  position: relative;
  width: 0.58em;
  height: 1.22em;
  overflow: hidden;
  background: rgba(var(--tone-royal-nums), 0.075);
  border-radius: var(--radius-tight);
  margin: 0 0.04em;
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.11);
}

.flux-cascade {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  transition: transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flux-cascade span {
  height: 1.22em;
  line-height: 1.22em;
  width: 100%;
  display: block;
}

.chrono-separator {
  font-size: clamp(2.75rem, 7.5vw, 3.75rem);
  opacity: 0.38;
  margin: 0 0.12em;
  display: inline-block;
  vertical-align: top;
  animation: breathe-gently 3.2s ease-in-out infinite;
  font-weight: 350;
}

/* Analog Clock Face */
.orbital-canvas {
  width: 268px;
  height: 268px;
  border-radius: 50%;
  position: relative;
  background: linear-gradient(132deg, var(--layer-elevated) 0%, var(--layer-sunken) 100%);
  box-shadow: var(--depth-medium), inset 0 1px 6px rgba(0, 0, 0, 0.06);
  transition: all 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: none;
  border: 9px solid var(--tone-royal);
}

.orbital-canvas:hover {
  transform: scale(1.048);
  box-shadow: var(--depth-high), inset 0 1px 6px rgba(0, 0, 0, 0.06);
}

.orbital-arm {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom center;
  border-radius: var(--radius-tight);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.orbital-arm--major {
  width: 5.5px;
  height: 25%;
  background: linear-gradient(180deg, var(--text-emphasis) 0%, rgba(var(--tone-royal-nums), 0.88) 100%);
  margin-left: -2.75px;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.24);
}

.orbital-arm--medial {
  width: 4.5px;
  height: 35%;
  background: linear-gradient(180deg, var(--text-subtle) 0%, rgba(var(--tone-ocean-nums), 0.82) 100%);
  margin-left: -2.25px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.19);
}

.orbital-arm--swift {
  width: 2.25px;
  height: 40%;
  background: var(--tone-bloom);
  margin-left: -1.125px;
  box-shadow: 0 0 9px rgba(var(--tone-bloom-nums), 0.58), 0 2px 4px rgba(0, 0, 0, 0.17);
  transition: transform 0.11s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.orbital-marker {
  position: absolute;
  width: 100%;
  height: 100%;
  text-align: center;
  transform-origin: center;
  font-weight: 720;
  font-size: 1.0625rem;
  color: var(--text-subtle);
}

/* Action Buttons */
.action-bay {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.4rem;
  justify-content: center;
}

.action-bay button {
  position: relative;
  background: linear-gradient(128deg, #5B4FC8 0%, #7A6FD8 100%);
  color: white;
  border: none;
  padding: 0.8125rem 1.875rem;
  border-radius: var(--radius-infinite);
  cursor: pointer;
  font-weight: 720;
  font-size: 0.90625rem;
  transition: all 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--depth-low);
  overflow: hidden;
  letter-spacing: 0.015em;
}

.action-bay button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(132deg, rgba(255, 255, 255, 0.22) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.5, 1);
}

.action-bay button:hover {
  transform: translateY(-2.5px) scale(1.035);
  box-shadow: var(--depth-high);
}

.action-bay button:hover::before {
  opacity: 1;
}

.action-bay button:active {
  transform: translateY(-1px) scale(1.018);
}

/* Timer Configuration */
.interval-configurator {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.interval-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.interval-segment label {
  font-size: 0.78125rem;
  color: var(--text-muted);
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: 0.035em;
}

.interval-input {
  background: var(--layer-elevated);
  color: var(--text-emphasis);
  border: 1.5px solid rgba(var(--tone-royal-nums), 0.28);
  padding: 0.5875rem 0.8125rem;
  border-radius: var(--radius-cozy);
  width: 4.875rem;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 720;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.interval-input:focus {
  outline: none;
  border-color: var(--tone-royal);
  box-shadow: 0 0 0 2.5px rgba(var(--tone-royal-nums), 0.14);
  transform: scale(1.038);
}

.fraction-display {
  font-size: 0.44em;
  opacity: 0.52;
  margin-left: 0.14em;
  font-weight: 620;
}

/* Screensaver Mode */
.realm-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(132deg, #09090F 0%, #131218 48%, #17151D 100%);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  cursor: none;
}

.realm-overlay.realm-active {
  display: flex;
}

.floating-timepiece {
  font-size: clamp(5.5vw, 9.5vw, 11rem);
  font-weight: 950;
  color: rgba(255, 255, 255, 0.97);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 42px rgba(191, 179, 255, 0.68),
               0 0 88px rgba(191, 179, 255, 0.48),
               0 6px 36px rgba(0, 0, 0, 0.58);
  animation: float-organic 72s ease-in-out infinite;
  letter-spacing: 0.075em;
}

.pointer-hidden {
  cursor: none !important;
}

.pointer-hidden * {
  cursor: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .zenith-wrapper {
    padding: 1.375rem 0.9375rem;
  }

  .voyage-selector {
    grid-template-columns: 1fr;
    gap: 0.4375rem;
    padding: 0.6875rem;
  }

  .voyage-tab {
    flex-direction: row;
    justify-content: center;
    padding: 0.6875rem;
  }

  .quantum-display {
    font-size: clamp(2.25rem, 5.5vw, 2.75rem);
    padding: clamp(0.9375rem, 2.5vw, 1.375rem) clamp(1.5rem, 3.5vw, 1.875rem);
  }

  .orbital-canvas {
    width: 228px;
    height: 228px;
    border-width: 7.5px;
  }

  .luminance-shifter,
  .realm-activator {
    width: 42px;
    height: 42px;
    top: 0.9375rem;
  }
  
  .luminance-shifter svg,
  .realm-activator svg {
    width: 19px;
    height: 19px;
  }

  .realm-activator {
    right: 4.25rem;
  }

  .floating-timepiece {
    font-size: clamp(7.5vw, 11vw, 13rem);
  }

  .action-bay {
    width: 100%;
  }

  .action-bay button {
    flex: 1 1 auto;
    min-width: 105px;
    padding: 0.6875rem 1.375rem;
    font-size: 0.84375rem;
  }
  
  .interval-input {
    width: 4.375rem;
    padding: 0.4688rem 0.6875rem;
    font-size: 0.96875rem;
  }
}
