/* ===== POLYMORPH PAGE-SPECIFIC STYLES ===== */
/* Page-specific overrides and customizations */
/* Uses theme tokens for consistency */

@import url('theme-tokens.css');

/* ===== CUSTOM SCROLLBAR ===== */
/* WebKit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--poly-color-bg-darker);
    border-left: 1px solid var(--poly-color-border-subtle);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4a5f7f 0%, #2d3e56 100%);
    border: 1px solid var(--poly-color-border-subtle);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5a6f8f 0%, #3d4e66 100%);
    border-color: var(--poly-color-primary);
    box-shadow: 0 0 8px var(--poly-color-primary-glow);
}

::-webkit-scrollbar-thumb:active {
    background: var(--poly-color-primary);
}

::-webkit-scrollbar-corner {
    background: var(--poly-color-bg-darker);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #4a5f7f #1a1e25;
}

/* ===== BASE STYLES (Shared across all pages) ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background: linear-gradient(180deg, #3a3f47 0%, #2a2e35 100%);
    color: var(--poly-color-text);
    font-family: var(--poly-font-secondary);
    font-weight: var(--poly-font-weight-light);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* Subtle grid overlay for body */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--poly-grid-pattern);
    background-size: var(--poly-grid-size);
    pointer-events: none;
    z-index: 0;
    opacity: 0.25;
}

body {
    margin: 0;
    padding: 0;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--poly-font-primary);
    font-weight: var(--poly-font-weight-heavy);
    text-transform: uppercase;
    letter-spacing: var(--poly-letter-spacing-tight);
    margin-bottom: var(--poly-space-base);
    position: relative;
    z-index: var(--poly-z-overlay);
}

h1 {
    font-family: var(--poly-font-display);
    font-weight: var(--poly-font-weight-display);
    font-size: clamp(4rem, 12vw, 12rem);
    line-height: 0.8;
    margin-bottom: var(--poly-space-2xl);
    color: var(--poly-color-text);
    text-shadow: var(--poly-text-shadow-primary);
}

h2 {
    font-family: var(--poly-font-display);
    font-weight: var(--poly-font-weight-display);
    font-size: clamp(3rem, 8vw, 8rem);
    line-height: 0.9;
    margin-bottom: var(--poly-space-2xl);
    color: var(--poly-color-text);
    text-shadow: var(--poly-text-shadow-subtle);
}

h3 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
    margin-bottom: var(--poly-space-xl);
    color: var(--poly-color-text);
}

p {
    font-family: var(--poly-font-secondary);
    font-weight: var(--poly-font-weight-light);
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    line-height: 1.6;
    margin-bottom: var(--poly-space-2xl);
    max-width: 65ch;
    color: var(--poly-color-text);
    position: relative;
    z-index: var(--poly-z-overlay);
}

a {
    color: var(--poly-color-primary);
    text-decoration: underline;
    font-family: var(--poly-font-secondary);
    font-weight: var(--poly-font-weight-light);
    transition: var(--poly-transition-fast);
}

a:hover {
    color: var(--poly-color-text);
    text-shadow: var(--poly-glow-primary);
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: var(--poly-z-overlay);
}

/* ===== SECTION STYLES ===== */
.section {
    padding: 4rem 0;
    position: relative;
    background: transparent;
}

.section-bordered {
    border-top: 2px solid var(--poly-color-border-subtle);
    border-bottom: 2px solid var(--poly-color-border-subtle);
    box-shadow:
        inset 0 2px 0 rgba(109, 212, 242, 0.1),
        inset 0 -2px 0 rgba(109, 212, 242, 0.1);
}

.section-dark {
    background: var(--poly-color-panel-darker);
    box-shadow: var(--poly-shadow-inset-deep);
}

.section-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--poly-grid-pattern);
    background-size: var(--poly-grid-size);
    pointer-events: none;
    opacity: 0.3;
    z-index: var(--poly-z-base);
}

.section-center {
    text-align: center;
}

.section-center .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-panel {
    background: var(--poly-color-panel-dark);
    border-top: 2px solid var(--poly-color-primary);
    border-bottom: 2px solid var(--poly-color-primary);
    box-shadow:
        inset 0 2px 0 rgba(109, 212, 242, 0.3),
        inset 0 -2px 0 rgba(109, 212, 242, 0.3),
        inset 0 4px 20px rgba(109, 212, 242, 0.1),
        0 10px 40px rgba(0, 0, 0, 0.6);
    position: relative;
    padding: 3rem 0;
}

.section-panel::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px dashed var(--poly-color-border-dashed);
    pointer-events: none;
    z-index: var(--poly-z-base);
}

.section-accent::after {
    content: '';
    position: absolute;
    top: 0;
    right: 5%;
    width: 80px;
    height: 4px;
    background: var(--poly-color-primary);
    box-shadow: var(--poly-glow-primary);
}

.section-accent::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 80px;
    height: 4px;
    background: var(--poly-color-primary);
    box-shadow: var(--poly-glow-primary);
}

/* ===== HERO SECTION ===== */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.hero > div {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero h1 {
    font-size: clamp(4rem, 10vw, 10rem);
    color: #ffffff;
    font-family: var(--poly-font-display);
    font-weight: var(--poly-font-weight-display);
    text-transform: uppercase;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 auto 2rem auto;
    text-align: center;
    width: 100%;
    display: block;
}

.hero p,
.hero div p {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: #ffffff;
    font-family: var(--poly-font-secondary);
    font-weight: 200;
    margin-bottom: 0;
    text-align: center;
    width: 100%;
}

.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ===== HERO VIDEO SECTION ===== */
.hero-video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background: var(--poly-color-bg-dark);
    border-top: 2px solid var(--poly-color-border-subtle);
    border-bottom: 2px solid var(--poly-color-border-subtle);
}

.hero-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.hero-video-bg iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero-video-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #ffffff;
    z-index: 2;
    padding: 0 2rem;
}

.hero-video-overlay h2 {
    font-family: var(--poly-font-primary);
    font-weight: var(--poly-font-weight-heavy);
    text-transform: uppercase;
    letter-spacing: var(--poly-letter-spacing-tight);
    font-size: clamp(2rem, 6vw, 6rem);
    margin-bottom: var(--poly-space-base);
    text-shadow: var(--poly-text-shadow-primary);
}

.hero-video-overlay h2::before {
    content: '// ';
    color: var(--poly-color-primary);
}

.hero-video-overlay p {
    font-family: var(--poly-font-secondary);
    font-weight: var(--poly-font-weight-light);
    font-size: clamp(1rem, 3vw, 2rem);
    margin: 0;
    color: var(--poly-color-text);
}

/* ===== VIDEO CONTROLS ===== */
.video-controls {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    z-index: 10;
    display: flex;
    gap: 0.75rem;
}

.video-control-btn {
    width: 48px;
    height: 48px;
    background: var(--poly-surface-40);
    backdrop-filter: blur(8px);
    border: 2px solid var(--poly-color-border-subtle);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--poly-transition-fast);
    color: var(--poly-color-text-dim);
}

.video-control-btn:hover {
    background: var(--poly-surface-50);
    border-color: var(--poly-color-primary);
    color: var(--poly-color-primary);
    box-shadow: var(--poly-glow-primary);
    transform: scale(1.05);
}

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

.video-control-btn svg {
    width: 24px;
    height: 24px;
}

/* Show/hide sound icons based on state */
.video-control-btn .sound-on {
    display: none;
}

.video-control-btn .sound-off {
    display: block;
}

.video-control-btn.unmuted .sound-on {
    display: block;
}

.video-control-btn.unmuted .sound-off {
    display: none;
}

.video-control-btn.unmuted {
    border-color: var(--poly-color-primary);
    color: var(--poly-color-primary);
}

@media (max-width: 768px) {
    .video-controls {
        bottom: 1rem;
        right: 1rem;
        gap: 0.5rem;
    }
    
    .video-control-btn {
        width: 40px;
        height: 40px;
    }
    
    .video-control-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* ===== RESPONSIVE BASE STYLES ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    .section {
        padding: 4rem 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
}

/* ===== END BASE STYLES ===== */

/* ===== INDEX PAGE (Homepage) ===== */
/* Homepage uses default theme - no overrides needed */

/* ===== CREATURES PAGE ===== */
/* Creature content sections - variant specific with deeper gradients */
.creature-content {
    padding: 3rem 0;
    position: relative;
    box-shadow: var(--poly-shadow-inset-deep);
}

.creature-content.variant-fire {
    background: linear-gradient(180deg, #3d4f66 0%, #2a3644 100%);
}

.creature-content.variant-water {
    background: linear-gradient(180deg, #2a3f5f 0%, #1a2944 100%);
}

.creature-content.variant-earth {
    background: linear-gradient(180deg, #3a4f37 0%, #2a3927 100%);
}

.creature-content.variant-air {
    background: linear-gradient(180deg, #3d3f52 0%, #2a2c3f 100%);
}

/* Creature info sections - tighter spacing */
.creature-info-fullwidth {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    position: relative;
    z-index: var(--poly-z-overlay);
}

.creature-info-fullwidth h2,
.creature-info-fullwidth h3 {
    margin-bottom: var(--poly-space-xl);
}

.creature-info-fullwidth p {
    margin-bottom: var(--poly-space-2xl);
}

/* Responsive creature info */
@media (max-width: 1024px) {
    .creature-info-fullwidth {
        grid-template-columns: 1fr;
        gap: 3rem;
        padding: 5rem 2rem;
    }
}

@media (max-width: 768px) {
    .creature-info-fullwidth {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 4rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .creature-info-fullwidth {
        padding: 3rem 1rem;
    }
}

/* ===== LORE PAGE ===== */
/* Lore page hero - darker with deep gradient */
body:has(.lore-page) .hero,
.lore-page-hero {
    background: linear-gradient(180deg, #2a2e35 0%, #1a1e25 100%);
    box-shadow: var(--poly-shadow-inset-deep);
}

/* Lore scene cards - deeper gradient */
.lore-scenes-grid {
    background: linear-gradient(180deg, #3a3f47 0%, #2a2e35 100%);
    position: relative;
    padding: 3rem 0;
}

/* Add grid pattern to lore scenes */
.lore-scenes-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--poly-grid-pattern);
    background-size: var(--poly-grid-size);
    pointer-events: none;
    opacity: 0.2;
    z-index: var(--poly-z-base);
}

.lore-scene-card {
    position: relative;
    z-index: var(--poly-z-overlay);
}

.lore-card-text h3 {
    color: var(--poly-color-primary);
    margin-bottom: var(--poly-space-base);
}

.lore-card-text h3::before {
    content: '// ';
    color: var(--poly-color-primary);
}

/* Static lore section with borders and deep gradient */
.lore-static-section {
    background: var(--poly-color-panel-dark);
    border-top: 2px solid var(--poly-color-border-subtle);
    border-bottom: 2px solid var(--poly-color-border-subtle);
    box-shadow:
        inset 0 2px 0 rgba(109, 212, 242, 0.2),
        inset 0 -2px 0 rgba(109, 212, 242, 0.2),
        inset 0 4px 20px rgba(109, 212, 242, 0.08);
    padding: 4rem 0;
}

/* ===== RELIC VIEWER PAGE ===== */
/* Relic viewer is handled by relic-viewer.css */
/* No additional page-specific styles needed */

/* ===== UNIVERSAL PAGE ELEMENTS ===== */

/* Page-specific hero backgrounds */
.hero-dark {
    background: var(--poly-color-bg-darker) !important;
}

.hero-gradient {
    background: linear-gradient(180deg, var(--poly-color-bg-dark) 0%, var(--poly-color-bg) 100%);
}

/* Full-width sections with custom backgrounds */
.section-fullwidth {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Variant-specific accents (for themed sections) */
.variant-fire-accent {
    border-color: var(--poly-color-legendary);
    --poly-color-primary: var(--poly-color-legendary);
    --poly-color-primary-glow: rgba(245, 158, 11, 0.6);
}

.variant-water-accent {
    border-color: var(--poly-color-rare);
    --poly-color-primary: var(--poly-color-rare);
}

.variant-earth-accent {
    border-color: var(--poly-color-common);
    --poly-color-primary: var(--poly-color-common);
}

.variant-boss-accent {
    border-color: var(--poly-color-boss);
    --poly-color-primary: var(--poly-color-boss);
    --poly-color-primary-glow: rgba(236, 72, 153, 0.6);
}

/* ===== SPECIAL PAGE TRANSITIONS ===== */

/* Page load animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-animate {
    animation: fadeInUp 0.8s ease-out;
}

/* Stagger animations for multiple elements */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* ===== ACCESSIBILITY & PERFORMANCE ===== */

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .page-animate,
    .stagger-1,
    .stagger-2,
    .stagger-3,
    .stagger-4 {
        animation: none;
    }
}

/* Print styles */
@media print {
    .hero,
    .creature-container,
    .lore-scene-container,
    .section-grid::after,
    body::after {
        background: white !important;
        border: none !important;
    }

    .section-grid::after,
    body::after {
        display: none !important;
    }
}
