/* =============================================================================
   OHANA HALE — Polynesian Ocean Exploration Landing Page
   ============================================================================= */

/* ── Design Tokens ── */
:root {
  --ocean-deep: #001e2f;
  --ocean-mid: #0a3d50;
  --ocean-light: #1a6a7a;
  --sky-zenith: #1a2050;
  --sky-horizon: #f0a060;
  --sand: #f4e8c1;
  --wood: #8b5e3c;
  --wood-dark: #5a3a20;
  --sail-cream: #f5f0e0;
  --coral: #e07050;
  --foam: rgba(255, 255, 255, 0.7);
  --text-light: #f0ece4;
  --text-muted: rgba(240, 236, 228, 0.6);
  --glass: rgba(10, 40, 60, 0.75);
  --glass-border: rgba(255, 255, 255, 0.12);
  --font-display: 'Fraunces', serif;
  --font-body: 'Public Sans', system-ui, sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body.landing-page {
  font-family: var(--font-body);
  background: var(--ocean-deep);
  color: var(--text-light);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* ── Loading Screen ── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ocean-deep);
  transition: opacity 0.8s var(--ease);
}
#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  max-width: 320px;
}

.loading-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
  animation: loading-pulse 2s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.loading-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.loading-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.loading-bar-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ocean-light), var(--sky-horizon));
  border-radius: 2px;
  transition: width 0.3s;
}

.loading-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Three.js Canvas ── */
#ocean-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}
#ocean-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── HUD Overlay ── */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#hud > * {
  pointer-events: auto;
}

/* Header */
.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hud-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wood);
  color: white;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
}

.hud-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hud-nav {
  display: flex;
  gap: 0.5rem;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(12px);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 200ms,
    transform 150ms;
}
.hud-btn:hover {
  background: rgba(20, 60, 80, 0.85);
  transform: translateY(-1px);
}
.hud-btn--primary {
  background: var(--ocean-light);
  border-color: rgba(26, 170, 187, 0.3);
}
.hud-btn--primary:hover {
  background: #1a8090;
}

/* Minimap */
#minimap {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: none;
  background: transparent;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(192, 120, 48, 0.1);
}

/* Compass */
#compass {
  position: fixed;
  top: 5rem;
  right: calc(1.5rem + 180px + 1rem);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.compass-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  position: absolute;
  top: 4px;
}
.compass-needle {
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, var(--coral) 50%, var(--text-muted) 50%);
  border-radius: 1px;
  transform-origin: center center;
}

/* WASD Hint */
#wasd-hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0.7;
  transition: opacity 1s var(--ease);
}
#wasd-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
}

.wasd-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 0.5rem;
}

/* Speed */
#speed-display {
  position: fixed;
  bottom: 2rem;
  left: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
#speed-value {
  color: var(--text-light);
  font-weight: 600;
  font-size: 1.2rem;
}

/* ── Island Info Panel ── */
.island-panel {
  position: fixed;
  top: 50%;
  right: 1.5rem;
  transform: translateY(-50%) translateX(120%);
  width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  border-radius: var(--radius-lg);
  background: rgba(8, 30, 45, 0.88);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transition: transform 0.6s var(--ease);
  z-index: 20;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.island-panel.visible {
  transform: translateY(-50%) translateX(0);
}
.island-panel::-webkit-scrollbar {
  width: 5px;
}
.island-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Hero image area */
.panel-hero {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.panel-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.panel-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 30, 45, 0.95) 0%, rgba(8, 30, 45, 0.3) 50%, transparent 100%);
  pointer-events: none;
}

.panel-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  transition:
    background 0.2s,
    color 0.2s;
  z-index: 2;
}
.panel-close:hover {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.panel-badge {
  position: absolute;
  bottom: 0.75rem;
  left: 1.25rem;
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Body content */
.panel-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  line-height: 1.2;
}

.panel-tagline {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--coral);
  margin-bottom: 0.85rem;
  line-height: 1.4;
  opacity: 0.9;
}

.panel-description {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Section titles */
.panel-section {
  margin-bottom: 1.25rem;
}

.panel-section-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--coral);
  margin-bottom: 0.65rem;
}

/* Process steps */
.panel-process {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  position: relative;
}
.panel-process::before {
  content: '';
  position: absolute;
  left: 0.7rem;
  top: 1.5rem;
  bottom: 0.75rem;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}
.panel-process li {
  counter-increment: step;
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.panel-process li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: rgba(224, 112, 80, 0.1);
  border: 1px solid rgba(224, 112, 80, 0.25);
  color: var(--coral);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 1;
}
.panel-process li:last-child {
  margin-bottom: 0;
}

/* Highlights */
.panel-highlights {
  list-style: none;
  padding: 0;
  margin: 0;
}
.panel-highlights li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.panel-highlights li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--coral);
  font-weight: 700;
  font-size: 0.8rem;
}

/* Values */
.panel-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  padding-top: 0.25rem;
}
.panel-value-tag {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(224, 112, 80, 0.08);
  border: 1px solid rgba(224, 112, 80, 0.2);
  color: var(--coral);
}

/* CTA */
.panel-cta {
  display: block;
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--coral);
  border: none;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition:
    background 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(224, 112, 80, 0.25);
}
.panel-cta:hover {
  background: #c85e3a;
  box-shadow: 0 6px 24px rgba(224, 112, 80, 0.35);
}

/* ── About Overlay ── */
#about-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 10, 20, 0.85);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 2rem;
}
#about-overlay[hidden] {
  display: none;
}

.about-content {
  max-width: 560px;
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  position: relative;
}

.about-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.about-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
}

.about-content h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.about-location {
  color: var(--ocean-light);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.about-content p {
  line-height: 1.7;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.about-content h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.about-founders {
  margin: 1.5rem 0;
}
.about-photo {
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
  max-height: 300px;
}

.about-services {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.about-services li {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.about-video {
  width: 100%;
  border-radius: var(--radius);
  margin-top: 1rem;
}

/* ── Virtual Joystick ── */
.joystick {
  display: none;
  position: fixed;
  bottom: 2.5rem;
  left: 2.5rem;
  z-index: 100;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.joystick-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, rgba(255, 255, 255, 0.35), rgba(224, 112, 80, 0.6));
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  position: absolute;
  transition: transform 0.06s ease-out;
  pointer-events: none;
}

/* ── Minimap expand hint ── */
#minimap {
  cursor: pointer;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s,
    filter 0.2s;
}
#minimap:hover {
  transform: scale(1.06);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(192, 120, 48, 0.2);
  filter: brightness(1.1);
}

/* ── Expanded Map Overlay ── */
#map-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0, 15, 25, 0.92), rgba(0, 8, 15, 0.96));
  backdrop-filter: blur(16px);
  animation: mapFadeIn 0.4s var(--ease);
}
#map-overlay[hidden] {
  display: none;
}

@keyframes mapFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.map-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 90vw;
  max-height: 90vh;
}

.map-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  justify-content: center;
  position: relative;
}

.map-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sand);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.03em;
}

.map-close {
  position: absolute;
  right: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(90, 58, 32, 0.4);
  border: 1px solid rgba(192, 120, 48, 0.3);
  border-radius: 50%;
  color: var(--sand);
  font-size: 1.3rem;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.map-close:hover {
  background: rgba(90, 58, 32, 0.6);
  border-color: rgba(192, 120, 48, 0.5);
}

#map-full {
  border-radius: 16px;
  border: none;
  background: transparent;
  box-shadow:
    0 20px 80px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(90, 58, 32, 0.15);
  cursor: pointer;
  max-width: 100%;
  max-height: 70vh;
}

.map-hint {
  font-size: 0.7rem;
  color: rgba(192, 120, 48, 0.5);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ── Fast travel fade ── */
#fast-travel-fade {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--ocean-deep);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
#fast-travel-fade.active {
  opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #minimap {
    width: 120px;
    height: 120px;
    top: 4.5rem;
    right: 1rem;
  }
  #compass {
    display: none;
  }
  .island-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
  }
  .hud-title {
    display: none;
  }
  .about-services {
    grid-template-columns: 1fr;
  }
  #map-full {
    max-height: 60vh;
  }
  .map-title {
    font-size: 1rem;
  }
}

@media (pointer: coarse), (max-width: 768px) {
  .joystick {
    display: block;
  }
  #wasd-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
