/* ==========================================================================
   2026 OFFICIAL REGENESIS LUXURY DESIGN SYSTEM
   Tone: Warm Sand & Wheat (Architectural Grounding)
   Page 16 Palette: Soft Sand Gold (#dbcaad), Warm Chrome Wheat (#EDE6DA),
                    Slate (#5B7A8C) Structure, Deep Backdrop (#20272f)
   Typography: New Science (-0.04em) / Outfit (-0.02em) / Fragment Mono (+0.05em)
   ========================================================================== */

/* 1. Official Fonts Integration */
@font-face {
  font-family: 'New Science';
  src: url('assets/fonts/New_Science_Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'New Science';
  src: url('assets/fonts/New_Science_Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'New Science';
  src: url('assets/fonts/New_Science_Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Fragment+Mono:ital@0;1&family=Instrument+Serif:ital@0;1&family=Outfit:wght@300;400;500;600;700&display=swap');

/* 2. Official Design Tokens & Root Variables */
:root {
  /* Page 16 Core Palette */
  --reg-gold: #AC843E;
  --reg-gold-web: #9e7836;
  --reg-gold-pale: #F3E2C4;
  --reg-gold-sand: #dbcaad;           /* Soft Sand Gold */
  --reg-chrome-wheat: #EDE6DA;        /* Warm Chrome Wheat */
  --reg-chrome-light: #E0E7EB;
  --reg-slate: #5B7A8C;               /* Slate Structure */
  --reg-slate-dark: #4E6776;
  --reg-slate-charcoal: #47525e;
  --reg-slate-gray: #9aa3ab;
  --reg-pearl: #F3F0EB;
  --reg-wheat-hover: #f0e9df;
  --reg-coral: #e7543c;               /* Alert & CoG Vector */
  --reg-dark-backdrop: #20272f;       /* Deep Backdrop */
  --reg-dark-container: #27303a;      /* Dark Container */
  --reg-dark-card: #2c3642;

  /* Typography Stacks */
  --font-headline: 'New Science', 'Outfit', sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-telemetry: 'Fragment Mono', monospace;
  --font-editorial: 'Instrument Serif', Georgia, serif;

  /* Exact Tracking Constraints */
  --tracking-headline: -0.04em;
  --tracking-body: -0.02em;
  --tracking-telemetry: 0.05em;

  /* Atmospheric Vignette & Radials (3.5% - 6% max opacity) */
  --vignette: radial-gradient(ellipse at 50% 20%, rgba(172, 132, 62, 0.08) 0%, rgba(40, 51, 63, 0.45) 60%, transparent 100%);
  --radials-bg: url('assets/brand/shapes/radials_white.svg');
  --radials-opacity: 0.055;

  /* Borders & Glassmorphism */
  --reg-border: rgba(91, 122, 140, 0.22);
  --reg-border-highlight: rgba(172, 132, 62, 0.45);
  --reg-glass-bg: rgba(39, 48, 58, 0.88);
  --reg-gold-glow: 0 0 20px rgba(172, 132, 62, 0.25);
  --reg-sand-glow: 0 0 16px rgba(219, 202, 173, 0.20);
}

/* 3. Base Resets & Global Theme Application */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  letter-spacing: var(--tracking-body);
  background-color: var(--reg-dark-backdrop);
  color: var(--reg-pearl);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100vh;
}

/* Diffuse Vignette Gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--vignette);
  pointer-events: none;
  z-index: 0;
}

/* 4. Atmospheric Backdrops (3.5%–6% max opacity) */
.ambient-radials {
  position: fixed;
  top: -140px;
  right: -140px;
  width: 900px;
  height: 900px;
  background-image: var(--radials-bg);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: var(--radials-opacity);
  pointer-events: none;
  z-index: 0;
}

.ambient-radials-bottom {
  position: fixed;
  bottom: -200px;
  left: -200px;
  width: 800px;
  height: 800px;
  background-image: var(--radials-bg);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: calc(var(--radials-opacity) * 0.7);
  transform: rotate(180deg);
  pointer-events: none;
  z-index: 0;
}

/* 5. Typography Utility Classes */
.font-headline {
  font-family: var(--font-headline);
  letter-spacing: var(--tracking-headline);
  text-transform: uppercase;
}

.font-body {
  font-family: var(--font-body);
  letter-spacing: var(--tracking-body);
}

.font-telemetry, .font-mono-regen {
  font-family: var(--font-telemetry) !important;
  letter-spacing: var(--tracking-telemetry) !important;
}

.font-editorial, .font-serif-regen {
  font-family: var(--font-editorial) !important;
  letter-spacing: 0 !important;
}

/* 6. Sacred Logo Clearspace Rule
   NEVER stamp, embed, or scale logos as background watermarks.
   Preserve clearspace >= 1x capital 'R' height (~26px) */
.sacred-logo-lockup {
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.brand-horizontal-logo {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* 7. Custom Sleek Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(32, 39, 47, 0.7);
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--reg-slate);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--reg-gold);
}

/* 8. Range Slider Styling */
input[type=range] {
  -webkit-appearance: none;
  background: #1c232b;
  border-radius: 6px;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: var(--reg-gold);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(172, 132, 62, 0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 2px solid var(--reg-chrome-wheat);
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 14px rgba(172, 132, 62, 0.95);
}

/* 9. Interactive UI Components & Cards */
.reg-card {
  background: var(--reg-dark-container);
  border: 1px solid var(--reg-border);
  border-radius: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.reg-card:hover {
  border-color: var(--reg-border-highlight);
}

/* Tooltip Styling */
#crate-tooltip {
  transition: opacity 0.15s ease, transform 0.15s ease;
  backdrop-filter: blur(16px);
  background: rgba(32, 39, 47, 0.94);
  border: 1px solid var(--reg-gold-sand);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 16px rgba(219, 202, 173, 0.12);
}

/* Container Preset Buttons */
.btn-container-preset {
  background-color: transparent;
  color: var(--reg-slate-gray);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-container-preset:hover {
  color: var(--reg-pearl);
  background-color: rgba(255, 255, 255, 0.05);
}
.btn-container-preset.active {
  background-color: var(--reg-gold-web) !important;
  color: #ffffff !important;
  border-color: var(--reg-gold-sand) !important;
  box-shadow: 0 4px 14px rgba(172, 132, 62, 0.35) !important;
}

/* Active Playback Speed Button */
.btn-speed.active {
  background-color: var(--reg-gold-web) !important;
  color: #ffffff !important;
  border-color: var(--reg-gold-sand) !important;
}

/* Active Camera Button */
.btn-cam-view.active {
  background-color: var(--reg-dark-container) !important;
  color: var(--reg-gold-sand) !important;
  border-color: var(--reg-gold) !important;
}

/* Primary Simulation Button */
.btn-simulate-regen {
  background: linear-gradient(135deg, var(--reg-gold-web) 0%, var(--reg-gold) 100%);
  color: #ffffff;
  border: 1px solid var(--reg-gold-sand);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 18px rgba(172, 132, 62, 0.30);
}
.btn-simulate-regen:hover {
  background: linear-gradient(135deg, #b2883f 0%, #9e7836 100%);
  box-shadow: 0 6px 24px rgba(172, 132, 62, 0.45);
  transform: translateY(-1px);
}

/* Touch Action on 3D Canvas */
#three-canvas {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Mobile Segmented Switcher */
.mobile-tab-btn {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}
.mobile-tab-btn.active {
  background-color: var(--reg-gold-web) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(172, 132, 62, 0.35);
  border-color: var(--reg-gold-sand);
}
