/* ============================================
   PAGE GUIDE — Audio walkthrough component
   Inline banner + scroll-to-pill behavior
   
   Dark theme: default (matches site dark UI)
   Light theme: add .pg-light to the banner/pill
   ============================================ */

/* --- Inline Banner --- */
.page-guide-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(14, 22, 30, 0.96);
    border: 1px solid rgba(50, 213, 242, 0.18);
    border-radius: 10px;
    margin: 12px auto 20px;
    max-width: 1040px;
    position: sticky;
    top: 72px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 100;
    font-family: system-ui, -apple-system, sans-serif;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.page-guide-banner.pg-hidden { display: none; }

.pg-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(50, 213, 242, 0.12);
    color: #32D5F2;
    flex-shrink: 0;
}

.pg-text { flex: 1; min-width: 0; }
.pg-label { font-size: 0.82rem; font-weight: 600; color: #E4ECEF; line-height: 1.3; }
.pg-sublabel { font-size: 0.72rem; color: #A0AEC0; margin-top: 1px; }

.pg-play {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: rgba(50, 213, 242, 0.12);
    border: 1px solid rgba(50, 213, 242, 0.25);
    border-radius: 20px;
    color: #32D5F2;
    font-size: 0.78rem; font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap; flex-shrink: 0;
    font-family: inherit;
}
.pg-play:hover { background: rgba(50, 213, 242, 0.2); border-color: rgba(50, 213, 242, 0.4); }
.pg-play.pg-playing { background: rgba(50, 213, 242, 0.18); border-color: rgba(50, 213, 242, 0.35); }
.pg-play svg { width: 14px; height: 14px; fill: currentColor; }

.pg-duration {
    font-size: 0.7rem; color: #8A94A6;
    flex-shrink: 0; font-variant-numeric: tabular-nums;
}

.pg-close {
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    border: none; background: none;
    color: #8A94A6; cursor: pointer;
    border-radius: 4px; font-size: 16px;
    flex-shrink: 0; padding: 0; line-height: 1;
    transition: color 0.2s, background 0.2s;
}
.pg-close:hover { color: #E4ECEF; background: rgba(255,255,255,0.06); }

/* Progress bar */
.pg-progress-wrap {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 3px;
    background: rgba(50, 213, 242, 0.08);
    border-radius: 0 0 10px 10px;
    overflow: hidden; opacity: 0;
    transition: opacity 0.3s;
}
.pg-progress-wrap.pg-active { opacity: 1; }
.pg-progress-bar {
    height: 100%; width: 0%;
    background: #32D5F2;
    border-radius: 0 0 10px 10px;
    transition: width 0.3s linear;
}

/* --- Fixed Pill (appears on scroll) --- */
.pg-pill {
    position: fixed; top: 72px; left: 20px;
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px;
    background: rgba(27, 32, 39, 0.95);
    border: 1px solid rgba(50, 213, 242, 0.22);
    border-radius: 20px;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 999; cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0; transform: translateY(-8px);
    pointer-events: none;
    font-family: system-ui, -apple-system, sans-serif;
}
.pg-pill.pg-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.pg-pill:hover { border-color: rgba(50, 213, 242, 0.4); background: rgba(27, 32, 39, 0.98); }

.pg-pill-icon { font-size: 13px; color: #32D5F2; display: flex; align-items: center; }
.pg-pill-text { font-size: 0.75rem; font-weight: 600; color: #E4ECEF; }
.pg-pill-play {
    display: flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(50, 213, 242, 0.15); color: #32D5F2; font-size: 10px;
}
.pg-pill.pg-playing .pg-pill-play { background: rgba(50, 213, 242, 0.25); }

.pg-pill-ring {
    position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 22px;
    border: 2px solid transparent; border-top-color: #32D5F2;
    opacity: 0; pointer-events: none;
}
.pg-pill.pg-playing .pg-pill-ring { opacity: 1; animation: pgSpin 2s linear infinite; }
@keyframes pgSpin { to { transform: rotate(360deg); } }

/* --- Mid-page marker (for second clip) --- */
.pg-midpoint {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    background: rgba(50, 213, 242, 0.04);
    border: 1px solid rgba(50, 213, 242, 0.12);
    border-radius: 8px;
    margin: 20px 0; cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-family: system-ui, -apple-system, sans-serif;
}
.pg-midpoint:hover { background: rgba(50, 213, 242, 0.08); border-color: rgba(50, 213, 242, 0.25); }
.pg-midpoint-icon { color: #32D5F2; font-size: 14px; flex-shrink: 0; display: flex; align-items: center; }
.pg-midpoint-text { font-size: 0.78rem; color: #A0AEC0; }
.pg-midpoint-text strong { color: #E4ECEF; }
.pg-midpoint-play { margin-left: auto; font-size: 0.72rem; color: #32D5F2; font-weight: 600; flex-shrink: 0; }

/* --- Transcript --- */
.pg-transcript {
    overflow: hidden; max-height: 0;
    transition: max-height 0.3s ease; margin-top: 0;
}
.pg-transcript.pg-expanded { max-height: 200px; margin-top: 10px; }
.pg-transcript-inner {
    font-size: 0.78rem; color: #A0AEC0; line-height: 1.6;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px; border: 1px solid rgba(255,255,255,0.04);
}

/* ========== LIGHT THEME ========== */
.pg-light.page-guide-banner,
.pg-light .page-guide-banner {
    background: rgba(0, 102, 204, 0.04);
    border-color: rgba(0, 102, 204, 0.15);
}
.pg-light .pg-icon,
.pg-light.page-guide-banner .pg-icon { background: rgba(0, 102, 204, 0.07); color: #0066cc; }
.pg-light .pg-label,
.pg-light.page-guide-banner .pg-label { color: #1a1a1a; }
.pg-light .pg-sublabel,
.pg-light.page-guide-banner .pg-sublabel { color: #6b6b6b; }
.pg-light .pg-play,
.pg-light.page-guide-banner .pg-play { background: rgba(0,102,204,0.07); border-color: rgba(0,102,204,0.2); color: #0066cc; }
.pg-light .pg-play:hover,
.pg-light.page-guide-banner .pg-play:hover { background: rgba(0,102,204,0.12); border-color: rgba(0,102,204,0.3); }
.pg-light .pg-duration,
.pg-light.page-guide-banner .pg-duration { color: #6b6b6b; }
.pg-light .pg-close,
.pg-light.page-guide-banner .pg-close { color: #999; }
.pg-light .pg-close:hover,
.pg-light.page-guide-banner .pg-close:hover { color: #333; background: rgba(0,0,0,0.04); }
.pg-light .pg-progress-wrap,
.pg-light.page-guide-banner .pg-progress-wrap { background: rgba(0,102,204,0.06); }
.pg-light .pg-progress-bar,
.pg-light.page-guide-banner .pg-progress-bar { background: #0066cc; }

.pg-pill.pg-light {
    background: rgba(255,255,255,0.97);
    border-color: rgba(0,102,204,0.18);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.pg-pill.pg-light:hover { border-color: rgba(0,102,204,0.3); }
.pg-pill.pg-light .pg-pill-icon { color: #0066cc; }
.pg-pill.pg-light .pg-pill-text { color: #1a1a1a; }
.pg-pill.pg-light .pg-pill-play { background: rgba(0,102,204,0.08); color: #0066cc; }
.pg-pill.pg-light .pg-pill-ring { border-top-color: #0066cc; }

.pg-light.pg-midpoint,
.pg-light .pg-midpoint {
    background: rgba(0,102,204,0.03);
    border-color: rgba(0,102,204,0.1);
}
.pg-light.pg-midpoint:hover,
.pg-light .pg-midpoint:hover { background: rgba(0,102,204,0.06); border-color: rgba(0,102,204,0.2); }
.pg-light .pg-midpoint-icon { color: #0066cc; }
.pg-light .pg-midpoint-text { color: #4a4a4a; }
.pg-light .pg-midpoint-text strong { color: #1a1a1a; }
.pg-light .pg-midpoint-play { color: #0066cc; }

.pg-light .pg-transcript-inner {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.06);
    color: #4a4a4a;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .page-guide-banner { flex-wrap: wrap; gap: 8px; padding: 10px 12px; top: 60px; }
    .pg-duration { display: none; }
    .pg-pill { left: 12px; top: auto; bottom: 76px; }
}

/* --- Print: hide guides --- */
@media print {
    .page-guide-banner, .pg-pill, .pg-midpoint { display: none !important; }
}
