/* ============================================
   500 A.D. - Byzantine Empire Strategy Game
   Main Stylesheet - Design System & Core Styles
   ============================================ */

@font-face {
    font-family: 'ImperialDisplayLocal';
    src: url('../assets/fonts/neobyz.eot');
    src: url('../assets/fonts/neobyz.eot?#iefix') format('embedded-opentype'),
        url('../assets/fonts/NEOBRG__1.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* === CSS Variables - Classic Strategy Design System === */
:root {
    /* Colonization-inspired Color Palette */
    --gold: #D4AF37;
    --imperial-gold: #D4AF37;
    --gold-dark: #B8941F;
    --gold-light: #F4D03F;
    --wood-brown: #5D4037;
    --deep-red: #8B0000;
    --byzantine-purple: #702963;
    --byzantine-purple-dark: #3F1D5A;
    --deep-blue: #0F2A4A;
    --byzantine-blue: #2563EB;
    --crimson: #B91C1C;
    --crimson-dark: #7F1D1D;
    --parchment: #F4E4BC;
    --parchment-dark: #D2B48C;
    --parchment-ink: #3B2C17;
    --parchment-ink-soft: #5B472A;
    --parchment-accent: #8B6A14;
    --ink-black: #2C1810;
    --marble-white: #F7F2E7;
    --canvas-bg: #1A1A1A;

    /* UI Aesthetic */
    --bg-primary: url('../assets/textures/parchment.jpg'), var(--parchment);
    --bg-panel: rgba(244, 228, 188, 0.9);
    --bg-card: rgba(210, 180, 140, 0.8);
    --border-classic: 2px solid var(--wood-brown);
    --shadow-classic: 2px 2px 10px rgba(0, 0, 0, 0.4);

    /* Typography - Old World Feel */
    --font-display: 'Old Standard TT', serif;
    --font-body: 'Crimson Text', serif;
    --font-accent: 'ImperialDisplayLocal', 'Old Standard TT', serif;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* === Reset & Base Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background: var(--canvas-bg);
    color: var(--ink-black);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior: none;
    touch-action: pan-x pan-y;
}

/* === Typography === */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--deep-red);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

.feature-title {
    font-family: var(--font-accent);
    letter-spacing: 0.02em;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    line-height: 1.6;
    color: var(--parchment);
}

/* === Screen Management === */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* === Loading Screen === */
#loading-screen {
    position: relative;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--deep-blue) 0%, var(--byzantine-purple-dark) 100%);
    overflow: hidden;
}

#loading-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 42%, rgba(212, 175, 55, 0.09) 0%, rgba(212, 175, 55, 0) 56%),
        url('../assets/images/byzantine_eagle.svg') center 42% / min(72vw, 620px) auto no-repeat;
    opacity: 0.12;
    filter: saturate(0.75) sepia(0.3) contrast(0.95);
    pointer-events: none;
}

#loading-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 48%, rgba(15, 42, 74, 0.15) 0%, rgba(15, 42, 74, 0.42) 58%, rgba(15, 42, 74, 0.62) 100%);
    pointer-events: none;
}

.loading-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 400px;
    padding: var(--spacing-xl);
}

.byzantine-emblem {
    width: 156px;
    height: 156px;
    margin: 0 auto var(--spacing-xl);
    background:
        radial-gradient(circle, rgba(212, 175, 55, 0.12) 0%, rgba(212, 175, 55, 0.02) 58%, rgba(212, 175, 55, 0) 72%),
        url('../assets/images/byzantine_eagle.svg') center / contain no-repeat;
    border-radius: 18px;
    border: 1px solid rgba(244, 208, 63, 0.28);
    box-shadow:
        0 0 34px rgba(212, 175, 55, 0.16),
        inset 0 0 24px rgba(0, 0, 0, 0.18);
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    filter: saturate(0.9) sepia(0.18);
}

.byzantine-emblem::before {
    content: '';
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow:
            0 0 34px rgba(212, 175, 55, 0.16),
            inset 0 0 24px rgba(0, 0, 0, 0.18);
    }

    50% {
        transform: scale(1.05);
        box-shadow:
            0 0 46px rgba(212, 175, 55, 0.24),
            inset 0 0 28px rgba(0, 0, 0, 0.14);
    }
}

.game-title {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, var(--gold-light), var(--imperial-gold), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-subtitle {
    /* font-family: var(--font-display); */
    font-family: var(--font-accent);
    font-size: 1.2rem;
    color: var(--parchment);
    margin-bottom: var(--spacing-xl);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--imperial-gold);
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--imperial-gold), var(--gold-light));
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--gold-light);
}

.loading-text {
    font-size: 0.9rem;
    color: var(--parchment);
    opacity: 0.8;
}

/* === Main Menu === */
#main-menu {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--deep-blue) 0%, var(--byzantine-purple-dark) 50%, var(--crimson-dark) 100%);
    position: relative;
    overflow: hidden;
}

.menu-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(107, 44, 145, 0.1) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.menu-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 500px;
    padding: var(--spacing-xl);
}

.main-menu-nav {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xxl);
}

/* === Buttons === */
.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-xl);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--marble-white);
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid var(--imperial-gold);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    transition: left var(--transition-slow);
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn:hover {
    background: rgba(107, 44, 145, 0.6);
    border-color: var(--gold-light);
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.menu-btn:active {
    transform: translateY(0);
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--byzantine-purple), var(--byzantine-purple-dark));
    border-color: var(--gold-light);
    box-shadow: 0 4px 15px rgba(107, 44, 145, 0.4);
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, var(--byzantine-purple-light), var(--byzantine-purple));
    box-shadow: var(--shadow-gold);
}

.btn-icon {
    font-size: 1.5rem;
}

.btn-text {
    letter-spacing: 0.05em;
}

.choice-btn-disabled {
    cursor: not-allowed;
    filter: saturate(0.65);
    color: rgba(248, 250, 252, 0.8);
    border-color: rgba(212, 175, 55, 0.45);
    background: rgba(30, 41, 59, 0.55);
}

.choice-btn-subtitle {
    display: block;
    opacity: 0.75;
    margin-top: 0.2rem;
}

.choice-btn-detail {
    display: block;
    opacity: 0.7;
    margin-top: 0.2rem;
}

.choice-btn-detail-disabled {
    opacity: 1;
    color: #f7c7c7;
}

.dipl-row {
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 10px;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.35);
}

.dipl-row h3 {
    margin: 0 0 0.35rem 0;
}

.dipl-row p {
    margin: 0.2rem 0;
    font-size: 0.95rem;
}

.dipl-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* === Utility Classes === */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn var(--transition-slow) ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp var(--transition-normal) ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: var(--imperial-gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-light);
}
