/* === CUSTOM PROPERTIES === */
:root {
  --gold: #C9A84C;
  --gold-light: #E8C97A;
  --gold-dim: #8B6914;
  --bg: #0d0d0d;
  --card: #1a1008;
  --card-2: #120b04;
  --text: #F5F0E8;
  --text-muted: #A89880;
  --text-dim: #6e5c44;
  --border: rgba(201, 168, 76, 0.25);
  --player-bg: #0f0804;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

svg {
  fill: currentColor;
  display: block;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

/* === SPLASH SCREEN === */
.splash {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1f1200 0%, #0d0d0d 70%);
  padding: 2rem 1.5rem;
  padding-top: calc(var(--safe-top) + 2rem);
  padding-bottom: calc(var(--safe-bottom) + 2rem);
}

.splash__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.splash__dome {
  width: 120px;
  height: 108px;
  opacity: 0.85;
}

.splash__dome svg {
  width: 100%;
  height: 100%;
}

.splash__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: 0.02em;
}

.splash__title span {
  color: var(--gold);
  display: block;
}

.splash__subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.splash__stops {
  font-size: 0.8rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.3em 1em;
  letter-spacing: 0.05em;
}

/* === BUTTONS === */
.btn-primary {
  background: var(--gold);
  color: #0d0d0d;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.875rem 2.5rem;
  border-radius: 3rem;
  letter-spacing: 0.04em;
  transition: background var(--transition), transform var(--transition);
  min-height: 52px;
  min-width: 200px;
  margin-top: 0.5rem;
}

.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--gold-light);
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

.btn-primary:active {
  transform: scale(0.97);
}

/* === APP SHELL === */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  position: relative;
  overflow: visible;
}

/* === TOP BAR === */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(56px + var(--safe-top));
  padding-top: var(--safe-top);
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 1rem;
  padding-right: 1rem;
}

.topbar__menu {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.topbar__menu:hover, .topbar__menu:focus-visible {
  background: rgba(201, 168, 76, 0.1);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.hamburger {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
  transition: opacity var(--transition);
}

.topbar__title {
  font-family: Georgia, serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.topbar__home {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}

.topbar__home svg {
  width: 22px;
  height: 22px;
}

.topbar__home:hover, .topbar__home:focus-visible {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* === DRAWER === */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  z-index: 200;
  background: var(--card-2);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer__title {
  font-family: Georgia, serif;
  font-size: 1rem;
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0.05em;
}

.drawer__close {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color var(--transition), background var(--transition);
}

.drawer__close:hover, .drawer__close:focus-visible {
  color: var(--text);
  background: rgba(201, 168, 76, 0.1);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.stop-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0;
  overscroll-behavior: contain;
}

.stop-list__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

.stop-list__item:hover {
  background: rgba(201, 168, 76, 0.08);
}

.stop-list__item.is-active {
  border-left-color: var(--gold);
  background: rgba(201, 168, 76, 0.12);
}

.stop-list__num {
  font-size: 0.75rem;
  color: var(--gold-dim);
  font-family: Georgia, serif;
  min-width: 1.5em;
  text-align: right;
  flex-shrink: 0;
}

.stop-list__name {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.3;
}

.stop-list__item.is-active .stop-list__name {
  color: var(--gold-light);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* === STOP VIEW === */
.stop-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: calc(56px + var(--safe-top));
  padding-bottom: calc(76px + var(--safe-bottom));
  overflow-y: visible;
}

.stop-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--card);
  flex-shrink: 0;
  position: relative;
}

.stop-image picture,
.stop-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}

.stop-image img.loading {
  opacity: 0;
}

.stop-content {
  padding: 1.25rem 1rem 0;
}

.stop-meta {
  margin-bottom: 0.4rem;
}

.stop-subtitle {
  font-size: 0.75rem;
  color: var(--gold-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

.stop-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  font-weight: 400;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.stop-description {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.75;
  white-space: pre-line;
  padding-bottom: 1rem;
}

/* === AUDIO PLAYER === */
.audio-player {
  background: var(--player-bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.player__controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  color: #0d0d0d;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}

.btn-play svg {
  width: 26px;
  height: 26px;
}

.btn-play:hover, .btn-play:focus-visible {
  background: var(--gold-light);
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

.btn-play:active {
  transform: scale(0.95);
}

.btn-play[aria-pressed="true"] {
  background: var(--gold-dim);
}

.player__progress-area {
  flex: 1;
  min-width: 0;
}

.player__time-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.time-current,
.time-total {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.player__seekbar-wrap {
  position: relative;
}

.seekbar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(201, 168, 76, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  accent-color: var(--gold);
}

.seekbar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  transition: transform var(--transition);
}

.seekbar::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}

.seekbar:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.seekbar:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 2px;
}

.player__hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.6rem;
  letter-spacing: 0.02em;
}

.player__hint.hidden {
  display: none;
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.875rem;
  min-height: 44px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
  letter-spacing: 0.02em;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-btn:hover:not(:disabled), .nav-btn:focus-visible:not(:disabled) {
  color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.progress-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 120px;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}

.progress-dot.is-active {
  background: var(--gold);
  transform: scale(1.4);
}

/* === OFFLINE NOTICE === */
.offline-notice {
  position: fixed;
  bottom: calc(64px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--gold-dim);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.5rem 1.25rem;
  border-radius: 2rem;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* === STOP TRANSITION === */
.stop-view.fade-out {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stop-view.fade-in {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* === TABLET / DESKTOP === */
@media (min-width: 768px) {
  .stop-image {
    aspect-ratio: 16 / 9;
  }

  .stop-content {
    padding: 1.75rem 2rem 0;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
  }

  .audio-player {
    max-width: 720px;
    margin: 0.5rem auto 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
  }

  .stop-title {
    font-size: 2rem;
  }

  .stop-description {
    font-size: 1rem;
  }

  .drawer {
    width: 300px;
  }
}

@media (min-width: 1024px) {
  .stop-view {
    display: grid;
    grid-template-columns: 1fr 420px;
    grid-template-rows: auto 1fr;
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
  }

  .stop-image {
    grid-column: 1;
    grid-row: 1 / 3;
    aspect-ratio: 3 / 4;
    max-height: calc(100dvh - 56px - 60px);
    position: sticky;
    top: 56px;
  }

  .stop-content {
    grid-column: 2;
    grid-row: 1;
    padding: 2rem 1.5rem 0;
  }

  .audio-player {
    grid-column: 2;
    grid-row: 2;
    margin: 1rem 1rem 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    align-self: start;
  }
}

/* === FOCUS STYLES (accessibility) === */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 3px;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
