/* ======================================= */
/* 1. Global Styles & Variables            */
/* ======================================= */
:root {
    --primary-color: #005A9C;
    --secondary-color: #00A4E4;
    --background-color: #f4f7f6;
    --card-background: #ffffff;
    --text-color: #333;
    --label-color: #555;
    --border-color: #e0e0e0;
    --dark-footer-bg: #1a202c;
    --light-text: #f0f4f8;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background-color: var(--background-color); 
    color: var(--text-color); 
    margin: 0; 
}

/* ======================================= */
/* 2. Main Site Header (Navigation)        */
/* ======================================= */
.site-header {
    background: var(--card-background);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.site-title a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo {
    height: 45px; /* Refined logo size */
    width: auto;
}

.logo-text {
    font-family: 'Inter', sans-serif;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--primary-color);
}

.site-nav a {
    margin-left: 25px;
    font-weight: 600;
    color: var(--label-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ======================================= */
/* 3. Page-Specific Hero Section (Title)   */
/* ======================================= */
.page-hero {
    background-color: #eaf2f8; /* Light blue background */
    text-align: center;
    padding: 40px 20px;
}

.hero-container {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
}

.page-hero h1 { 
    color: var(--primary-color); 
    margin: 0 0 10px 0;
    font-size: 2.5rem;
}

.page-hero p { 
    color: var(--label-color); 
    font-size: 1.1em;
    margin: 0;
}

/* ======================================= */
/* 4. Main Content & Calculator Styles     */
/* ======================================= */
.container { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 30px; 
    width: 100%; 
    max-width: 1200px; 
    margin: 40px auto 0 auto; /* Added margin-top */
    align-items: stretch; 
}
.calculator-wrapper { display: flex; flex-direction: column; flex: 1; min-width: 320px; max-width: 550px; }
.calculator { background: var(--card-background); padding: 30px; border-radius: 12px; box-shadow: var(--box-shadow); border-top: 4px solid var(--primary-color); width: 100%; box-sizing: border-box; flex-grow: 1; display: flex; flex-direction: column; }
.calculator-content { flex-grow: 1; display: flex; flex-direction: column; }
.calculator h2 { margin-top: 0; color: var(--primary-color); border-bottom: 1px solid var(--border-color); padding-bottom: 15px; font-weight: 600; }
.input-group { margin-bottom: 10px; }
.input-group label { display: flex; justify-content: space-between; font-weight: 500; color: var(--label-color); margin-bottom: 10px; }
.input-group label span:last-child { font-weight: 600; color: var(--primary-color); }
input[type="range"] { width: 100%; }
input[type="text"]:disabled { background-color: #e9ecef; cursor: not-allowed; text-align: center; font-weight: bold; }
.corpus-input-group { display: flex; align-items: center; gap: 10px; }
#corpus { flex-grow: 1; padding: 8px; border: 1px solid var(--border-color); border-radius: 5px; }
.result { margin-top: 30px; padding: 20px; background-color: var(--background-color); border-radius: 8px; text-align: center; flex-grow: 1; }
.result .value { font-size: 2em; font-weight: 700; color: var(--secondary-color); }
.result-details { display: flex; justify-content: space-around; margin-top: 15px; font-size: 0.9em; }
.result-details span { display: block; color: var(--label-color); }
.result-details strong { color: var(--text-color); }
button { background-color: var(--secondary-color); color: white; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-weight: 500; transition: background-color 0.2s; }
button:hover { background-color: var(--primary-color); }
.toggle-group, .radio-group { display: flex; gap: 10px; margin-bottom: 20px; }
.toggle-group label, .radio-group label { flex: 1; }
.toggle-group input[type="radio"], .radio-group input[type="radio"] { display: none; }
.toggle-group span, .radio-group span { display: block; padding: 10px; border: 1px solid var(--border-color); border-radius: 5px; text-align: center; cursor: pointer; transition: all 0.2s; }
.toggle-group input[type="radio"]:checked + span, .radio-group input[type="radio"]:checked + span { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.math-button { margin-top: 20px; width: 100%; background-color: var(--primary-color); }
.math-button:hover { background-color: #004175; }

/* ======================================= */
/* 5. Drawer & Content Section Styles      */
/* ======================================= */
.drawer-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1001; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s 0.3s; }
.drawer { position: fixed; top: 0; right: -450px; width: 100%; max-width: 450px; height: 100%; background: var(--card-background); z-index: 1002; box-shadow: -4px 0 15px rgba(0,0,0,0.2); padding: 25px; box-sizing: border-box; transition: right 0.3s ease; overflow-y: auto; }
.drawer.active { right: 0; }
.drawer-overlay.active { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }
.drawer-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 20px; }
.drawer-header h3 { margin: 0; color: var(--primary-color); }
.close-btn { font-size: 2em; font-weight: bold; color: #aaa; cursor: pointer; line-height: 1; }
.drawer-content p, .drawer-content ul { line-height: 1.6; }
.drawer-content ul { list-style: none; padding: 0; }
.drawer-content li { margin-bottom: 10px; }
.drawer-content strong { color: var(--primary-color); }
.drawer-content img { max-width: 100%; height: auto; border-radius: 8px; margin-bottom: 15px; }

.content-container { width: 100%; max-width: 1800px; background: var(--card-background); padding: 30px 40px; margin-top: 40px; border-radius: 12px; box-shadow: var(--box-shadow); box-sizing: border-box; }
.content-container section { margin-bottom: 30px; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
.content-container section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.content-container h2 { color: var(--primary-color); margin-top: 0; }
.content-container p, .content-container ul { line-height: 1.7; color: #4a5568; }
.content-container ul { padding-left: 20px; }
.content-container li { margin-bottom: 10px; }
.content-container strong { color: var(--text-color); }
.content-container .disclaimer p, .content-container .disclaimer ul { font-size: 0.9em; color: #718096; }

/* ======================================= */
/* 6. Main Site Footer                     */
/* ======================================= */
.site-footer {
    background: var(--dark-footer-bg);
    color: var(--light-text);
    padding: 30px 0;
    margin-top: 50px;
    width: 100%;
}
.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap; /* For responsiveness */
    gap: 15px;
}
.footer-nav a {
    margin-left: 20px;
    color: #a0aec0;
    text-decoration: none;
    transition: color 0.2s ease;
}
.footer-nav a:hover {
    color: white;
}