/* aoi — landing page styles
 * Teal-first: no flash on load, then JS swaps to time-of-day via CSS vars.
 * Plus dev-only effects modal (FAB + dark glass panel).
 */

:root {
  /* Time-of-day anchor colors. Hour weighting in main.js interpolates between these. */
  --sky-night:    #0a1a2e;
  --sky-dawn:     #f5a07a;   /* warm peach horizon */
  --sky-day:      #6cb8d6;   /* clear daylight */
  --sky-dusk:     #c46a78;   /* dusty mauve */

  --sky-top-night: #050a1a;
  --sky-top-dawn:  #f9c79a;
  --sky-top-day:   #5fa3d1;
  --sky-top-dusk:  #6b5a8a;

  --sea-night:    #0c1a2c;
  --sea-dawn:     #d28b6a;
  --sea-day:      #2e8ab8;
  --sea-dusk:     #4a3a6a;

  --grass-night:  #0a1610;
  --grass-dawn:   #4a5a3a;
  --grass-day:    #3a8a5a;
  --grass-dusk:   #2a4a3a;

  --palm-trunk-day:    #6a4a2a;   /* sun-warmed bark */
  --palm-trunk-dawn:   #8a5a3a;
  --palm-trunk-dusk:   #3a2818;
  --palm-trunk-night:  #1a120a;
  --palm-frond-day:    #4a8a3a;   /* fronds a touch darker than grass for depth */
  --palm-frond-dawn:   #6a6a3a;
  --palm-frond-dusk:   #2a4a2a;
  --palm-frond-night:  #0a1810;

  --earth-day:    #c8a878;   /* sandy beach */
  --earth-dawn:   #b87858;   /* warm wet sand */
  --earth-dusk:   #4a3a2a;   /* dusty earth */
  --earth-night:  #1a1610;   /* shadowed soil */
  --earth-wet-day:   #8a6a48;  /* wet sand tone */
  --earth-wet-dawn:  #a07050;
  --earth-wet-dusk:  #3a2a20;
  --earth-wet-night: #0a0808;

  --sun-color:    #fff2a8;
  --moon-color:   #d8e6f0;

  /* Preload color — guarantees no flash before JS inits. */
  --bg-preload:   #008B8B;

  /* Modal accent. */
  --aoi-accent:   #5fc8c8;
  --aoi-glass:    rgba(10, 22, 30, 0.72);
  --aoi-glass-border: rgba(255, 255, 255, 0.10);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-preload);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-preload);
  cursor: grab;
  touch-action: none;
}

#stage:active { cursor: grabbing; }

#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.noscript-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #5fa3d1 0%, #2e8ab8 60%, #3a8a5a 100%);
}

/* Reduced motion: static gradient, no WebGL. */
@media (prefers-reduced-motion: reduce) {
  #stage { background: linear-gradient(180deg, #5fa3d1 0%, #2e8ab8 60%, #3a8a5a 100%); }
  #stage canvas { display: none; }
}

/* ────────────────────────────────────────────────────────────────────────────
 * Dev-only effects modal
 * ────────────────────────────────────────────────────────────────────────── */

.aoi-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--aoi-glass-border);
  background: var(--aoi-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}
.aoi-fab:hover { background: rgba(15, 30, 40, 0.85); }
.aoi-fab.open { transform: rotate(90deg); }

.aoi-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.0);
  z-index: 90;
  pointer-events: none;
  transition: background 0.2s ease;
}
.aoi-modal-backdrop.open {
  background: rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.aoi-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border-radius: 14px;
  border: 1px solid var(--aoi-glass-border);
  background: var(--aoi-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.aoi-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.aoi-modal.dragging { transition: none; }
.aoi-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--aoi-glass-border);
  cursor: grab;
  touch-action: none;
}
.aoi-info {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  font-variant-numeric: tabular-nums;
}
.aoi-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}
.aoi-info-row:last-child { border-bottom: none; }
.aoi-info-row span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.aoi-info-row b {
  font-weight: 500;
  text-align: right;
}

.aoi-modal-head.dragging { cursor: grabbing; }
.aoi-modal-head h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aoi-accent);
}
.aoi-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
  margin-right: 12px;
  padding: 0;
}
.aoi-tab {
  background: transparent;
  border: 1px solid var(--aoi-glass-border);
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.aoi-tab:hover { color: #fff; }
.aoi-tab.active {
  color: #fff;
  background: var(--aoi-accent);
  border-color: var(--aoi-accent);
}
.aoi-tabpanel[hidden] { display: none; }
}
.aoi-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--aoi-glass-border);
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.aoi-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.aoi-close:focus-visible { outline: 2px solid var(--aoi-accent); outline-offset: 2px; }
.aoi-close svg { display: block; width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.aoi-modal-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
  flex: 1;
}

.aoi-section {
  margin-bottom: 18px;
}
.aoi-section:last-child { margin-bottom: 0; }
.aoi-section h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 8px;
}

.aoi-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.aoi-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease;
  flex: 0 0 auto;
}
.aoi-row input[type="checkbox"]:checked {
  background: var(--aoi-accent);
  border-color: var(--aoi-accent);
}
.aoi-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: solid #07121a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.aoi-time-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.aoi-time-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #0a1a2e 0%, #f5a07a 22%, #6cb8d6 50%, #c46a78 78%, #0a1a2e 100%);
  outline: none;
}
.aoi-time-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--aoi-accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.aoi-time-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--aoi-accent);
  cursor: pointer;
}
.aoi-time-label {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  min-width: 48px;
  text-align: right;
}

.aoi-now {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(95, 200, 200, 0.16);
  border: 1px solid rgba(95, 200, 200, 0.4);
  color: var(--aoi-accent);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease;
}
.aoi-now:hover { background: rgba(95, 200, 200, 0.28); }
