/* --- 1. CSS Variables & Reset --- */
:root {
    --primary-color: #004e92;
    --secondary-color: #000428;
    --accent-color: #d4af37;
    
    --text-dark: #333333;
    --text-light: #f4f4f4;
    
    --bg-light: #ffffff;
    --bg-offset: #f0f2f5;

    --font-heading: 'Merriweather', serif;
    --font-body: 'Open Sans', sans-serif;
    
    --shadow-soft: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.15);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    margin: 0;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

img, video, iframe, picture {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- 2. Typography --- */
h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--secondary-color);
}

h1 {
    font-size: clamp(2.5rem, 5vw + 1rem, 5rem);
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    border-bottom: 3px solid var(--accent-color);
    display: inline-block;
}

p, li {
    text-align: left;
    hyphens: auto;
}

/* --- 3. Layout & Common Utilities --- */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
    width: 100%;
    overflow-x: hidden;
}

section {
    margin-bottom: 5rem;
}

.shadow-box {
    box-shadow: var(--shadow-soft);
    border-radius: 4px;
}

.responsive-img {
    width: 100%;
}

/* --- 4. Hero Section --- */
.hero {
    min-height: 80vh;
    background-image: linear-gradient(rgba(0, 4, 40, 0.8), rgba(0, 78, 146, 0.8));
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    padding: 2rem 1rem;
}

.hero-content h1 {
    color: var(--text-light);
    margin: 0 0 1rem 0;
}

.subtitle {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 2rem;
    font-style: italic;
}

/* Navigation */
.hero nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0;
    justify-content: center;
    width: 100%;
}

.hero nav li {
    width: 100%;  
    max-width: 300px;
}

.hero nav a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border: 2px solid var(--text-light);
    transition: all 0.3s ease;
    display: block; 
}

.hero nav a:focus,
.hero nav a:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--secondary-color);
    outline: 2px solid #fff;
    outline-offset: 4px;
}

/* --- 5. Interactive Components --- */

/* Deep Dive Accordion */
details.deep-dive {
    background-color: var(--bg-offset);
    border-left: 4px solid var(--primary-color);
    margin: 2rem 0;
    border-radius: 0 4px 4px 0;
    overflow: hidden;
}

summary {
    padding: 1rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--primary-color);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

summary:hover {
    background-color: rgba(0, 78, 146, 0.1);
}

summary:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

details[open] summary::after {
    transform: rotate(45deg);
}

.deep-dive-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
    font-size: 0.95rem;
    border-top: 1px solid #ddd;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.learn-more-btn, 
.submit-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    cursor: pointer;
}

.learn-more-btn {
    margin-top: 1rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

.submit-btn {
    padding: 1.2rem;
    background-color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    min-width: 200px;
    grid-column: 1 / -1;
    justify-self: center;
}

.learn-more-btn:hover, .submit-btn:hover {
    background-color: var(--accent-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    text-decoration: none;
}

.learn-more-btn:focus, .submit-btn:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Blockquotes */
blockquote {
    font-size: 1.2rem;
    font-style: italic;
    border-left: 5px solid var(--accent-color);
    margin: 2rem 0;
    color: var(--primary-color);
    background: var(--bg-offset);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
}

blockquote cite {
    display: block;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    font-weight: 700;
    font-style: normal;
    color: var(--secondary-color);
}

/* --- 6. Visual Sections (Grid & Overlays) --- */
.grid-section {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
    align-items: center;
}

.visual-content {
    text-align: center;
}

figure { margin: 0; }
figcaption {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.8rem;
    font-style: italic;
}

.trust-icon {
    width: 100%;
    max-width: 500px;
    display: inline-block;
    margin-top: 1rem;
}

/* Image Overlay Logic */
.overlay-container {
    position: relative;
    display: inline-block;
    overflow: hidden;
    border-radius: 4px;
    cursor: help;
}

.overlay-text {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 4, 40, 0.92); 
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    text-align: left;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.overlay-container:hover .overlay-text,
.overlay-container:focus .overlay-text {
    opacity: 1;
}

.overlay-text h3 {
    color: var(--accent-color);
    margin-top: 0;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--accent-color);
}

.overlay-text ul {
    list-style: none;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.overlay-text li { margin-bottom: 0.5rem; }

/* Caption Logic */
.caption-phone { display: inline; }
.caption-tablet, .caption-desktop { display: none; }

/* --- 7. Economics Flip Cards --- */
.economics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.flip-card {
    background-color: transparent;
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%; height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    box-shadow: var(--shadow-card);
    border-radius: 12px;
}

.flip-card:hover .flip-card-inner,
.flip-card:focus-within .flip-card-inner {
    transform: rotateY(180deg);
    box-shadow: 0 15px 35px rgba(231, 76, 60, 0.3); 
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%; height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.flip-card-front {
    background: linear-gradient(145deg, #ffffff 0%, #fff0f0 100%);
    color: #c0392b;
    border-top: 6px solid #e74c3c;
    border-bottom: 1px solid #eee;
}

.flip-card-front h3 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.flip-card-back {
    background: linear-gradient(145deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    transform: rotateY(180deg);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.flip-card-back h3 {
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    border-bottom: 2px solid rgba(255,255,255,0.4);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    width: 100%;
}

.flip-card-back p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

/* --- 8. Tables --- */
.table-container {
    overflow-x: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-light);
    min-width: 500px;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--primary-color);
    color: var(--text-light);
    font-family: var(--font-heading);
}

tr:nth-child(even) { background-color: var(--bg-offset); }
tr:hover { background-color: rgba(212, 175, 55, 0.1); }
caption {
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #666;
}

/* --- 9. Contact Form --- */
.contact-form {
    background-color: var(--bg-offset);
    padding: 3rem;
    border-radius: 12px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width { grid-column: 1 / -1; }

label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

input, textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 78, 146, 0.1);
}

/* --- 10. Quote Generator --- */
#quotes-generator {
    background-color: var(--bg-offset);
    padding: 4rem 1.5rem;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 4rem;
}

.quote-card {
    background-color: white;
    max-width: 800px;
    margin: 2rem auto;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 4, 40, 0.08);
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.quote-card::before {
    content: "“";
    position: absolute;
    top: -10px; left: 20px;
    font-family: var(--font-heading);
    font-size: 8rem;
    color: var(--accent-color);
    opacity: 0.15;
    line-height: 1;
    pointer-events: none;
}

#quote-content {
    position: relative;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.fade-out { opacity: 0 !important; }

#quote-text {
    font-size: 1.4rem;
    font-family: var(--font-heading);
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    font-style: italic;
    line-height: 1.6;
}

#quote-author {
    display: block;
    text-align: right;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#new-quote-btn {
    background-color: var(--secondary-color);
    color: var(--text-light);
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-soft);
}

#new-quote-btn:hover {
    background-color: var(--accent-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
}

/* --- 11. Footer --- */
footer {
    background-color: var(--secondary-color);
    color: var(--text-light);
    padding: 4rem 2rem 2rem 2rem;
    margin-top: 5rem;
    border-top: 5px solid var(--accent-color);
    position: relative;
}

.footer-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    color: var(--accent-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    font-family: var(--font-body);
    opacity: 0.8;
}

.academic-info strong { font-size: 1.2rem; display: block; margin-bottom: 0.3rem; }
.course-name { font-style: italic; opacity: 0.8; }
.creator-name { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; }
.copyright { font-size: 0.85rem; opacity: 0.6; margin-top: 0.5rem; }

.back-to-top-btn {
    display: table; 
    margin: 0 auto;
    text-align: center;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    transition: all 0.3s ease;
}

.back-to-top-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--secondary-color);
    transform: translateY(-3px);
}

/* --- 12. Media Queries --- */

/* Mobile Enhancements */
@media (max-width: 400px) {
    .overlay-container {
        display: flex; 
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .overlay-text {
        position: relative; 
        opacity: 1; 
        width: 100%;
        height: auto;
        border-top: 4px solid var(--accent-color);
        background-color: var(--secondary-color);
    }

    .overlay-text h3 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .overlay-text ul { font-size: 1rem; }

    .contact-form {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
    }
}

/* Tablet */
@media (min-width: 600px) {
    .economics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .footer-wrapper {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .footer-column {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-column p { text-align: center; }
    
    .academic-info {
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 2rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .caption-phone { display: none; }
    .caption-tablet { display: inline; }
    .caption-desktop { display: none; }

    .contact-form {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .caption-phone, .caption-tablet { display: none; }
    .caption-desktop { display: inline; }

    .hero nav ul {
        flex-direction: row;
        gap: 1.5rem;
    }

    .hero nav li {
        width: auto; 
        max-width: none;
    }

    .hero nav a {
        display: inline-block;
        width: auto;
    }

    .grid-section { grid-template-columns: 1fr 1fr; }

    .reverse-layout .visual-content { order: -1; }
}

@media (min-width: 1500px) {
    .economics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
