@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* ──────────────── Theme Tokens ──────────────── */
:root {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f7;
    --text-primary: #1a1d26;
    --text-secondary: #5a5f72;
    --text-tertiary: #8b90a0;
    --accent: #3b99fc;
    --accent-soft: rgba(59, 153, 252, 0.1);
    --accent-hover: #2b85e8;
    --border: rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --slider-track: #e0e3eb;
    --slider-fill: var(--accent);
    --category-bg: #f0f2f7;
    --category-hover: #e5e8f0;
    --transcript-bg: #f5f6fa;
    --success: #10b981;
    --error: #ef4444;
}

[data-theme="dark"] {
    --bg-primary: #0e1117;
    --bg-secondary: #161b26;
    --bg-tertiary: #1e2433;
    --text-primary: #e8eaf0;
    --text-secondary: #9ca3b8;
    --text-tertiary: #6b7280;
    --accent: #5daafd;
    --accent-soft: rgba(93, 170, 253, 0.12);
    --accent-hover: #4a9bef;
    --border: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(22, 27, 38, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --slider-track: #2a3040;
    --category-bg: #1e2433;
    --category-hover: #252d3e;
    --transcript-bg: #1a2030;
}

/* ──────────────── Reset & Base ──────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.35s ease, color 0.35s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ──────────────── Theme Toggle (floating) ──────────────── */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: var(--accent-soft);
    transform: scale(1.08);
}

/* ──────────────── Post Logo ──────────────── */
.post-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.post-logo a {
    display: inline-block;
}

.post-logo img {
    width: 52px;
    height: 52px;
    padding: 8px;
    background: #3b99fc;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.post-logo img:hover {
    transform: scale(1.05);
}

/* ──────────────── Main Layout ──────────────── */
.post-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

/* ──────────────── Cover Image ──────────────── */
.cover-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
    position: relative;
}

.cover-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.cover-container:hover img {
    transform: scale(1.02);
}

/* ──────────────── Author Section ──────────────── */
.author-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.author-nickname {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ──────────────── Stats Row ──────────────── */
.stats-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.stat-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.stat-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-tertiary);
    opacity: 0.5;
}

/* ──────────────── Title & Description ──────────────── */
.post-title {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.post-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ──────────────── Audio Player ──────────────── */
.audio-player {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    transition: background 0.35s, border-color 0.35s;
}

.player-slider-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.player-time {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    min-width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.player-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 100px;
    background: var(--slider-track);
    outline: none;
    cursor: pointer;
    transition: height 0.15s;
}

.player-slider:hover {
    height: 7px;
}

.player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 2px 6px rgba(59, 153, 252, 0.35);
    cursor: pointer;
    transition: transform 0.15s;
}

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

.player-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    box-shadow: 0 2px 6px rgba(59, 153, 252, 0.35);
    cursor: pointer;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.player-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s, transform 0.15s;
    padding: 0.4rem;
    border-radius: 50%;
}

.player-btn:hover {
    color: var(--accent);
    transform: scale(1.1);
}

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

.player-btn.play-btn {
    width: 52px;
    height: 52px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(59, 153, 252, 0.35);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.player-btn.play-btn:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(59, 153, 252, 0.4);
}

.player-btn svg {
    width: 22px;
    height: 22px;
}

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

.skip-label {
    font-size: 0.6rem;
    font-weight: 600;
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    color: inherit;
    opacity: 0.7;
}

.skip-btn-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ──────────────── Categories ──────────────── */
.categories-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    background: var(--category-bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.2s, transform 0.15s;
    cursor: default;
}

.category-chip:hover {
    background: var(--category-hover);
    transform: translateY(-1px);
}

.category-icon {
    font-size: 1rem;
}

/* ──────────────── Transcription ──────────────── */
.transcript-section {
    margin-bottom: 1.5rem;
}

.transcript-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.2s, border-radius 0.3s;
}

.transcript-toggle:hover {
    background: var(--bg-tertiary);
}

.transcript-toggle.open {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom-color: transparent;
}

.transcript-chevron {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    transition: transform 0.3s ease;
}

.transcript-toggle.open .transcript-chevron {
    transform: rotate(180deg);
}

.transcript-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.transcript-inner {
    padding: 1rem 1.1rem;
    background: var(--transcript-bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 400px;
    overflow-y: auto;
}

.transcript-inner::-webkit-scrollbar {
    width: 5px;
}

.transcript-inner::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-inner::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 100px;
}

/* ──────────────── Map ──────────────── */
.map-section {
    margin-bottom: 1.5rem;
}

.map-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.map-container {
    width: 100%;
    height: 240px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ──────────────── CTA / Download ──────────────── */
.cta-section {
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 1.5rem;
}

.cta-text {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.cta-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(59, 153, 252, 0.3);
}

.cta-link:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 153, 252, 0.35);
}

.cta-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cta-link-android {
    background: #34a853;
    box-shadow: 0 4px 14px rgba(52, 168, 83, 0.3);
}

.cta-link-android:hover {
    background: #2d9249;
    box-shadow: 0 6px 20px rgba(52, 168, 83, 0.35);
}

/* ──────────────── Footer ──────────────── */
.post-footer {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.post-footer a {
    color: var(--accent);
    text-decoration: none;
}

/* ──────────────── Error Pages ──────────────── */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
    gap: 1rem;
}

.error-code {
    font-size: 5rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.3;
    line-height: 1;
}

.error-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.error-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.error-link:hover {
    text-decoration: underline;
}

/* ──────────────── Lightbox ──────────────── */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox-overlay.active .lightbox-image {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    line-height: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* ──────────────── Responsive ──────────────── */
@media (min-width: 768px) {
    .post-page {
        padding: 3rem 2rem 4rem;
    }

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

    .map-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .post-page {
        padding: 1.5rem 1rem 2rem;
    }

    .cover-container {
        border-radius: var(--radius-md);
    }

    .post-title {
        font-size: 1.35rem;
    }

    .audio-player {
        padding: 1rem;
    }

    .player-btn.play-btn {
        width: 46px;
        height: 46px;
    }

    .map-container {
        height: 200px;
    }
}

/* ──────────────── Skeleton / Loading ──────────────── */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}