/* ============================================================
   AudioTour – Public Tour CSS
   ============================================================ */

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

:root {
  --t-bg:       var(--custom-bg,       #F5F3EE);
  --t-primary:  var(--custom-primary,  #111111);
  --t-text:     var(--custom-text,     #1a1a1a);
  --t-card:     var(--custom-card,     #FFFFFF);
  --t-btn:      var(--custom-btn,      #111111);
  --t-btn-text: var(--custom-btn-text, #FFFFFF);
  --t-muted:    #737373;
  --t-border:   #e5e5e5;
  --t-radius:   0.75rem;
  --t-header:   64px;
  --t-sidebar:  400px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--t-text);
  background: var(--t-bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ── Preview bar ──────────────────────────────────────── */

.tour-preview-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}
.tour-preview-back { color: #aaa; font-size: 0.72rem; transition: color 0.15s; }
.tour-preview-back:hover { color: #fff; }

/* ── Header ───────────────────────────────────────────── */

.tour-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--t-header);
  background: var(--t-card);
  border-bottom: 1px solid var(--t-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 100;
}
.tour-header.has-preview-bar { top: 29px; }

.tour-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  display: block;
}

.tour-lang-nav { display: flex; gap: 0.375rem; align-items: center; }

.tour-lang-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1.5px solid var(--t-border);
  border-radius: 0.4rem;
  color: var(--t-muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tour-lang-pill:hover { border-color: var(--t-primary); color: var(--t-primary); }
.tour-lang-pill.is-active {
  background: var(--t-primary);
  border-color: var(--t-primary);
  color: #fff;
}
.tour-lang-flag { font-size: 1.15rem; line-height: 1; }

/* ── Main ─────────────────────────────────────────────── */

.tour-page {
  padding-top: calc(var(--t-header) + 4rem);
  padding-bottom: 3rem;
  min-height: 100vh;
}

.tour-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Sidebar ──────────────────────────────────────────── */

.tour-sidebar {
  width: var(--t-sidebar);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--t-header) + 2rem);
  max-height: calc(100vh - var(--t-header) - 4rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d1d1 transparent;
}
.tour-sidebar::-webkit-scrollbar { width: 3px; }
.tour-sidebar::-webkit-scrollbar-thumb { background: #d1d1d1; border-radius: 2px; }

.tour-sidebar-card {
  background: var(--t-card);
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  overflow: hidden;
}

.tour-sidebar-head {
  padding: 1rem 1.25rem 0.875rem;
  border-bottom: 1px solid var(--t-border);
}
.tour-sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-muted);
  display: block;
}

/* Station items */
.tour-station-list { display: flex; flex-direction: column; }

.tour-station-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--t-border);
  transition: background 0.12s;
  cursor: pointer;
  color: var(--t-text);
  position: relative;
}
.tour-station-item:last-child { border-bottom: none; }
.tour-station-item:hover { background: #f7f7f7; }
.tour-station-item.is-active {
  background: #f7f7f7;
  border-left: none;
}

.tour-station-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--t-muted);
  flex-shrink: 0;
  min-width: 1.75rem;
  font-variant-numeric: tabular-nums;
}
.tour-station-item.is-active .tour-station-num { color: var(--t-primary); }

.tour-station-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--t-text);
}
.tour-station-item.is-active .tour-station-name { font-weight: 600; }

.tour-station-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.tour-station-dur {
  font-size: 0.7rem;
  color: var(--t-muted);
  font-variant-numeric: tabular-nums;
}
.tour-station-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--t-border);
  color: var(--t-muted);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.tour-station-play.is-active,
.tour-station-item:hover .tour-station-play {
  background: var(--t-primary);
  color: #fff;
}

/* ── Right content ────────────────────────────────────── */

.tour-content { flex: 1; min-width: 0; }

.tour-content-card {
  background: var(--t-card);
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  overflow: hidden;
}

/* Image */
.tour-station-img-wrap {
  width: 100%;
  aspect-ratio: 1292 / 893;
  overflow: hidden;
  background: #e8e8e8;
}
.tour-station-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.tour-station-img-placeholder {
  width: 100%;
  aspect-ratio: 1292 / 893;
  background: #f0eeea;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Content body */
.tour-content-body {
  padding: 1.75rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

/* Audio */
.tour-audio-wrap {
  background: var(--t-primary);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
}
.tour-audio-player {
  width: 100%; height: 36px;
  display: block;
  accent-color: #fff;
}
.tour-audio-missing {
  font-size: 0.8rem;
  color: var(--t-muted);
  padding: 0.625rem 0.875rem;
  background: #f7f7f7;
  border-radius: 0.4rem;
  border: 1px solid var(--t-border);
}

/* Badge */
.tour-station-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-muted);
}

/* Title */
.tour-content-title {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--t-text);
  letter-spacing: -0.01em;
}

/* Description */
.tour-content-text {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--t-text);
}

/* Navigation */
.tour-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--t-border);
  margin-top: 0.375rem;
}

.tour-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.625rem 1.375rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  background: var(--t-btn);
  color: var(--t-btn-text);
  border: 1px solid var(--t-btn);
}
.tour-nav-btn:hover { opacity: 0.8; }

.tour-nav-prev {
  background: transparent;
  color: var(--t-text);
  border-color: var(--t-border);
}
.tour-nav-prev:hover { background: #f5f5f5; border-color: #bbb; opacity: 1; }

.tour-nav-end {
  font-size: 0.8rem;
  color: var(--t-muted);
  font-style: italic;
  margin-left: auto;
}

/* ── Footer ───────────────────────────────────────────── */

.tour-footer {
  border-top: 1px solid var(--t-border);
  padding: 1.25rem 2rem;
  margin-top: 2rem;
  background: var(--t-card);
}
.tour-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.tour-footer-link {
  font-size: 0.75rem;
  color: var(--t-muted);
  transition: color 0.15s;
  cursor: pointer;
}
.tour-footer-link:hover { color: var(--t-text); }

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 820px) {
  .tour-layout {
    flex-direction: column;
    padding: 0 1rem;
    gap: 1.25rem;
  }
  .tour-content { order: 1; }
  .tour-sidebar {
    order: 2;
    position: static;
    width: 100%;
    max-height: none;
    overflow-y: visible;
  }
  .tour-content-body { padding: 1.25rem 1.25rem 1.5rem; gap: 1rem; }
  .tour-content-title { font-size: 1.2rem; }
  .tour-station-img-wrap { aspect-ratio: 1292 / 893; }
  .tour-page { padding-top: calc(var(--t-header) + 1.75rem); }
}
