:root {
    --gold: #C5A028;
    --gold-light: #E8D18D;
    --sinople: #1B4332;
    --azur: #002855;
    --bg-dark: #0A0A0A;
    --bg-light: #FDFBF7;
    --text-primary: #1A1A1A;
    --text-secondary: #4A4A4A;
    --accent: #8B0000; /* Deep Red for details */
}

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

body {
    font-family: 'Lora', serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 2rem;
    transition: background 0.4s ease, padding 0.4s ease, box-shadow 0.4s ease;
}

.navbar.scrolled {
    background: rgba(5, 5, 5, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.9rem 2rem;
    box-shadow: 0 2px 24px rgba(0,0,0,0.5);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.nav-shield {
    width: 34px;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(197, 160, 40, 0.35));
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0;
    width: 0; height: 1px;
    background: var(--gold);
    transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--gold); }
.nav-links a:hover::after { width: 100%; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1100;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
    transition: all 0.35s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav-links {
        position: fixed;
        top: 0; right: -100%;
        width: 72%; max-width: 300px;
        height: 100vh;
        background: rgba(5, 5, 5, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        border-left: 1px solid rgba(197, 160, 40, 0.15);
    }

    .nav-links.open { right: 0; }
    .nav-links a { font-size: 0.9rem; letter-spacing: 3px; }
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--gold);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: white;
    text-align: center;
    overflow: hidden;
    /* Fondo heráldico: gradiente azur+sinople + rejilla de rombos dorados */
    background:
        radial-gradient(ellipse 75% 45% at 50% 0%,   rgba(197, 160, 40, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 55% 65% at 10% 90%,  rgba(0,  28,  85, 0.45) 0%, transparent 60%),
        radial-gradient(ellipse 55% 65% at 90% 90%,  rgba(10, 40,  18, 0.45) 0%, transparent 60%),
        repeating-linear-gradient( 45deg, rgba(197,160,40,0.028) 0, rgba(197,160,40,0.028) 1px, transparent 0, transparent 52px),
        repeating-linear-gradient(-45deg, rgba(197,160,40,0.028) 0, rgba(197,160,40,0.028) 1px, transparent 0, transparent 52px),
        linear-gradient(170deg, #04080F 0%, #000D1E 45%, #050E08 100%);
}

/* Escudo fantasma como marca de agua */
.hero::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(580px, 78vw);
    height: min(580px, 78vw);
    background: url('assets/img/escudo_valderrey.png') center / contain no-repeat;
    opacity: 0.05;
    pointer-events: none;
    z-index: 1;
}

/* Pulso suave del aura dorada superior */
.hero::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(197,160,40,0.07) 0%, transparent 100%);
    animation: heroAura 9s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes heroAura {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}

.overlay { display: none; }

.hero-content {
    z-index: 10;
    padding-top: 5rem;
}

.main-shield-wrapper {
    margin-bottom: 2rem;
}

.floating-shield {
    width: clamp(110px, 22vw, 220px);
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.4));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3.5rem, 12vw, 7rem);
    font-weight: 900;
    letter-spacing: clamp(0.2rem, 2vw, 0.5rem);
    text-transform: uppercase;
    margin: 1rem 0;
    background: linear-gradient(to bottom, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.divider {
    width: 100px;
    height: 3px;
    background: var(--gold);
    margin: 1.5rem auto;
}

.hero-tagline {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.85rem, 3vw, 1.4rem);
    letter-spacing: clamp(0.05rem, 1vw, 0.2rem);
    color: var(--gold-light);
    padding: 0 1rem;
}

/* CTA Button */
.btn-hero {
    display: inline-block;
    margin-top: 2.5rem;
    padding: 1rem 2.5rem;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: color 0.4s ease;
}

.btn-hero::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: var(--gold);
    transition: left 0.4s ease;
    z-index: -1;
}

.btn-hero:hover { color: var(--bg-dark); }
.btn-hero:hover::before { left: 0; }

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.scroll-indicator span {
    display: block;
    width: 30px;
    height: 50px;
    border: 2px solid white;
    border-radius: 25px;
    position: relative;
}

.scroll-indicator span::before {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll-down 2s infinite;
}

@keyframes scroll-down {
    0% { opacity: 0; top: 8px; }
    50% { opacity: 1; }
    100% { opacity: 0; top: 30px; }
}

/* Sections General */
.section-padding { padding: 100px 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.section-dark { background-color: var(--bg-dark); color: white; }
.center { text-align: center; }

.section-label {
    display: block;
    font-family: 'Cinzel', serif;
    color: var(--gold);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    font-weight: 700;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    margin-bottom: 2.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.lead {
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 1.5rem;
    font-style: italic;
}

p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.section-dark p { color: #BBB; }

/* Image Placeholder for Sophistication */
.image-placeholder {
    height: 500px;
    background: linear-gradient(var(--gold-light), var(--gold));
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 20px 20px 60px rgba(0,0,0,0.1);
}

.etimologia-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: multiply;
    opacity: 0.8;
    filter: sepia(0.3);
}

.castle-outline {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url('https://www.transparenttextures.com/patterns/aged-paper.png');
    mix-blend-mode: multiply;
}

/* Historia */
.historia-intro {
    max-width: 820px;
    margin: 0 auto 4rem;
}

.historia-intro .lead {
    font-size: 1.25rem;
    text-align: center;
    color: var(--text-secondary);
}

.historia-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.historia-card {
    padding: 2.5rem;
    border-radius: 12px;
    background: white;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 8px 30px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.historia-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 45px rgba(0,0,0,0.1);
}

.historia-era {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 0.68rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: white;
    background: var(--azur);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    margin-bottom: 1.2rem;
}

.historia-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.45rem;
    color: var(--azur);
    margin-bottom: 1rem;
}

.historia-card p {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.historia-card p:last-child { margin-bottom: 0; }

@media (max-width: 768px) {
    .historia-grid { grid-template-columns: 1fr; }
}

/* Benavides de Órbigo */
.benavides-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 4rem;
    align-items: start;
    margin-top: 3.5rem;
}

.benavides-text p {
    margin-bottom: 1.5rem;
}

.benavides-aside {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.location-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(197, 160, 40, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.location-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.location-detail:last-child { border-bottom: none; }

.location-label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
}

.location-value {
    font-family: 'Lora', serif;
    font-size: 0.95rem;
    color: #CCC;
    text-align: right;
}

.benavides-quote {
    border-left: 3px solid var(--gold);
    padding: 1rem 1.5rem;
    margin: 0;
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--gold-light);
    background: rgba(197, 160, 40, 0.05);
    border-radius: 0 8px 8px 0;
}

@media (max-width: 768px) {
    .benavides-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

/* Heraldry Analysis */
.shield-analysis {
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    margin-top: 3rem;
}

.shield-part {
    text-align: center;
    flex: 1;
}

.color-swatch {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    border: 3px solid var(--gold);
}

.sinople { background: var(--sinople); }
.azur { background: var(--azur); }
.oro { background: linear-gradient(var(--gold-light), var(--gold)); }

/* Notable Personalities Grid */
.notable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.notable-card {
    background: white;
    padding: 3rem 2rem;
    text-align: center;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.notable-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 5px;
    background: linear-gradient(to right, var(--gold), var(--gold-light));
    transform: scaleX(0);
    transition: transform 0.4s ease;
    transform-origin: left;
}

.notable-card:hover {
    transform: translateY(-15px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.1);
}

.notable-card:hover::before {
    transform: scaleX(1);
}

.notable-image-wrapper {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--gold);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.notable-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.notable-card:hover .notable-photo {
    transform: scale(1.1);
}

.btn-notable {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--gold);
    color: white;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 1px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-notable:hover {
    background: var(--azur);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.notable-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    display: block;
}

.notable-card h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--azur);
    margin-bottom: 0.5rem;
}

.notable-meta {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.notable-card p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Distribution Section Styles */
.distribution-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
    align-items: center;
    margin-top: 3rem;
}

.provinces-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.province-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.province-name {
    width: 120px;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--gold-light);
}

.province-bar-wrapper {
    flex-grow: 1;
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
}

.province-bar {
    height: 100%;
    background: linear-gradient(to right, var(--gold-light), var(--gold));
    border-radius: 6px;
    transition: width 1.5s ease-out;
}

.province-count {
    width: 60px;
    text-align: right;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: var(--gold);
}

.distribution-info {
    text-align: center;
    padding: 3rem;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    border: 1px solid rgba(197, 160, 40, 0.2);
}

.total-badge {
    margin-bottom: 2rem;
}

.total-label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 3px;
    color: var(--gold);
    text-transform: uppercase;
}

.total-number {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    margin: 0.5rem 0;
    color: white;
}

.total-detail {
    font-family: 'Lora', serif;
    font-style: italic;
    color: var(--gold-light);
}

.distribution-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #BBB;
}

@media (max-width: 992px) {
    .distribution-grid { grid-template-columns: 1fr; gap: 3rem; }
}

/* Footer */
.final-footer {
    background-color: #050505;
    padding: 80px 0 40px;
    text-align: center;
    color: white;
}

.footer-logo {
    width: 80px;
    margin-bottom: 2rem;
    opacity: 0.7;
}

.footer-tradition {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--gold);
}

.footer-divider {
    width: 50px;
    height: 1px;
    background: #333;
    margin: 2rem auto;
}

.footer-author {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold-light);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.footer-contact a {
    font-family: 'Lora', serif;
    font-size: 0.95rem;
    color: #888;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-contact a:hover {
    color: var(--gold);
}

.copyright {
    font-size: 0.9rem;
    color: #666;
}

/* Responsive */
@media (max-width: 992px) {
    .grid-2 { grid-template-columns: 1fr; }
    .timeline::before { left: 0; }
    .timeline-item { width: 90%; margin-left: 2rem !important; text-align: left !important; }
    .timeline-dot { left: -2rem; }
    .shield-analysis { flex-direction: column; }
}

@media (max-width: 768px) {
    .main-shield-wrapper { margin-bottom: 1.2rem; }
    .divider { margin: 1rem auto; }
    .scroll-indicator { bottom: 20px; }
    .section-title { font-size: 2.5rem; }
    .section-padding { padding: 70px 0; }
}

@media (max-width: 480px) {
    .hero-content { padding: 0 1rem; }
    .main-shield-wrapper { margin-bottom: 1rem; }
    .divider { margin: 0.8rem auto; }
    .hero-tagline { display: none; } /* demasiado texto en pantallas muy pequeñas */
    .btn-hero { margin-top: 1.5rem; padding: 0.85rem 2rem; font-size: 0.75rem; }
    .section-title { font-size: 2rem; }
    .section-padding { padding: 50px 0; }
    .notable-grid { grid-template-columns: 1fr; }
}