
/* ===== SACRED GEOMETRY PROPORTIONS ===== */
:root {
  --phi: 1.618033988749895;
  --phi-inv: 0.6180339887498948;
  --phi2: 2.618033988749895;
  --sqrt2: 1.4142135623730951;
  --sqrt3: 1.7320508075688772;
  --sqrt5: 2.23606797749979;
  /* Sacred proportion widths */
  --geo-sm: calc(var(--phi-inv) * 100%);
  --geo-md: calc(var(--phi-inv) * var(--phi-inv) * 100%);
  --geo-xl: calc(var(--phi-inv) * var(--phi-inv) * var(--phi-inv) * 100%);
  /* Golden ratio spacing */
  --spacing-phi: calc(var(--spacing-xl) * var(--phi));
  --spacing-phi-inv: calc(var(--spacing-xl) * var(--phi-inv));
}
/* =============================================================================
   SPECTRAL CATHEDRAL — Global Styles
   Cosmic dark theme with glass-morphism and 6 band-category colors.
   =============================================================================
   TODO(Phase 2): Import this via @import "tailwindcss" in src/styles/global.css
   when Tailwind 4 directives are fully set up. For now this serves as the
   foundation CSS loaded through the layout.
   ============================================================================= */

@import "tailwindcss";

/* -----------------------------------------------------------------------------
   1. COSMIC PALETTE
   ----------------------------------------------------------------------------- */
:root {
  /* Cosmic base */
  --color-bg-deep: #0a0a1a;
  --color-bg-card: #1a1a3e;
  --color-bg-surface: #12122a;
  --color-text-primary: #e0e0f0;
  --color-text-secondary: #9090b0;
  --color-text-muted: #606080;
  --color-border: #2a2a5e;
  --color-border-glow: #4a4a8e;

  /* Glass-morphism tokens */
  --glass-bg: rgba(26, 26, 62, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.3);
  --glass-blur: 16px;

  /* 6 Band category colours */
  --band-coral: #ff6b6b;
  --band-violet: #8844ff;
  --band-cyan: #44ccff;
  --band-emerald: #44ff88;
  --band-amber: #ffaa44;
  --band-star: #ffdd66;

  /* Band aliases for semantic use */
  --band-structural: var(--band-coral);
  --band-mystical: var(--band-violet);
  --band-harmonic: var(--band-cyan);
  --band-natural: var(--band-emerald);
  --band-alchemical: var(--band-amber);
  --band-celestial: var(--band-star);

  /* Spacing scale */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --font-display: "Inter", system-ui, sans-serif;

  /* Animation */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Surface backgrounds for nav, footer, overlays */
  --nav-bg: rgba(10, 10, 26, 0.75);
  --footer-bg: rgba(10, 10, 26, 0.5);
  --hero-overlay-gradient: linear-gradient(transparent, rgba(10,10,26,0.85) 40%, rgba(10,10,26,0.95));

  /* Border tokens for elements that don't use --glass-border */
  --color-border-subtle: rgba(255, 255, 255, 0.08);
  --color-border-section: rgba(255, 255, 255, 0.06);
  --nav-link-hover-bg: rgba(255, 255, 255, 0.05);
}

/* -----------------------------------------------------------------------------
   1b. LIGHT THEME OVERRIDES
   ----------------------------------------------------------------------------- */
[data-theme="light"] {
  --color-bg-deep: #f5f0eb;
  --color-bg-card: #ffffff;
  --color-bg-surface: #faf6f0;
  --color-text-primary: #2c2416;
  --color-text-secondary: #6b5d4e;
  --color-text-muted: #a09284;
  --color-border: #e0d6cc;
  --color-border-glow: #c4b8a8;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.08);
  --nav-bg: rgba(245, 240, 235, 0.85);
  --footer-bg: rgba(245, 240, 235, 0.55);
  --hero-overlay-gradient: linear-gradient(transparent, rgba(245,240,235,0.85) 40%, rgba(245,240,235,0.95));
  --color-border-subtle: rgba(0, 0, 0, 0.08);
  --color-border-section: rgba(0, 0, 0, 0.06);
  --nav-link-hover-bg: rgba(0, 0, 0, 0.05);
}

/* -----------------------------------------------------------------------------
   2. BASE ELEMENTS
   ----------------------------------------------------------------------------- */
html {
  background-color: var(--color-bg-deep);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  /* Enable smooth view transitions */
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  padding: 0;
}

/* View Transitions: crossfade default, opt-in for named transitions */
/* TODO(Phase 2): Replace with custom view-transition-name assignments for each page */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 400ms;
  animation-timing-function: ease-in-out;
}

/* -----------------------------------------------------------------------------
   3. GLASS-MORPHISM CARD
   ----------------------------------------------------------------------------- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--spacing-lg);
  box-shadow: 0 4px 24px var(--glass-shadow);
  padding: var(--spacing-xl);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--glass-shadow);
}

.glass-card--compact {
  padding: var(--spacing-md);
}

.glass-card--accent {
  /* Card with a coloured top border glow */
  border-top: 2px solid var(--border-accent, var(--band-violet));
}

/* -----------------------------------------------------------------------------
   4. GLASS-NAVIGATION BAR
   ----------------------------------------------------------------------------- */
.glass-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-xl);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.glass-nav__brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.glass-nav__links {
  display: flex;
  gap: var(--spacing-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}

.glass-nav__link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--spacing-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.glass-nav__link:hover,
.glass-nav__link[aria-current="page"] {
  color: var(--color-text-primary);
  background: var(--nav-link-hover-bg);
}

/* TODO(Phase 2): Mobile hamburger menu toggle */
/* TODO(Phase 2): Active page indicator animation */

/* -----------------------------------------------------------------------------
   5. FOOTER
   ----------------------------------------------------------------------------- */
.glass-footer {
  margin-top: auto;
  padding: var(--spacing-xl);
  text-align: center;
  border-top: 1px solid var(--glass-border);
  background: var(--footer-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.glass-footer__omega {
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

/* -----------------------------------------------------------------------------
   6. RESPONSIVE GRID LAYOUT
   ----------------------------------------------------------------------------- */
.spectral-grid {
  display: grid;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

/* Default: 1 column */
.spectral-grid--2 {
  grid-template-columns: 1fr;
}

.spectral-grid--3 {
  grid-template-columns: 1fr;
}

.spectral-grid--4 {
  grid-template-columns: 1fr;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
  .spectral-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .spectral-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .spectral-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 3-4 columns */
@media (min-width: 1024px) {
  .spectral-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .spectral-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .spectral-grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Wide desktop: 6 columns for band visualizer */
.spectral-grid--6 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .spectral-grid--6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .spectral-grid--6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* -----------------------------------------------------------------------------
   7. BAND CATEGORY COLOR UTILITIES
   ----------------------------------------------------------------------------- */
.band-coral {
  --band-color: var(--band-coral);
  color: var(--band-coral);
}
.band-violet {
  --band-color: var(--band-violet);
  color: var(--band-violet);
}
.band-cyan {
  --band-color: var(--band-cyan);
  color: var(--band-cyan);
}
.band-emerald {
  --band-color: var(--band-emerald);
  color: var(--band-emerald);
}
.band-amber {
  --band-color: var(--band-amber);
  color: var(--band-amber);
}
.band-star {
  --band-color: var(--band-star);
  color: var(--band-star);
}

/* Band accent border on glass cards */
.glass-card--band-coral {
  --border-accent: var(--band-coral);
}
.glass-card--band-violet {
  --border-accent: var(--band-violet);
}
.glass-card--band-cyan {
  --border-accent: var(--band-cyan);
}
.glass-card--band-emerald {
  --border-accent: var(--band-emerald);
}
.glass-card--band-amber {
  --border-accent: var(--band-amber);
}
.glass-card--band-star {
  --border-accent: var(--band-star);
}

/* -----------------------------------------------------------------------------
   8. PAGE STRUCTURE
   ----------------------------------------------------------------------------- */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-main {
  flex: 1;
  padding: var(--spacing-xl);
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* TODO(Phase 2): Page-specific hero/header sections */
/* TODO(Phase 2): Animated gradient backgrounds */
/* TODO(Phase 2): 72-band visualizer component styles */


#starfield-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== MOBILE RESPONSIVE FIXES ===== */
@media (max-width: 768px) {
  .glass-nav { flex-direction: column; padding: 0.5rem; }
  .glass-nav__links { flex-wrap: wrap; gap: 0.25rem; justify-content: center; }
  .glass-nav__link { font-size: 0.75rem; padding: 0.3rem 0.6rem; }
  .hero { padding: var(--spacing-xl) 0 !important; }
  .hero h1 { font-size: 1.5rem !important; }
  .spectral-grid { grid-template-columns: 1fr !important; }
  .spectral-grid--3 { grid-template-columns: 1fr !important; }
  .keyboard-row { overflow-x: auto; }
  .row-keys { flex-wrap: nowrap; min-width: 600px; }
  .key { min-width: 36px; height: 44px; }
  .key-num { font-size: 0.55rem; }
  .key-name { display: none; }
  .detail-panel { flex-direction: column; }
  .page-main { padding: 0 0.5rem; }
  .identify-input { font-size: 1.2rem; }
  .comparison-selectors { grid-template-columns: 1fr !important; }
  .compare-layout { grid-template-columns: 1fr !important; }
  .transformer-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .glass-card { padding: var(--spacing-md) !important; }
}

@media (max-width: 480px) {
  .glass-nav__links { gap: 0.15rem; }
  .glass-nav__link { font-size: 0.65rem; padding: 0.2rem 0.4rem; }
  .hero h1 { font-size: 1.2rem !important; }
  .transformer-grid { grid-template-columns: 1fr !important; }
  .modal-content { width: 95% !important; padding: 1rem !important; }
  .key { min-width: 28px; height: 36px; }
  .key-num { font-size: 0.45rem; }
  .spectrum-card { flex-direction: column; }
}

/* ===== SPACING & BOUNDARY FIXES ===== */
*, *::before, *::after { box-sizing: border-box; }

.glass-card {
  border: 1px solid var(--color-border-subtle);
  padding: var(--spacing-lg);
  border-radius: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  position: relative;
}
.glass-card:last-child { margin-bottom: 0; }
.glass-card + .glass-card { margin-top: 0; }

.glass-card__section {
  border-top: 1px solid var(--color-border-section);
  padding-top: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

.glass-card--compact { padding: var(--spacing-md); }

.spectral-grid {
  display: grid;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}
.spectral-grid--3 { grid-template-columns: repeat(3, 1fr); }
.spectral-grid--2 { grid-template-columns: repeat(2, 1fr); }

.hero {
  padding: var(--spacing-3xl) var(--spacing-lg);
  max-width: 1200px;
  margin: 0 auto;
}

.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg) var(--spacing-2xl);
}

.section-title {
  margin: var(--spacing-2xl) 0 var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border-subtle);
}

/* Tool cards in the home page grid */
.glass-card h3 { margin-top: 0; margin-bottom: var(--spacing-sm); }
.glass-card p { margin: 0 0 var(--spacing-md); color: var(--color-text-secondary); }
.glass-card a { display: inline-block; }

/* Responsive boundary fixes */
@media (max-width: 768px) {
  .hero { padding: var(--spacing-2xl) var(--spacing-md); }
  .page-main { padding: 0 var(--spacing-md) var(--spacing-xl); }
  .spectral-grid--3, .spectral-grid--2 { grid-template-columns: 1fr; }
  .glass-card { padding: var(--spacing-md); }
}
@media (max-width: 480px) {
  .hero { padding: var(--spacing-xl) var(--spacing-sm); }
  .page-main { padding: 0 var(--spacing-sm) var(--spacing-lg); }
}

/* ===== Hero Image ===== */
.hero-image {
  margin-top: 56px;
  position: relative;
  width: 100%;
  border-radius: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  overflow: hidden;
}
.hero-image img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: var(--spacing-lg);
}
.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--spacing-2xl) var(--spacing-lg) var(--spacing-lg);
  background: var(--hero-overlay-gradient);
  text-align: center;
}
.hero-overlay h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0 0 var(--spacing-sm);
  letter-spacing: -0.02em;
}
.hero-overlay p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}
.hero-omega {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: var(--spacing-sm) !important;
  opacity: 0.7;
}
@media (max-width: 768px) {
  .hero-overlay h1 { font-size: 1.6rem; }
  .hero-overlay p { font-size: 0.85rem; }
  .hero-image { border-radius: var(--spacing-sm); }
  .hero-image img { border-radius: var(--spacing-sm); }


}


.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: #000;
  z-index: 1000;
  border-radius: 0 0 var(--spacing-sm) 0;
}
.skip-link:focus {
  top: 0;
}

#main-content, .site-footer { position: relative; z-index: 1; }

/* ===== CONTENT HERO IMAGES ===== */
.content-hero-img {
  max-width: 500px;
  width: 100%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.04);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1),
              border-color 0.3s ease,
              box-shadow 0.4s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, black 85%, transparent 100%);
  mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, black 85%, transparent 100%);
}

.content-hero-img:hover {
  transform: scale(1.02);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5),
              0 0 60px rgba(168, 139, 250, 0.06);
}



/* ===== START HERE SECTION ===== */
.start-here {
  text-align: center;
  margin: var(--spacing-2xl) auto;
  max-width: 600px;
  padding: var(--spacing-xl);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  background: radial-gradient(ellipse at center, rgba(168,139,250,0.04) 0%, transparent 70%);
}
.start-question {
  font-size: 1.6rem;
  margin: 0 0 var(--spacing-sm);
  background: linear-gradient(135deg, #a78bfa, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.start-desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  max-width: 420px;
  margin: 0 auto var(--spacing-lg);
  line-height: 1.6;
}
.start-btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 40px;
  background: linear-gradient(135deg, rgba(168,139,250,0.15), rgba(96,165,250,0.15));
  border: 1px solid rgba(168,139,250,0.25);
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
  font-family: inherit;
}
.start-btn:hover {
  background: linear-gradient(135deg, rgba(168,139,250,0.25), rgba(96,165,250,0.25));
  border-color: rgba(168,139,250,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(168,139,250,0.1);
}

/* ===== QUICK DOORS ===== */
.quick-doors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-sm);
  margin: var(--spacing-lg) 0 var(--spacing-2xl);
}
.quick-door {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--spacing-lg) var(--spacing-md);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s;
}
.quick-door:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}
.qd-icon { font-size: 1.8rem; }
.qd-title { font-weight: 600; font-size: 0.95rem; }
.qd-desc { font-size: 0.72rem; color: var(--color-text-muted); line-height: 1.4; }
