/* Critical Mobile Settings: Prevent native gestures interfering with 3D canvas */
html, body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0f19;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* Disables double-tap zoom & swipe refresh on touch screens */
}

/* Pin the page to the visible screen so iOS Safari can never scroll it */
body {
  position: fixed;
  inset: 0;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  touch-action: none;
}

/* Navigation ring (~30% of the screen), placed so the gap between the ring and the
   collapsed bottom panel is 150% of the panel's visible height */
#orbit-ring {
  --ring-size: max(30vmin, 140px);
  --panel-margin: 0.75rem;    /* Overlay padding below the panel (p-3, sm:p-6) */
  /* Collapsed, the panel shows 3.5rem (see .sheet-collapsed) and reaches down over the margin */
  --panel-height: calc(3.5rem + var(--panel-margin));
  --panel-gap: calc(var(--panel-height) * 1.5);
  position: fixed;
  left: 50%;
  top: calc(100% - var(--panel-height) - var(--panel-gap) - var(--ring-size) / 2);
  width: var(--ring-size);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}
@media (min-width: 640px) {
  #orbit-ring { --panel-margin: 1.5rem; }
}

/* Glassmorphism Styling with Safe Area Insets for iOS Home Indicator/Notch */
/* Block-level canvas avoids an inline gap that makes the page taller than the screen */
#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.glass-panel {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* iOS SafeArea Padding Support */
.safe-area-bottom {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.safe-area-top {
  padding-top: max(1rem, env(safe-area-inset-top));
}

/* Smooth Custom Scrollbars */
.custom-scroll::-webkit-scrollbar {
  width: 4px;
}
.custom-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Touch-friendly Large Sliders */
input[type=range] {
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  height: 8px;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transition: transform 0.1s ease;
}
input[type=range]::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

/* City title (name comes from the database) */
.city-title {
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 0.9;
}
.city-title-name {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
/* Logo as tall as the capital letters of the city name (em = the title's font size) */
.city-logo {
  height: 0.77em;   /* Image has ~8% empty margin; this makes the drawn C match the cap height */
  width: auto;
  margin-top: 0.065em;           /* Centre on the name's line (0.9em) even when a subtitle is shown */
  transform: translateY(0.04em); /* Line up with the letters' baseline */
}

/* City picker: chevron beside the name, chosen area below it, dropdown list */
#city-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  line-height: inherit;
}
.city-chevron {
  position: absolute;            /* Beside the name without pulling it off centre */
  left: 100%;
  top: 50%;
  width: 0.38em;
  height: 0.38em;
  margin-left: 0.12em;
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}
#city-button[aria-expanded="true"] .city-chevron {
  transform: translateY(-50%) rotate(180deg);
}
.city-area {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 0.35rem;
  white-space: nowrap;
}
.city-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 13rem;
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  border-radius: 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.25;
  z-index: 30;
}
.city-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: 0.65rem;
  background: none;
  color: #e2e8f0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.city-menu button:hover,
.city-menu button:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}
.city-menu button[aria-selected="true"] {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.25);
}

/* Animated Bottom Sheet: collapses to its handle bar on every screen size */
.sheet-collapsed {
  transform: translateY(calc(100% - 3.5rem));
}
