/* ========================================
   APUSH Score Calculator - Modern Edition
   Historical Elegance Design
   ======================================== */

/* Color Palette */
:root {
    --primary: #6b2c2c;
    /* Rich burgundy */
    --primary-light: #8b3a3a;
    /* Light burgundy */
    --accent: #c9a961;
    /* Antique gold */
    --accent-light: #d4a574;
    /* Light gold */
    --background: #fef5e7;
    /* Cream */
    --foreground: #1a1a1a;
    /* Deep charcoal */
    --card-bg: #ffffff;
    /* White */
    --secondary: #f5ede0;
    /* Light cream */
    --border: #e8dcc8;
    /* Muted cream */
    --text-muted: #6b4423;
    /* Muted brown */
    --shadow: rgba(107, 44, 44, 0.1);
    --shadow-hover: rgba(107, 44, 44, 0.15);
}

/* ========================================
   Global Styles
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    position: relative;
}

/* Historical texture background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(0deg,
            rgba(107, 44, 44, 0.02) 0px,
            rgba(107, 44, 44, 0.02) 1px,
            transparent 1px,
            transparent 2px);
    pointer-events: none;
    z-index: -1;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--primary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* ========================================
   Header & Navigation
   ======================================== */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(254, 245, 231, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
    gap: 4rem;
    /* Increased gap to ensure distance between logo and nav */
}

.logo-link {
    display: flex;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    /* Removed margin-right: 4rem; relying on container gap */
}

.logo-image {
    height: 3.5rem;
    /* Increased logo size for better balance */
    width: 3.5rem;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 2rem;
    /* Increased title size to be closer to logo size */
    margin: 0;
    color: var(--primary);
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Mobile Accordion Styles */
.mobile-dropdown {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-dropdown-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: inherit;
}

.mobile-dropdown-content {
    display: none;
    /* Force hidden initially */
    background-color: rgba(0, 0, 0, 0.02);
    /* Animation helper if we switch back to max-height later, but 'display' guarantees hiding */
}

.mobile-dropdown.active .mobile-dropdown-content {
    display: block;
    /* Show when active */
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-image {
    height: 3.5rem;
    /* Increased logo size for better balance */
    width: 3.5rem;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 2rem;
    /* Increased title size to be closer to logo size */
    margin: 0;
    color: var(--primary);
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.nav-desktop {
    display: none;
    gap: 2rem;
    align-items: center;
}

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

.nav-link {
    font-weight: 500;
    color: var(--foreground);
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 0.25rem;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
}

.nav-mobile {
    display: flex;
    flex-direction: column;
    gap: 0;
    /* Gap handled by link padding or we can animate gap, but 0 is safer for collapse */
    padding: 0 1rem;
    /* Horizontal padding kept, vertical 0 */
    background-color: var(--secondary);
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    opacity: 0;
    visibility: hidden;
}

.nav-mobile.active {
    padding: 1rem;
    max-height: 85vh;
    /* Allow enough space for all items */
    overflow-y: auto;
    /* Enable scrolling for long menus */
    gap: 1rem;
    opacity: 1;
    visibility: visible;
}

.nav-mobile .nav-link {
    display: block;
    padding: 0.5rem 0;
}

@media (min-width: 768px) {
    .nav-mobile {
        display: none;
    }
}



.hamburger {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

@media (min-width: 768px) {
    .hamburger {
        display: none;
    }
}

.hamburger span {
    width: 1.5rem;
    height: 2px;
    background-color: var(--primary);
    transition: all 0.3s ease;
    border-radius: 1px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(0.5rem, 0.5rem);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(0.35rem, -0.35rem);
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
    background: linear-gradient(135deg, var(--background) 0%, var(--secondary) 100%);
    padding: 3rem 1rem;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

@media (min-width: 768px) {
    .hero-title {
        font-size: 3.5rem;
    }
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.8;
}

/* Ornamental divider */
.ornamental-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
    position: relative;
    margin: 2rem auto;
    max-width: 200px;
}

.ornamental-divider::before,
.ornamental-divider::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.ornamental-divider::before {
    left: 0;
}

.ornamental-divider::after {
    right: 0;
}

/* ========================================
   Calculator Section
   ======================================== */

.calculator-section {
    padding: 3rem 1rem;
}

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

@media (min-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 2fr 1fr;
    }
}

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

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

/* ========================================
   Cards
   ======================================== */

.section-card {
    background-color: var(--card-bg);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.4s ease;
}

.section-card:hover {
    box-shadow: 0 8px 20px var(--shadow-hover);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.section-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.section-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--primary);
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 50%;
    font-size: 1rem;
    font-weight: bold;
    font-family: 'Poppins', sans-serif;
    flex-shrink: 0;
}

.section-title {
    font-size: 1.25rem;
    margin: 0 0 0.25rem 0;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.results-card {
    background-color: var(--card-bg);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.4s ease;
}

.results-card:hover {
    box-shadow: 0 8px 20px var(--shadow-hover);
}

.results-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Framed card style */
.framed-card {
    position: relative;
    border: 3px solid var(--primary);
    border-radius: 8px;
    padding: 2px;
}

.framed-card::before,
.framed-card::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent);
}

.framed-card::before {
    top: -8px;
    left: -8px;
    border-right: none;
    border-bottom: none;
}

.framed-card::after {
    bottom: -8px;
    right: -8px;
    border-left: none;
    border-top: none;
}

/* ========================================
   Sliders
   ======================================== */

.slider-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
}

.slider-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--accent);
    font-family: 'Poppins', sans-serif;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--border), var(--border));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.2s ease;
    border: 2px solid var(--accent);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow);
    border: 2px solid var(--accent);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.slider-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========================================
   Score Display
   ======================================== */

.score-display {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.ap-score-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--accent);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    min-width: 150px;
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.ap-score-value {
    display: block;
    font-size: 3rem;
    font-weight: bold;
    font-family: 'Playfair Display', serif;
    margin-bottom: 0.5rem;
}

.ap-score-label {
    display: block;
    font-size: 0.9rem;
    font-family: 'Lora', serif;
    color: var(--background);
}

.score-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.metric {
    background-color: var(--secondary);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    font-family: 'Poppins', sans-serif;
}

/* ========================================
   Progress Bars
   ======================================== */

.breakdown-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.breakdown-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
}

.breakdown-label {
    color: var(--foreground);
}

.breakdown-value {
    color: var(--accent);
    font-weight: bold;
    font-family: 'Poppins', sans-serif;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px var(--shadow);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--background);
    border: 2px solid var(--primary);
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ========================================
   Footer
   ======================================== */

.footer {
    background-color: var(--primary);
    color: var(--background);
    padding: 2rem 1rem;
    margin-top: 3rem;
    text-align: center;
}

.footer-text {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--accent);
    font-weight: 500;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: var(--background);
    text-decoration: underline;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-card {
        padding: 1rem;
    }

    .score-metrics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0.75rem 0;
    }

    .logo-title {
        font-size: 1.5rem;
        /* Adjusted for mobile view to match new logo size */
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .section-subtitle {
        font-size: 0.8rem;
    }

    .ap-score-value {
        font-size: 2.5rem;
    }

    .metric-value {
        font-size: 1.25rem;
    }
}

/* ========================================
   Dropdown Navigation
   ======================================== */

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--card-bg);
    min-width: 240px;
    box-shadow: 0 4px 20px var(--shadow-hover);
    border-radius: 8px;
    padding: 0.5rem 0;
    z-index: 1000;
    border: 1px solid var(--border);
    flex-direction: column;
}

.nav-item:hover .dropdown-menu {
    display: flex;
}

.dropdown-item {
    padding: 0.75rem 1.25rem;
    color: var(--foreground);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    display: block;
    width: 100%;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--secondary);
    color: var(--primary);
    padding-left: 1.5rem;
    /* Slight slide effect */
}

/* Chevron indicator for dropdowns */
.nav-link.dropdown-toggle::after {
    content: '▼';
    font-size: 0.5rem;
    margin-left: 5px;
    vertical-align: middle;
    display: inline-block;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-link.dropdown-toggle::after {
    transform: rotate(180deg);
}

/* ========================================
   CTA Final Section (High Contrast)
   ======================================== */

.cta-final-section {
    background-color: var(--primary);
    color: var(--background);
    padding: 4rem 1rem;
    text-align: center;
    margin-top: 4rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow);
}

.cta-final-section h2 {
    color: var(--accent);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.cta-final-section p {
    color: var(--secondary);
    max-width: 700px;
    margin: 0 auto 2rem auto;
    font-size: 1.1rem;
}

.cta-final-section .btn-primary {
    background: var(--card-bg);
    border: 2px solid var(--card-bg);
    color: var(--primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: auto;
    display: inline-block;
    padding: 0.75rem 2rem;
}

.cta-final-section .btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}