/* ==========================================================================
   Shared styles for lizzyperson.com (used by index.php and viewFacts.php)
   ========================================================================== */

:root {
    --bg-deep: #0a0e17;
    --bg-card: rgba(20, 28, 45, 0.85);
    --bg-card-hover: rgba(30, 42, 65, 0.9);
    --accent-gold: #d4a853;
    --accent-gold-light: #f0d088;
    --accent-copper: #b87333;
    --text-cream: #f5f0e8;
    --text-muted: #9aa3b8;
    --border-subtle: rgba(212, 168, 83, 0.15);
    --glow-gold: rgba(212, 168, 83, 0.4);
    --glow-gold-soft: rgba(212, 168, 83, 0.1);
    --shadow-deep: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --surface-1: rgba(255, 255, 255, 0.03);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-3: rgba(255, 255, 255, 0.1);
    --key-bg: rgba(255, 255, 255, 0.1);
    --key-border: rgba(255, 255, 255, 0.2);
    --danger-soft: #e57373;
    --success-soft: #81c784;
    --star-color: var(--text-cream);
    --footer-bg: rgba(10, 14, 23, 0.95);
    --cosmic-mid: rgba(20, 28, 45, 1);
}

/* Light theme — warm parchment take on the same cosmic palette */
[data-theme="light"] {
    --bg-deep: #f6f1e7;
    --bg-card: rgba(255, 252, 245, 0.88);
    --bg-card-hover: rgba(255, 255, 255, 0.96);
    --accent-gold: #8a6420;
    --accent-gold-light: #b8893a;
    --accent-copper: #7d4f1d;
    --text-cream: #2b2417;
    --text-muted: #675e4d;
    --border-subtle: rgba(138, 100, 32, 0.25);
    --glow-gold: rgba(184, 137, 58, 0.3);
    --glow-gold-soft: rgba(184, 137, 58, 0.12);
    --shadow-deep: 0 25px 50px -12px rgba(90, 70, 30, 0.18);
    --surface-1: rgba(60, 45, 15, 0.05);
    --surface-2: rgba(60, 45, 15, 0.09);
    --surface-3: rgba(60, 45, 15, 0.12);
    --key-bg: rgba(60, 45, 15, 0.08);
    --key-border: rgba(60, 45, 15, 0.18);
    --danger-soft: #a83232;
    --success-soft: #2e7d32;
    --star-color: #b8893a;
    --footer-bg: rgba(246, 241, 231, 0.95);
    --cosmic-mid: #fdf9f0;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg-deep);
    min-height: 100vh;
    color: var(--text-cream);
    overflow-x: hidden;
    position: relative;
}

/* Inline SVG icons (replaces Font Awesome) */
.icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: -0.125em;
}

/* Cosmic background */
.cosmic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, var(--glow-gold-soft) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(100, 140, 200, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, var(--cosmic-mid) 0%, var(--bg-deep) 100%);
    z-index: -2;
}

/* Floating stars */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--star-color);
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

[data-theme="light"] .star {
    opacity: 0.35 !important;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Main layout */
.main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    padding-bottom: 100px;
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.site-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 1rem;
    position: relative;
}

.site-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 600;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-light) 50%, var(--accent-copper) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 40px var(--glow-gold);
}

.site-title--sub {
    font-size: clamp(2rem, 5vw, 3rem);
    text-shadow: none;
}

.site-tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.1em;
}

/* Theme toggle */
.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--accent-gold);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--accent-gold);
    color: var(--bg-deep);
    box-shadow: 0 0 20px var(--glow-gold);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    padding: 2rem;
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    opacity: 0.5;
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-deep), 0 0 40px var(--glow-gold-soft);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-copper));
    border-radius: 10px;
    font-size: 1.1rem;
    color: var(--bg-deep);
}

[data-theme="light"] .card-icon {
    color: #fdf9f0;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-cream);
}

/* Fact items */
.fact-item {
    padding: 1rem 1.25rem;
    background: var(--surface-1);
    border-radius: 12px;
    border-left: 3px solid var(--accent-gold);
    font-size: 0.95rem;
    line-height: 1.6;
    transition: all 0.3s ease;
    animation: fact-in 0.45s ease both;
}

.fact-item:nth-child(2)  { animation-delay: 0.03s; }
.fact-item:nth-child(3)  { animation-delay: 0.06s; }
.fact-item:nth-child(4)  { animation-delay: 0.09s; }
.fact-item:nth-child(5)  { animation-delay: 0.12s; }
.fact-item:nth-child(6)  { animation-delay: 0.15s; }
.fact-item:nth-child(7)  { animation-delay: 0.18s; }
.fact-item:nth-child(8)  { animation-delay: 0.21s; }
.fact-item:nth-child(9)  { animation-delay: 0.24s; }
.fact-item:nth-child(10) { animation-delay: 0.27s; }
.fact-item:nth-child(n+11) { animation-delay: 0.3s; }

@keyframes fact-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fact-item:hover {
    background: var(--surface-2);
    transform: translateX(4px);
}

.fact-number {
    color: var(--accent-gold);
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Pagination buttons (shared look) */
.page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.page-buttons {
    display: flex;
    gap: 0.5rem;
}

.page-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    color: var(--accent-gold);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.page-btn:hover:not(:disabled):not(.disabled) {
    background: var(--accent-gold);
    color: var(--bg-deep);
}

.page-btn:disabled,
.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 600px) {
    .page-btn {
        padding: 0.65rem 1.2rem;
    }
}

/* Loading state */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glow-gold-soft);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error state */
.error-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.error-state .icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.retry-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    color: var(--accent-gold);
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: var(--accent-gold);
    color: var(--bg-deep);
}

/* Footer */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--footer-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    padding: 1rem 2rem;
    z-index: 100;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-content a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content a:hover {
    color: var(--accent-gold-light);
}

.icon-heart {
    color: var(--danger-soft);
}

/* Inline text link (spotlight "browse all", search "clear") */
.clear-search {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--accent-gold);
    text-decoration: none;
}

.clear-search:hover {
    color: var(--accent-gold-light);
}

@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Keyboard hint */
.keyboard-hint {
    display: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

@media (min-width: 768px) {
    .keyboard-hint {
        display: block;
    }
}

.key {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: var(--key-bg);
    border: 1px solid var(--key-border);
    border-radius: 4px;
    font-size: 0.7rem;
    margin: 0 0.2rem;
}

/* Skip to content for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-gold);
    color: var(--bg-deep);
    padding: 8px;
    z-index: 100;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* Visually hidden but accessible */
.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;
}

/* Visible focus for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .star,
    .fact-item,
    .play-button.playing {
        animation: none !important;
    }
    .card:hover,
    .fact-item:hover,
    .generate-btn:hover {
        transform: none;
    }
    * {
        transition-duration: 0.01ms !important;
    }
}
