/* =============================================
   LexPerú — Leyes de Perú
   Stylesheet
   ============================================= */

:root {
    --red-peru: #D91023;
    --red-dark: #B00D1D;
    --red-light: #FF4D5A;
    --white: #FFFFFF;
    --gold: #C8A951;
    --gold-light: #E8D48B;
    --dark: #1a1a2e;
    --dark-2: #16213e;
    --dark-3: #0f3460;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --bg-light: #f8f9fa;
    --bg-cream: #faf8f0;
    --accent: #e94560;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
    --transition: 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans Pro', sans-serif;
    color: var(--text);
    line-height: 1.7;
    background: var(--white);
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ============ CONTAINER ============ */
.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============ HERO ============ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background:
        linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 70%, #1a1a2e 100%);
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(217, 16, 35, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(200, 169, 81, 0.15) 0%, transparent 60%);
    z-index: 1;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--red-peru), var(--red-light), var(--gold), var(--red-light), var(--red-peru));
    z-index: 3;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 40px 24px;
}

.flag-bar {
    display: flex;
    width: 120px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 32px;
}
.flag-red { flex: 1; background: var(--red-peru); }
.flag-white { flex: 1; background: var(--white); }

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    color: var(--white);
    letter-spacing: -1px;
    margin-bottom: 16px;
    text-shadow: 0 2px 30px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: var(--gold-light);
    font-weight: 300;
    margin-bottom: 8px;
}

.hero-meta {
    color: rgba(255,255,255,0.5);
    font-size: 0.95rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 48px;
}

.cta-button {
    display: inline-block;
    padding: 16px 40px;
    background: var(--red-peru);
    color: var(--white);
    font-weight: 700;
    font-size: 1.05rem;
    border-radius: 50px;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(217,16,35,0.4);
}

.cta-button:hover {
    background: var(--red-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(217,16,35,0.5);
}

/* ============ NAV ============ */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: all var(--transition);
}

.main-nav.nav-scrolled {
    background: rgba(26, 26, 46, 0.98);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--white);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--red-peru);
    transition: width var(--transition);
}

.nav-links a:hover {
    color: var(--white);
}

.nav-links a:hover::after {
    width: 100%;
}

/* ============ SECTIONS ============ */
.section {
    padding: 80px 0;
}

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

.section-accent {
    background: linear-gradient(135deg, #f8f4e8 0%, #faf8f0 100%);
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-align: center;
    margin-bottom: 16px;
    color: inherit;
}

.section-intro {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 56px;
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.8;
}

.section-dark .section-intro,
.section-dark .section-title {
    color: var(--white);
}

.section-dark .section-intro {
    color: rgba(255,255,255,0.65);
}

/* ============ CARDS ============ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.card {
    background: var(--dark-2);
    border-radius: var(--radius);
    padding: 32px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(200,169,81,0.3);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: var(--gold-light);
}

.card p {
    color: rgba(255,255,255,0.65);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.card-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-list li {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.card-list li:last-child { border-bottom: none; }

/* ============ TIMELINE ============ */
.timeline-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    padding: 40px;
}

.timeline-box h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    margin-bottom: 32px;
    color: var(--gold-light);
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--red-peru), var(--gold));
}

.timeline-item {
    position: relative;
    padding: 16px 0 16px 32px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 24px;
    width: 14px;
    height: 14px;
    background: var(--red-peru);
    border-radius: 50%;
    border: 3px solid var(--dark);
}

.timeline-item.timeline-active::before {
    background: var(--gold);
    box-shadow: 0 0 12px rgba(200,169,81,0.5);
}

.timeline-year {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--red-light);
    margin-bottom: 4px;
}

.timeline-active .timeline-year {
    color: var(--gold);
}

.timeline-desc {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.6);
}

/* ============ PODERES ============ */
.poderes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    margin-bottom: 48px;
}

.poder-card {
    background: var(--bg-cream);
    border-radius: var(--radius);
    padding: 36px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.poder-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.poder-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.poder-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: var(--dark);
}

.poder-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.poder-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.poder-card ul li {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 4px 0 4px 20px;
    position: relative;
}

.poder-card ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--red-peru);
    font-weight: 700;
}

/* ============ AUTÓNOMOS ============ */
.info-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--red-peru);
}

.info-box h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--dark);
}

.autonomos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.autonomo-item {
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.autonomo-item strong {
    font-size: 0.9rem;
    color: var(--dark);
}

.autonomo-item span {
    font-size: 0.82rem;
    color: var(--text-light);
}

/* ============ HIERARCHY ============ */
.hierarchy {
    max-width: 760px;
    margin: 0 auto;
}

.h-level {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 28px;
    background: var(--white);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border-left: 6px solid;
    transition: transform var(--transition);
}

.h-level:hover { transform: translateX(8px); }
.h1 { border-color: #7B2D8E; }
.h2 { border-color: #2E5090; }
.h3 { border-color: #1A7340; }
.h4 { border-color: #D91023; }
.h5 { border-color: #C8A951; }
.h6 { border-color: #777; }

.h-num {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: rgba(0,0,0,0.08);
    min-width: 40px;
    line-height: 1;
}

.h-level > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.h-level > div strong {
    font-size: 1rem;
    color: var(--dark);
}

.h-level > div span {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ============ CÓDIGOS ============ */
.codigos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.codigo-card {
    background: var(--dark-2);
    border-radius: var(--radius);
    padding: 32px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all var(--transition);
}

.codigo-card:hover {
    transform: translateY(-4px);
    border-color: rgba(200,169,81,0.3);
}

.codigo-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.codigo-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--gold-light);
    margin-bottom: 4px;
}

.codigo-year {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--red-light);
    background: rgba(217,16,35,0.15);
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.codigo-card > p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 16px;
}

.codigo-sections {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.codigo-sections span {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    padding: 6px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}

/* ============ ÁREAS DEL DERECHO ============ */
.areas-grid {
    max-width: 860px;
    margin: 0 auto;
}

.area-item {
    background: var(--white);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.04);
}

.area-item summary {
    padding: 20px 24px;
    cursor: pointer;
    font-size: 1.05rem;
    transition: background var(--transition);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.area-item summary::-webkit-details-marker { display: none; }

.area-item summary::before {
    content: '▸';
    display: inline-block;
    transition: transform var(--transition);
    color: var(--red-peru);
    font-size: 1.2rem;
}

.area-item[open] summary::before {
    transform: rotate(90deg);
}

.area-item summary:hover {
    background: var(--bg-light);
}

.area-detail {
    padding: 0 24px 24px;
}

.area-detail p {
    color: var(--text-light);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.area-detail ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.area-detail ul li {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 4px 0 4px 18px;
    position: relative;
}

.area-detail ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--red-peru);
}

/* ============ INSTITUCIONES TABLE ============ */
.instituciones-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.92rem;
}

.instituciones-table thead {
    background: rgba(200,169,81,0.1);
}

.instituciones-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    color: var(--gold-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.instituciones-table td {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.7);
    vertical-align: middle;
}

.instituciones-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.instituciones-table td:first-child {
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.instituciones-table td:last-child {
    font-family: 'Source Sans Pro', monospace;
    font-weight: 700;
    color: var(--red-light);
    font-size: 0.85rem;
}

/* ============ PROCESOS ============ */
.procesos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.proceso-card {
    background: var(--bg-cream);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--dark-3);
}

.proceso-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--dark);
}

.proceso-card ol {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.proceso-card ol li {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 4px 0;
}

.proceso-card ol li strong {
    color: var(--dark);
}

/* ============ LEYES DESTACADAS ============ */
.leyes-list {
    max-width: 860px;
    margin: 0 auto;
}

.ley-item {
    display: flex;
    gap: 20px;
    padding: 28px;
    background: var(--white);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    align-items: flex-start;
}

.ley-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ley-number {
    font-family: 'Source Sans Pro', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--red-peru);
    min-width: 100px;
    padding-top: 2px;
}

.ley-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ley-info strong {
    font-size: 1rem;
    color: var(--dark);
}

.ley-info span {
    font-size: 0.92rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ============ RECURSOS ============ */
.recursos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.recurso-card {
    background: var(--dark-2);
    border-radius: var(--radius);
    padding: 36px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all var(--transition);
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.recurso-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: 0 8px 30px rgba(200,169,81,0.15);
}

.recurso-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.recurso-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    color: var(--gold-light);
    margin-bottom: 8px;
}

.recurso-card p {
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    flex: 1;
    margin-bottom: 16px;
}

.recurso-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--red-light);
}

/* ============ FOOTER ============ */
.site-footer {
    background: var(--dark);
    color: rgba(255,255,255,0.5);
    padding: 60px 0 0;
    font-size: 0.9rem;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.footer-brand h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--white);
    margin-bottom: 8px;
}

.footer-brand p {
    color: rgba(255,255,255,0.4);
}

.footer-links h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gold-light);
    margin-bottom: 16px;
}

.footer-links a {
    display: block;
    color: rgba(255,255,255,0.5);
    padding: 4px 0;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding: 24px 0;
}

.footer-copy {
    margin-top: 8px;
    opacity: 0.5;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .section { padding: 56px 0; }
    .card-grid { grid-template-columns: 1fr; }
    .poderes-grid { grid-template-columns: 1fr; }
    .footer-top { grid-template-columns: 1fr; gap: 32px; }
    .nav-links { display: none; }
    .instituciones-table { font-size: 0.82rem; }
    .instituciones-table th, .instituciones-table td { padding: 10px 12px; }
    .ley-item { flex-direction: column; gap: 8px; }
    .codigos-grid { grid-template-columns: 1fr; }
    .recursos-grid { grid-template-columns: 1fr; }
    .procesos-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2.8rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .hero { min-height: 80vh; }
    .autonomos-grid { grid-template-columns: 1fr; }
}
