/* Mental Stamina — Shared Styles */

:root {
    --gold-light: #F9E2AF;
    --gold: #DDB944;
    --gold-dark: #996515;
    --gold-gradient: linear-gradient(135deg, #DDB944 0%, #F9E2AF 50%, #996515 100%);
    --gold-text: linear-gradient(135deg, #DDB944, #F9E2AF, #996515);
    --frame-width: 10px;
    /* Semantic theme tokens */
    --bg: #050505;
    --bg-card: #0d0d0d;
    --bg-soft: #111111;
    --text: #ffffff;
    --text-muted: rgba(255,255,255,0.6);
    --text-dim: rgba(255,255,255,0.4);
    --border: rgba(221,185,68,0.15);
    --border-strong: rgba(221,185,68,0.3);
    --overlay: rgba(0,0,0,0.6);
    --overlay-heavy: rgba(0,0,0,0.85);
    --nav-bg: rgba(5,5,5,0.95);
    --player-bg: rgba(0,0,0,0.95);
    --input-bg: rgba(255,255,255,0.05);
    --error: #ff6b6b;
    /* Backwards-compatible aliases */
    --black: var(--bg);
    --black-card: var(--bg-card);
    --black-soft: var(--bg-soft);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

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

/* ===== SKIP TO CONTENT ===== */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 10001;
    background: var(--gold);
    color: var(--bg);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 0 0 8px 0;
}
.skip-to-content:focus {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    overflow: visible;
}

/* ===== SCREEN READER ONLY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== GOLD FRAME ===== */
.gold-frame {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    border: var(--frame-width) solid transparent;
    border-image: var(--gold-gradient) 1;
    pointer-events: none; z-index: 9999;
}

/* ===== NAV ===== */
.site-nav {
    position: fixed;
    top: var(--frame-width);
    left: var(--frame-width);
    right: var(--frame-width);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    padding: 0 1.5rem;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.site-nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    min-height: 44px;
}
.site-nav-logo img {
    height: 34px;
    border-radius: 6px;
}
.site-nav-logo span {
    font-size: 1.2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    background: var(--gold-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.site-nav-links { display: flex; gap: 0.25rem; align-items: center; }
.site-nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
    padding: 0.75rem 0.6rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.site-nav-links a:hover,
.site-nav-links a.active { color: var(--gold); }

/* ===== FOOTER ===== */
footer {
    margin-top: 4rem;
    padding: 3rem 2rem calc(74px + 1rem);
    text-align: center;
    border-top: 1px solid var(--border);
}
.footer-logo {
    font-size: 1.8rem;
    font-weight: 900;
    background: var(--gold-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
}
.social-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.social-link {
    color: var(--text-muted);
    font-size: 1.3rem;
    transition: color 0.3s;
    text-decoration: none;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.social-link:hover { color: var(--gold); }
.copyright { color: var(--text-dim); font-size: 0.8rem; }
.powered-by {
    margin-top: 1rem;
    font-size: 0.7rem;
    color: var(--text-dim);
}
.powered-by a {
    color: var(--gold-dark);
    text-decoration: none;
    font-weight: 600;
}
.powered-by a:hover { color: var(--gold); }

/* ===== STREAMING LINKS BAR ===== */
.streaming-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.streaming-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
    background: rgba(221, 185, 68, 0.08);
    border: 1px solid var(--border-strong);
    border-radius: 50px;
    color: var(--gold-light);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}
.streaming-link:hover {
    background: rgba(221, 185, 68, 0.2);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(221, 185, 68, 0.15);
}
.streaming-link i { font-size: 1rem; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.1rem 2.8rem;
    min-height: 44px;
    background: var(--gold-gradient);
    color: var(--bg);
    text-decoration: none;
    font-weight: 900;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(221, 185, 68, 0.5);
}
.btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-weight: 500;
}
.alert-success {
    background: rgba(221,185,68,0.15);
    color: var(--gold-light);
    border: 1px solid var(--border-strong);
}
.alert-error {
    background: rgba(220,53,69,0.15);
    color: var(--error);
    border: 1px solid rgba(220,53,69,0.3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
    :root { --frame-width: 6px; }
    .site-nav { padding: 0 0.75rem; height: 50px; }
    .site-nav-logo span { font-size: 1rem; }
    .site-nav-logo img { height: 28px; }
    .site-nav-links { gap: 0; }
    .site-nav-links a { font-size: 0.7rem; padding: 0.75rem 0.5rem; }
    .streaming-links { gap: 0.5rem; }
    .streaming-link { padding: 0.5rem 0.9rem; font-size: 0.7rem; min-height: 44px; }
    footer { padding-bottom: calc(66px + 1rem); }
}

@media (max-width: 400px) {
    :root { --frame-width: 4px; }
}

/* ===== CONTRAST TOGGLE ===== */
.contrast-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: all 0.3s;
    margin-left: 0.25rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.contrast-toggle:hover { color: var(--gold); border-color: rgba(221,185,68,0.4); }
.contrast-toggle.active { color: var(--gold); border-color: var(--gold); background: rgba(221,185,68,0.1); }

/* ===== DAY MODE ===== */
body.day-mode {
    --bg: #FAF7F2;
    --bg-card: #FFFFFF;
    --bg-soft: #F3EDE4;
    --text: #2C2416;
    --text-muted: rgba(44,36,22,0.6);
    --text-dim: rgba(44,36,22,0.4);
    --gold: #B8860B;
    --gold-light: #DAA520;
    --gold-dark: #8B6914;
    --gold-gradient: linear-gradient(135deg, #B8860B 0%, #DAA520 50%, #8B6914 100%);
    --gold-text: linear-gradient(135deg, #B8860B, #DAA520, #8B6914);
    --border: rgba(139,105,20,0.2);
    --border-strong: rgba(139,105,20,0.35);
    --overlay: rgba(0,0,0,0.3);
    --overlay-heavy: rgba(0,0,0,0.5);
    --nav-bg: rgba(250,247,242,0.95);
    --player-bg: rgba(255,255,255,0.95);
    --input-bg: rgba(44,36,22,0.05);
    --error: #dc2626;
}

/* ===== PERSISTENT AUDIO PLAYER ===== */
.ms-player {
    position: fixed;
    bottom: var(--frame-width, 10px);
    left: var(--frame-width, 10px);
    right: var(--frame-width, 10px);
    height: 64px;
    background: var(--player-bg);
    border-top: 1px solid var(--border-strong);
    z-index: 998;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
}

.ms-player-art-wrap { flex-shrink: 0; }
.ms-player-art-video {
    width: 44px; height: 44px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-strong);
    display: none;
}
.ms-player-art-video.active { display: block; }
.ms-player-art-video.active + .ms-player-art { display: none; }
.ms-player-art {
    width: 44px; height: 44px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-strong);
}

.ms-player-info {
    min-width: 0;
    flex-shrink: 1;
    max-width: 180px;
}
.ms-player-title {
    color: var(--gold-light);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-player-artist {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-player-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.ms-player-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.4rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    font-size: 0.85rem;
}
.ms-player-btn:hover { color: var(--gold); }
.ms-player-btn svg { width: 18px; height: 18px; fill: currentColor; }

.ms-btn-play {
    width: 44px; height: 44px;
    background: rgba(221, 185, 68, 0.15);
    border-radius: 50%;
    color: var(--gold);
    padding: 0;
}
.ms-btn-play:hover { background: rgba(221, 185, 68, 0.3); }
.ms-btn-play svg { width: 16px; height: 16px; }

.ms-btn-shuffle.active { color: var(--gold); }
.ms-btn-shuffle.active::after {
    content: '';
    display: block;
    width: 4px; height: 4px;
    background: var(--gold);
    border-radius: 50%;
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
}
.ms-btn-shuffle { position: relative; }

.ms-volume-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--input-bg);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.ms-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
}
.ms-volume-slider::-moz-range-thumb {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: none;
}

.ms-player-progress {
    flex: 1;
    height: 4px;
    background: var(--input-bg);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    min-width: 60px;
}
.ms-player-progress-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.ms-player-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Now-playing highlight on music page */
.song-card.now-playing {
    border-color: var(--border-strong);
    box-shadow: 0 0 12px rgba(221, 185, 68, 0.1);
}

/* Now-playing: pulsing indicator + enhanced glow */
.song-card.now-playing::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    animation: now-playing-pulse 1.5s ease-in-out infinite;
    z-index: 2;
}

@keyframes now-playing-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--gold); }
    50% { opacity: 0.5; box-shadow: 0 0 12px var(--gold), 0 0 24px rgba(221, 185, 68, 0.3); }
}

.ms-player.is-playing {
    border-top-color: var(--gold);
    box-shadow: 0 -2px 20px rgba(221, 185, 68, 0.15);
}

/* Add bottom padding to body for player */
body { padding-bottom: 74px; }

@media (max-width: 700px) {
    .ms-player {
        height: 56px;
        padding: 0 0.5rem;
        gap: 0.4rem;
    }
    .ms-player-art { width: 36px; height: 36px; }
    .ms-player-art-video { width: 36px; height: 36px; }
    .ms-player-info { max-width: 100px; }
    .ms-player-title { font-size: 0.72rem; }
    .ms-player-time { display: none; }
    .ms-volume-slider { display: none; }
    .ms-btn-volume { display: none; }
    .ms-btn-shuffle { display: none; }
    body { padding-bottom: 66px; }
}

@media (max-width: 400px) {
    .ms-player-info { max-width: 70px; }
}

/* ===== TOUCH DEVICES: disable hover scale ===== */
@media (hover: none) {
    .grid-item:hover { transform: none; }
    .album-card:hover { transform: none; }
    .streaming-link:hover { transform: none; }
    .btn:hover { transform: none; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
