/* Enhanced styles for Papal Succession website */

:root {
    --primary-color: #800020; /* Vatican burgundy */
    --secondary-color: #ffd700; /* Gold */
    --accent-color: #1a5276; /* Deep blue */
    --text-color: #333;
    --light-bg: #f8f8f8;
    --card-bg: #fff;
    --border-color: #ddd;
    --header-font: 'Cinzel', serif;
    --body-font: 'Lato', sans-serif;
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-md: 0 6px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.2);
    --transition-fast: 0.3s ease;
    --transition-med: 0.5s ease;
}

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Lato:wght@300;400;700&display=swap');

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

body {
    font-family: var(--body-font);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--light-bg);
}

/* Header styles */
.header {
    background-image: url('images/vatican.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: white;
    padding: 0;
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    padding: 2rem;
    width: 100%;
}

.header h1 {
    font-family: var(--header-font);
    font-size: 5rem;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: fadeInDown 1.2s ease-out;
}

.header h2 {
    font-size: 2.2rem;
    font-weight: 300;
    margin-top: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 1.2s ease-out;
}

/* Fixed language selector positioning */
.language-selector {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    background-color: var(--primary-color);
    padding: 0.7rem 1.2rem;
    border-radius: 30px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--secondary-color);
}

.language-label {
    margin-right: 0.8rem;
    color: white;
    font-weight: 500;
}

#language-select {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    background-color: white;
    color: var(--primary-color);
    font-family: var(--body-font);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
}

#language-select:hover {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    background-color: rgba(139, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 1.2rem 0;
    flex-wrap: wrap;
}

.nav ul li {
    margin: 0.5rem 1rem;
}

.nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    transition: all var(--transition-fast);
    position: relative;
    display: inline-block;
}

.nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background-color: var(--secondary-color);
    transition: all var(--transition-fast);
    transform: translateX(-50%);
}

.nav ul li a:hover::after {
    width: 80%;
}

.nav ul li a.active {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

/* Main content */
main {
    position: relative;
    z-index: 1;
}

.section {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.section:nth-child(odd) {
    background-color: white;
}

.section h3 {
    font-family: var(--header-font);
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 2.5rem;
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

.section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
}

/* Intro section */
.intro {
    text-align: center;
    position: relative;
    overflow: hidden;
}

.intro p {
    font-size: 1.2rem;
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto 1.5rem;
}

/* Conclave section */
.conclave-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.step {
    background-color: var(--card-bg);
    padding: 2.5rem 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform var(--transition-med), box-shadow var(--transition-med);
    position: relative;
    overflow: hidden;
}

.step:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
}

.step-number {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
    font-weight: bold;
    font-size: 1.3rem;
    box-shadow: var(--shadow-sm);
}

.step h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-family: var(--header-font);
}

/* Candidates section */
.candidates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.candidate-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-med), box-shadow var(--transition-med);
    position: relative;
}

.candidate-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.candidate-image {
    height: 250px;
    overflow: hidden;
    position: relative;
}

.candidate-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.candidate-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-med);
}

.candidate-card:hover .candidate-image img {
    transform: scale(1.1);
}

.candidate-info {
    padding: 2rem;
}

.candidate-name {
    font-size: 1.8rem;
    margin: 0 0 0.5rem;
    color: var(--primary-color);
    font-family: var(--header-font);
}

.candidate-title {
    font-size: 1.1rem;
    color: #666;
    margin: 0 0 1.5rem;
    font-style: italic;
}

.candidate-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 10px;
    flex-wrap: wrap;
}

.candidate-detail {
    text-align: center;
    flex: 1 0 45%;
    margin: 0.5rem 0;
}

.detail-label {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 0.3rem;
}

.detail-value {
    font-weight: bold;
    color: var(--text-color);
    font-size: 1.1rem;
}

.candidate-stance {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    display: inline-block;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.progressive {
    background-color: #e6f7ff;
    color: #0066cc;
    border: 1px solid #99ccff;
}

.moderate {
    background-color: #f0f0f0;
    color: #666666;
    border: 1px solid #cccccc;
}

.conservative {
    background-color: #fff0f0;
    color: #cc0000;
    border: 1px solid #ffcccc;
}

.view-profile {
    display: inline-block;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    transition: all var(--transition-fast);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.view-profile:hover {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* Prediction section */
.prediction {
    background-color: white;
    position: relative;
    overflow: hidden;
}

.prediction::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/vatican.webp');
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    z-index: 0;
}

.prediction-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.prediction-chart {
    margin: 3rem 0;
}

.prediction-bar {
    height: 50px;
    margin-bottom: 1.2rem;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    color: white;
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
    border-radius: 10px;
    position: relative;
    font-weight: 500;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
    animation: growWidth 1.5s ease-out forwards;
    transform-origin: left;
}

@keyframes growWidth {
    from { width: 0; }
    to { width: var(--bar-width); }
}

.prediction-bar:nth-child(1) {
    --bar-width: 40%;
    animation-delay: 0.1s;
}

.prediction-bar:nth-child(2) {
    --bar-width: 25%;
    animation-delay: 0.3s;
}

.prediction-bar:nth-child(3) {
    --bar-width: 15%;
    animation-delay: 0.5s;
}

.prediction-bar:nth-child(4) {
    --bar-width: 10%;
    animation-delay: 0.7s;
}

.prediction-bar:nth-child(5) {
    --bar-width: 5%;
    animation-delay: 0.9s;
}

.prediction-bar:nth-child(6) {
    --bar-width: 5%;
    animation-delay: 1.1s;
}

.prediction-bar span {
    position: absolute;
    right: 1.5rem;
    font-weight: 700;
}

.prediction p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.prediction p strong {
    color: var(--primary-color);
}

/* Factors section */
.factors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.factor {
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    transition: transform var(--transition-med), box-shadow var(--transition-med);
    position: relative;
    overflow: hidden;
}

.factor:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.factor::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
}

.factor h4 {
    color: var(--primary-color);
    margin-bottom: 1.2rem;
    font-size: 1.5rem;
    font-family: var(--header-font);
}

.factor p {
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Candidate profile page styles */
.candidate-profile {
    padding: 2rem;
}

.profile-header {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: center;
}

.profile-image {
    flex: 0 0 300px;
    height: 300px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-details {
    flex: 1;
    min-width: 300px;
}

.profile-details h3 {
    text-align: left;
    margin-bottom: 1rem;
}

.profile-details h3::after {
    left: 0;
    transform: none;
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.stat {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    flex: 1 0 100px;
    max-width: 150px;
}

.stat-label {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-weight: bold;
    font-size: 1.2rem;
}

.profile-summary {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-top: 1.5rem;
}

.profile-content {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.main-content {
    flex: 2;
    min-width: 300px;
}

.sidebar {
    flex: 1;
    min-width: 250px;
}

.agenda-item {
    margin-bottom: 2.5rem;
}

.agenda-item h4 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-family: var(--header-font);
}

.agenda-item p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.sidebar-section {
    background-color: var(--light-bg);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
}

.sidebar-section h4 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-family: var(--header-font);
}

.sidebar-section ul {
    list-style-position: inside;
    margin-left: 0.5rem;
}

.sidebar-section li {
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
}

.quote-box {
    background-color: var(--light-bg);
    padding: 2rem;
    border-radius: 15px;
    margin: 2rem 0;
    position: relative;
}

.quote-box::before {
    content: '"';
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 6rem;
    color: var(--primary-color);
    opacity: 0.2;
    font-family: Georgia, serif;
}

.quote {
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.8;
}

.quote-source {
    text-align: right;
    margin-top: 1rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background-color: #222;
    color: white;
    text-align: center;
    padding: 3rem 2rem;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.footer p {
    margin: 0.8rem 0;
}

.footer a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer a:hover {
    color: white;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Mobile Responsive styles */
@media (max-width: 1200px) {
    .header h1 {
        font-size: 4rem;
    }
    
    .header h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 992px) {
    .header {
        height: 80vh;
    }
    
    .header h1 {
        font-size: 3.5rem;
    }
    
    .header h2 {
        font-size: 1.6rem;
    }
    
    .section {
        padding: 4rem 1.5rem;
    }
    
    .section h3 {
        font-size: 2.2rem;
    }
    
    .candidates {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .profile-image {
        flex: 0 0 250px;
        height: 250px;
    }
}

@media (max-width: 768px) {
    .header {
        height: 70vh;
        background-attachment: scroll;
    }
    
    .header h1 {
        font-size: 2.8rem;
    }
    
    .header h2 {
        font-size: 1.4rem;
    }
    
    .language-selector {
        top: 70px;
        right: 10px;
        padding: 0.5rem 1rem;
    }
    
    .nav ul {
        flex-wrap: wrap;
        padding: 0.8rem 0;
        justify-content: center;
    }
    
    .nav ul li {
        margin: 0.3rem 0.5rem;
    }
    
    .nav ul li a {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
    }
    
    .section {
        padding: 3rem 1.2rem;
    }
    
    .section h3 {
        font-size: 2rem;
    }
    
    .step {
        padding: 2rem 1rem;
    }
    
    .candidates {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .factor {
        padding: 2rem;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .profile-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 300px;
        height: auto;
        aspect-ratio: 1/1;
    }
    
    .profile-details {
        width: 100%;
    }
    
    .profile-details h3 {
        text-align: center;
    }
    
    .profile-details h3::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .profile-stats {
        justify-content: center;
    }
    
    .profile-content {
        flex-direction: column;
    }
    
    .prediction-bar {
        height: 40px;
        font-size: 1rem;
        padding-left: 1rem;
    }
    
    .prediction-bar span {
        right: 1rem;
    }
}

@media (max-width: 576px) {
    .header {
        height: 60vh;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .header h2 {
        font-size: 1.2rem;
    }
    
    .section h3 {
        font-size: 1.8rem;
    }
    
    .candidate-details {
        flex-direction: column;
        gap: 1rem;
    }
    
    .candidate-detail {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .detail-label {
        margin-bottom: 0;
    }
    
    .language-selector {
        top: 60px;
        right: 10px;
        padding: 0.4rem 0.8rem;
    }
    
    .language-label {
        font-size: 0.9rem;
    }
    
    #language-select {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .stat {
        flex: 1 0 40%;
        max-width: none;
    }
    
    .agenda-item h4 {
        font-size: 1.3rem;
    }
    
    .agenda-item p, .profile-summary, .factor p {
        font-size: 1rem;
    }
    
    .quote {
        font-size: 1.1rem;
    }
    
    .prediction-bar {
        height: 35px;
        font-size: 0.9rem;
    }
    
    .prediction-bar span {
        position: static;
        margin-left: auto;
        padding-right: 1rem;
    }
}

/* Touch-friendly improvements for mobile */
@media (max-width: 768px) {
    .nav ul li a, .view-profile, #language-select {
        padding: 0.7rem 1rem;  /* Larger touch targets */
    }
    
    .candidate-card, .factor, .step {
        transform: none !important;  /* Disable hover effects on mobile */
        transition: box-shadow var(--transition-fast);
    }
    
    .candidate-image img {
        transform: none !important;  /* Disable hover effects on mobile */
    }
    
    /* Add active state for touch */
    .candidate-card:active, .factor:active, .step:active {
        box-shadow: var(--shadow-lg);
    }
    
    /* Improve scrolling */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix background attachment for iOS */
    .header, .prediction::before {
        background-attachment: scroll;
    }
    
    /* Ensure buttons have enough space */
    .view-profile {
        display: block;
        width: 100%;
        text-align: center;
        padding: 1rem;
    }
}
