/* ═══════════════════════════════════════════════════════════
   PÚNYCODEX — Global Design System
   Tokens, reset, typography, and shared components.
   Loaded first by main.css, temple-base.css, and search-system.css.
   ═══════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
    /* Depth palette */
    --void: #030305;
    --void-rgb: 3, 3, 5;
    --abyss: #06060a;
    --deep: #0c0c12;
    --surface: #14141c;
    --surface-raised: #1c1c26;
    --surface-raised-rgb: 28, 28, 38;
    --hover: #282834;
    --hover-bright: #343444;
    --border: rgba(242, 242, 245, 0.08);
    --border-strong: rgba(242, 242, 245, 0.14);

    /* Gold palette */
    --gold: #D4AF37;
    --gold-rgb: 212, 175, 55;
    --gold-bright: #F2D56F;
    --gold-dim: rgba(212, 175, 55, 0.10);
    --gold-glow: rgba(212, 175, 55, 0.30);
    --gold-glow-strong: rgba(212, 175, 55, 0.55);
    --gold-text-shadow: 0 0 60px rgba(212, 175, 55, 0.28);

    /* Accent palette */
    --blue: #5B7FFF;
    --blue-rgb: 91, 127, 255;
    --blue-glow: rgba(91, 127, 255, 0.25);
    --crimson: #C41E3A;
    --emerald: #3EB489;
    --emerald-rgb: 62, 180, 137;

    /* Tier palette */
    --tier-dual: var(--gold);
    --tier-1: var(--emerald);
    --tier-2: var(--blue);

    /* Text */
    --text-primary: #F2F2F5;
    --text-secondary: #9EA2B3;
    --text-dim: #5F647A;
    --text-faint: #3A3E52;

    /* Typography */
    --font-display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
    --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;

    /* Type scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: clamp(2rem, 4vw, 3rem);
    --text-5xl: clamp(2.5rem, 5vw, 4rem);
    --text-6xl: clamp(3rem, 7vw, 5.5rem);
    --text-7xl: clamp(3.5rem, 9vw, 7.5rem);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 96px;
    --space-10: 128px;
    --space-11: 192px;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.42);
    --shadow-gold: 0 0 30px rgba(212, 175, 55, 0.15);
    --shadow-blue: 0 0 30px rgba(91, 127, 255, 0.15);

    /* Animation */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-exit: cubic-bezier(0.7, 0, 0.84, 0);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-dramatic: cubic-bezier(0.87, 0, 0.13, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 600ms;
    --duration-dramatic: 1200ms;

    /* Layout */
    --container-max: 1400px;
    --container-narrow: 980px;
    --nav-height: 72px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--void);
    overflow-x: hidden;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-smooth);
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

/* ─── Typography Utilities ─── */
.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }
.text-6xl { font-size: var(--text-6xl); }
.text-7xl { font-size: var(--text-7xl); }

.display-xl {
    font-family: var(--font-display);
    font-size: var(--text-7xl);
    font-weight: 600;
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.display-lg {
    font-family: var(--font-display);
    font-size: var(--text-6xl);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.01em;
}

.display-md {
    font-family: var(--font-display);
    font-size: var(--text-5xl);
    font-weight: 500;
    line-height: 1.05;
}

.heading-lg {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 500;
    line-height: 1.15;
}

.heading-md {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 500;
    line-height: 1.25;
}

.body-lg {
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--text-secondary);
}

.body-md {
    font-size: var(--text-base);
    line-height: 1.65;
    color: var(--text-secondary);
}

.body-sm {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-dim);
}

.label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-dim { color: var(--text-dim); }
.text-gold { color: var(--gold); }
.text-blue { color: var(--blue); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ─── Layout Utilities ─── */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(var(--space-5), 5vw, var(--space-8));
}

.container-narrow {
    max-width: var(--container-narrow);
}

.section {
    position: relative;
    padding: var(--space-10) 0;
}

.section-header {
    margin-bottom: var(--space-8);
    text-align: center;
}

.section-eyebrow {
    display: inline-block;
    margin-bottom: var(--space-4);
    color: var(--gold);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.section-title {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 500;
    line-height: 1.1;
    margin-bottom: var(--space-4);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ─── Buttons ─── */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--duration-fast) var(--ease-smooth),
                box-shadow var(--duration-fast) var(--ease-smooth),
                background var(--duration-fast) var(--ease-smooth),
                border-color var(--duration-fast) var(--ease-smooth);
    will-change: transform;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform var(--duration-slow) var(--ease-enter);
}

.btn:hover::before {
    transform: translateX(120%);
}

.btn:hover {
    transform: translateY(-2px);
}

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

.btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.btn-primary {
    background: var(--gold);
    color: var(--void);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
    background: var(--gold-bright);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--gold);
    border: 1px solid rgba(212, 175, 55, 0.45);
    box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.05);
}

.btn-outline:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.08);
    box-shadow: inset 0 0 30px rgba(212, 175, 55, 0.1), 0 4px 20px rgba(212, 175, 55, 0.15);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.btn-ghost:hover {
    color: var(--gold);
    background: rgba(212, 175, 55, 0.06);
}

.btn-lg {
    padding: var(--space-4) var(--space-7);
    font-size: var(--text-base);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

/* ─── Cards ─── */
.card {
    position: relative;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--duration-normal) var(--ease-enter),
                box-shadow var(--duration-normal) var(--ease-enter),
                border-color var(--duration-normal) var(--ease-enter);
    will-change: transform;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), transparent 40%, transparent 60%, rgba(212, 175, 55, 0.06));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-smooth);
}

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-lg), var(--shadow-gold);
}

.card:hover::before {
    opacity: 1;
}

.card-body {
    padding: var(--space-5);
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
}

.badge-gold {
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold-bright);
    border-color: rgba(212, 175, 55, 0.25);
}

.badge-blue {
    background: rgba(91, 127, 255, 0.12);
    color: var(--blue);
    border-color: rgba(91, 127, 255, 0.25);
}

.badge-emerald {
    background: rgba(62, 180, 137, 0.12);
    color: var(--emerald);
    border-color: rgba(62, 180, 137, 0.25);
}

.badge-dim {
    background: rgba(242, 242, 245, 0.05);
    color: var(--text-secondary);
    border-color: var(--border);
}

/* ─── Glass Surface ─── */
.glass {
    background: rgba(var(--surface-raised-rgb), 0.72);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--border);
}

/* ─── Scroll Reveal Base ─── */
.reveal-up,
.reveal-scale,
.reveal-fade,
.reveal-stagger {
    opacity: 0;
    transition: opacity var(--duration-slow) var(--ease-enter),
                transform var(--duration-slow) var(--ease-enter);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}

.reveal-up {
    transform: translateY(30px);
}

.reveal-scale {
    transform: scale(0.92);
}

.reveal-fade {
    transform: none;
}

.reveal-stagger {
    transform: translateY(20px);
}

.reveal-up.revealed,
.reveal-scale.revealed,
.reveal-fade.revealed,
.reveal-stagger.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

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

::-webkit-scrollbar-track {
    background: var(--void);
}

::-webkit-scrollbar-thumb {
    background: var(--text-faint);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* ─── Selection ─── */
::selection {
    background: rgba(212, 175, 55, 0.25);
    color: var(--text-primary);
}

/* ─── Focus visible ─── */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ─── 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;
    }

    .reveal-up,
    .reveal-scale,
    .reveal-fade,
    .reveal-stagger {
        opacity: 1;
        transform: none;
    }
}
