/* ========================================
   MAIN.CSS — Festival Madre Tierra XV
   Variables, Reset, Tipografía, Layout Global
   ======================================== */

/* ── @font-face ── */
@font-face {
    font-family: 'Trajan Bold';
    src: url('../fonts/TrajanPro-Bold.otf') format('opentype');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'Trajan';
    src: url('../fonts/TrajanPro-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Bahnschrift';
    src: url('../fonts/BAHNSCHRIFT.TTF') format('truetype');
    font-weight: 400;
    font-display: swap;
}

/* ── Custom Properties ── */
:root {
    /* Paleta */
    --color-tierra:     #8B5E3C;
    --color-verde:      #3B6E47;
    --color-ocre:       #C8972B;
    --color-crema:      #FFEDD5;
    --color-noche:      #1A1A14;
    --color-humo:       #E8E0D0;
    --color-acento:     #D94F2B;

    /* Tipografía */
    --font-titulo:      'Trajan Bold', 'Trajan Pro Bold', serif;
    --font-subtitulo:   'Trajan', 'Trajan Pro', serif;
    --font-cuerpo:      'Bahnschrift', 'DIN Alternate', 'Segoe UI', sans-serif;

    /* Espaciado */
    --section-padding:  6rem 2rem;
    --container-max:    1280px;
    --gap:              2rem;
    --radius-sm:        0.5rem;
    --radius-md:        1rem;
    --radius-lg:        2rem;
    --radius-xl:        3rem;

    /* Transiciones */
    --transition-fast:  0.2s ease;
    --transition-base:  0.4s ease;
    --transition-slow:  0.8s ease;

    /* Z-index scale */
    --z-loader:         9999;
    --z-modal:          5000;
    --z-nav:            1000;
    --z-overlay:        100;
    --z-above:          10;
    --z-base:           1;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-cuerpo);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-noche);
    background-color: var(--color-crema);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Tipografía ── */
h1, h2, h3 {
    font-family: var(--font-titulo);
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h4, h5, h6 {
    font-family: var(--font-subtitulo);
    line-height: 1.3;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

h1 { font-size: clamp(2rem, 5vw, 4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 3rem); }
h3 { font-size: clamp(1.3rem, 3vw, 2rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.5rem); }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    font-family: var(--font-cuerpo);
    margin-bottom: 1em;
    max-width: 70ch;
}

a {
    color: var(--color-ocre);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-acento);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

button {
    font-family: var(--font-cuerpo);
    cursor: pointer;
    border: none;
    background: none;
}

/* ── Utilidades ── */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

.section {
    padding: var(--section-padding);
    position: relative;
    overflow: hidden;
}

.section--dark {
    background-color: var(--color-noche);
    color: var(--color-crema);
}

.section--light {
    background-color: var(--color-crema);
    color: var(--color-noche);
}

.section--verde {
    background-color: var(--color-verde);
    color: var(--color-crema);
}

.section__header {
    text-align: center;
    margin-bottom: 4rem;
}

.section__header h2 {
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section__header h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--color-ocre);
    margin: 0.75rem auto 0;
    border-radius: 2px;
}

.section__header p {
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.85;
    font-size: 1.05rem;
}

/* ── Separadores orgánicos ── */
.section-separator {
    position: relative;
    margin-top: -1px;
    margin-bottom: -1px;
    line-height: 0;
    overflow: hidden;
}

.section-separator svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Botones ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    font-family: var(--font-cuerpo);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
    cursor: pointer;
    border: 2px solid transparent;
}

.btn--primary {
    background: var(--color-ocre);
    color: var(--color-noche);
    border-color: var(--color-ocre);
}

.btn--primary:hover {
    background: var(--color-acento);
    border-color: var(--color-acento);
    color: var(--color-crema);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(200, 151, 43, 0.3);
}

.btn--secondary {
    background: transparent;
    color: var(--color-crema);
    border-color: var(--color-crema);
}

.btn--secondary:hover {
    background: var(--color-crema);
    color: var(--color-noche);
    transform: translateY(-2px);
}

.btn--outline {
    background: transparent;
    color: var(--color-ocre);
    border-color: var(--color-ocre);
}

.btn--outline:hover {
    background: var(--color-ocre);
    color: var(--color-noche);
    transform: translateY(-2px);
}

/* ── Badge / Pill ── */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-xl);
    background: var(--color-ocre);
    color: var(--color-noche);
}

/* ── Page Loader ── */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: var(--z-loader);
    background: var(--color-noche);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader__inner {
    text-align: center;
}

.loader__logo {
    width: 150px;
    height: 150px;
}

.loader__circle {
    stroke-dasharray: 502;
    stroke-dashoffset: 502;
    animation: loaderDraw 2s ease forwards;
}

.loader__bar {
    width: 150px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.loader__progress {
    height: 100%;
    width: 0%;
    background: var(--color-ocre);
    border-radius: 2px;
    animation: loaderProgress 1.8s ease forwards;
}

@keyframes loaderDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes loaderProgress {
    to { width: 100%; }
}

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

/* ── Selection ── */
::selection {
    background: var(--color-ocre);
    color: var(--color-noche);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--color-ocre);
}

/* ── Responsive base ── */
@media (max-width: 768px) {
    :root {
        --section-padding: 4rem 1.25rem;
    }

    .container {
        padding: 0 1.25rem;
    }
}

@media (max-width: 480px) {
    :root {
        --section-padding: 3rem 1rem;
    }
}
