:root {
    --primary: #1E40AF;
    --secondary: #0369A1;
    --accent: #92400E;
    --background: #FFFFFF;
    --surface: #F9FAFB;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --border: #E5E7EB;
}

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

html {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background: var(--background);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
}

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
}

.logo-img {
    width: 55px;
    height: 55px;
    object-fit: contain;
}

.nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.2);
}

.language-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.language-selector select option {
    background: var(--primary);
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    transition: all 0.3s;
    border-radius: 4px;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

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

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-lang {
    display: none;
}

.desktop-lang {
    display: block;
}

/* Responsive Mobile Menu */
@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
    }
    
    .desktop-lang {
        display: none;
    }
    
    .mobile-lang {
        display: block;
    }
    
    .mobile-lang select {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .header-content {
        position: relative;
    }
    
    .nav {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 99;
    }
    
    .nav.active {
        transform: translateX(0);
    }
    
    .nav-link {
        padding: 1rem 2rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
}

.main-content {
    min-height: calc(100vh - 200px);
}

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

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    opacity: 0.95;
}

.hero-calculator {
    margin: 0 auto;
    width: 100%;
}

.calc-title-hero {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.calc-card-hero {
    background: white;
    border-radius: 4px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    color: var(--text-primary);
}

.calc-mode-selector {
    margin-bottom: 1.5rem;
}

.calc-mode-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary);
}

.form-select-hero {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.form-select-hero:focus {
    outline: none;
    border-color: var(--primary);
}

.inputs-grid-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group-hero {
    display: flex;
    flex-direction: column;
}

.input-group-hero label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input-hero {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input-hero:focus {
    outline: none;
    border-color: var(--primary);
}

.calc-controls-hero {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    align-items: end;
}

.button-row-hero {
    display: flex;
    gap: 1rem;
}

.btn-light {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-light:hover {
    background: var(--surface);
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .calc-title-hero {
        font-size: 1.25rem;
    }
    
    .calc-card-hero {
        padding: 1.5rem;
    }
    
    .inputs-grid-hero {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .calc-controls-hero {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .button-row-hero {
        flex-direction: column;
    }
    
    .button-row-hero .btn {
        width: 100%;
    }
}

.section {
    padding: 3rem 0;
}

.section-gray {
    background: var(--surface);
}

.section-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-align: center;
}

.section-text {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.formula-card {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}

.formula-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.formula-display {
    font-size: 2rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--surface);
    border-radius: 4px;
}

.formula-explanation {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: var(--text-secondary);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #1E3A8A;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30,64,175,0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #025E90;
}

.btn-accent {
    background: #92400E;
    color: white;
    font-weight: 600;
}

.btn-accent:hover {
    background: #78350F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(146,64,14,0.4);
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.cta-section {
    text-align: center;
    margin-top: 2rem;
}

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

.calculator-input, .calculator-result {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input, .form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.inputs-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.button-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.error-msg {
    background: #FEE2E2;
    color: #991B1B;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.result-value {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 4px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    margin: 1rem 0;
    text-align: center;
}

.steps-container {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.step-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 4px;
    border-left: 4px solid var(--primary);
}

.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.diagram-container {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 2rem 0;
}

.triangle-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--text-primary);
}

.proof-section {
    margin: 2rem 0;
}

.proof-steps {
    padding-left: 1.5rem;
}

.proof-steps li {
    margin: 0.75rem 0;
    color: var(--text-secondary);
}

.proof-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    margin: 1rem auto;
}

.history-section {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 2rem 0;
}

.history-container {
    margin-top: 1rem;
}

.history-item {
    background: var(--surface);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: background 0.3s;
}

.history-item:hover {
    background: #E5E7EB;
}

.footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    text-align: center;
}

.footer-text {
    margin-bottom: 1rem;
    opacity: 0.9;
}

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

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-copyright {
    opacity: 0.7;
    font-size: 0.9rem;
}

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

.page-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.text-center {
    text-align: center;
}

.calculator-main {
    margin: 2rem 0;
}

.calc-inputs-card {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.inputs-grid-main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.unit-calc-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    align-items: end;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.result-card {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-left: 4px solid var(--accent);
}

.result-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.result-big {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
    margin: 1rem 0;
}

.result-highlight {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent);
    margin: 1rem 0;
}

.result-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.formula-box {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 4px;
    margin: 1rem 0;
    text-align: center;
    font-size: 1.5rem;
}

.formula-explain {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

.value-big {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.mini-steps {
    background: var(--surface);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.mini-step {
    padding: 0.5rem;
    margin: 0.25rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.diagram-container-inline {
    margin-top: 1rem;
}

.steps-detailed {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 2rem 0;
}

.steps-detailed h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.subsection-title {
    color: var(--primary);
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    text-align: center;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.example-card {
    background: white;
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-top: 4px solid var(--secondary);
    transition: transform 0.3s;
}

.example-card:hover {
    transform: translateY(-5px);
}

.example-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.example-content p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.example-formula {
    background: var(--surface);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.example-solution {
    font-weight: bold;
    color: var(--accent);
    margin: 0.75rem 0 !important;
}

.practice-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (max-width: 1200px) {
    .practice-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.practice-card {
    background: white;
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-left: 4px solid var(--accent);
}

.practice-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.practice-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.demo-visual {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 2rem 0;
}

.demo-visual h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.step-formula {
    font-family: 'Courier New', monospace;
}

@media (max-width: 1024px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .practice-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .calculator-container {
        grid-template-columns: 1fr;
    }
    
    .inputs-row {
        grid-template-columns: 1fr;
    }
    
    .inputs-grid-main {
        grid-template-columns: 1fr;
    }
    
    .unit-calc-row {
        grid-template-columns: 1fr;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-content {
        flex-direction: column;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .practice-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

/* Blog Styles */
.blog-post-preview {
    background: white;
    padding: 2.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 800px;
    margin: 0 auto;
}

.post-header {
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--accent);
    padding-bottom: 1rem;
}

.post-title-main {
    color: var(--primary);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.post-date {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.post-excerpt {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.blog-post {
    background: white;
    padding: 3rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 900px;
    margin: 2rem auto;
}

.back-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 2rem;
    font-weight: 600;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent);
}

.post-header-full {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 3px solid var(--accent);
    padding-bottom: 2rem;
}

.post-title-full {
    color: var(--primary);
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.post-date-full {
    color: var(--text-secondary);
    font-size: 1rem;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.post-intro {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border-left: 4px solid var(--accent);
    border-radius: 4px;
}

.post-section {
    margin-bottom: 2.5rem;
}

.post-section h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.post-section p {
    color: var(--text-secondary);
    line-height: 1.9;
}

.post-conclusion {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 4px;
    border-left: 4px solid var(--accent);
}

.post-conclusion h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.post-conclusion p {
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.8;
}

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
    display: flex;
    gap: 1rem;
    justify-content: center;
}

@media (max-width: 768px) {
    .blog-post-preview {
        padding: 1.5rem;
    }
    
    .post-title-main {
        font-size: 1.5rem;
    }
    
    .blog-post {
        padding: 1.5rem;
    }
    
    .post-title-full {
        font-size: 1.75rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    .post-intro {
        font-size: 1.05rem;
        padding: 1rem;
    }
    
    .post-section h2 {
        font-size: 1.25rem;
    }
    
    .post-footer {
        flex-direction: column;
    }
}

/* FAQs Styles */
.faqs-container {
    max-width: 900px;
    margin: 2rem auto;
}

.faq-item {
    background: white;
    padding: 1.5rem 2rem;
    margin-bottom: 1.25rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-left: 4px solid var(--accent);
    transition: transform 0.3s, box-shadow 0.3s;
}

.faq-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.faq-question {
    color: var(--primary);
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.faq-answer {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .faq-item {
        padding: 1.25rem 1.5rem;
    }
    
    .faq-question {
        font-size: 1.05rem;
    }
    
    .faq-answer {
        font-size: 0.95rem;
    }
}

/* Diagrams Section Styles */
.diagrams-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin-bottom: 2.5rem;
}

.diagrams-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 2rem 0;
}

.diagram-card {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.diagram-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.diagram-card h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.diagram-visual {
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
}

.diagram-svg {
    width: 100%;
    max-width: 250px;
    height: auto;
}

.squares-visual {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.square-a, .square-b, .square-c {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.square-a {
    width: 60px;
    height: 60px;
    background: var(--primary);
}

.square-b {
    width: 60px;
    height: 60px;
    background: var(--secondary);
}

.square-c {
    width: 80px;
    height: 80px;
    background: var(--accent);
}

.equals-sign {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.diagram-desc {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.formula-highlight {
    background: var(--surface);
    padding: 0.75rem;
    border-radius: 4px;
    font-weight: bold;
    color: var(--primary);
    font-size: 1.15rem;
    margin-top: 1rem;
}

@media (max-width: 1024px) {
    .diagrams-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .diagram-card {
        padding: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .diagram-visual {
        min-height: 150px;
    }
}

/* Enhanced Diagrams Section Styles */
.section-intro {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 800px;
    margin: 0 auto 2.5rem;
    padding: 0 1rem;
}

.diagram-detail {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}

.plus-sign {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.diagram-explanation {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.explanation-box {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.explanation-box h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.explanation-box p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.tip-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    border-left: 4px solid var(--accent);
}

.tip-box h3 {
    color: var(--accent);
}

@media (max-width: 768px) {
    .diagram-explanation {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .section-intro {
        font-size: 1rem;
    }
}

/* Mobile Touch Scroll Prevention */
html, body {
    touch-action: pan-y pinch-zoom;
}

/* Ensure all sections stay within viewport */
.section,
.hero,
.header,
.footer,
.diagrams-section,
.results-grid,
.features-grid,
.diagrams-grid,
.practice-grid {
    max-width: 100%;
    overflow-x: hidden;
}

/* Prevent any child element from causing overflow */
* {
    max-width: 100%;
}

/* Allow specific elements to exceed but still be contained */
img,
svg,
video {
    max-width: 100%;
    height: auto;
}

/* Internal Link Styling for On-Page SEO */
.text-link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.text-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.section-text .text-link,
.section-intro .text-link {
    border-bottom: 1px dotted var(--secondary);
}

.section-text .text-link:hover,
.section-intro .text-link:hover {
    border-bottom: 1px solid var(--primary);
}

/* Diagram Selector Styles */
.diagram-selector-wrapper {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.diagram-selector-label {
    display: block;
    font-weight: 600;
    color: #1E40AF;
    margin-bottom: 10px;
    font-size: 14px;
}

.diagram-selector-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.diagram-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.diagram-btn:hover {
    border-color: #0EA5E9;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.diagram-btn.active {
    background: linear-gradient(135deg, #1E40AF 0%, #0EA5E9 100%);
    color: white;
    border-color: #1E40AF;
    box-shadow: 0 4px 12px rgba(30,64,175,0.3);
}

.diagram-btn-text {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .diagram-selector-buttons {
        flex-direction: column;
    }
    
    .diagram-btn {
        min-width: 100%;
    }
    
    .diagram-btn-text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .diagram-btn-text {
        display: none;
    }
    
    .diagram-btn {
        min-width: 60px;
        padding: 10px;
    }
    
    .diagram-selector-buttons {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Interactive Diagrams Section */
.section-blue {
    background: linear-gradient(135deg, #1E40AF 0%, #0EA5E9 100%);
    color: white;
    padding: 60px 20px;
}

.section-title-white {
    font-size: 32px;
    font-weight: 700;
    color: white;
    text-align: center;
    margin-bottom: 15px;
}

.section-text-white {
    text-align: center;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    margin: 0 auto 40px;
}

.section-note-white {
    text-align: center;
    margin-top: 30px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.interactive-diagrams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 40px 0;
}

.diagram-example-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.diagram-example-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.diagram-example-header {
    padding: 20px;
    background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
    border-bottom: 3px solid #F59E0B;
}

.diagram-example-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1E40AF;
    margin: 0 0 8px 0;
}

.diagram-example-header p {
    font-size: 14px;
    color: #374151;
    margin: 0;
}

.diagram-example-visual {
    padding: 20px;
    background: white;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interactive-diagram-svg {
    width: 100%;
    height: auto;
    max-height: 300px;
}

.diagram-example-controls {
    padding: 15px 20px;
    background: #f9fafb;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.diagram-view-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 15px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.diagram-view-btn:hover {
    border-color: #0EA5E9;
    background: #f0f9ff;
    transform: scale(1.05);
}

.diagram-view-btn.active {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    border-color: #F59E0B;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

@media (max-width: 768px) {
    .interactive-diagrams-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .section-title-white {
        font-size: 26px;
    }
    
    .section-text-white {
        font-size: 16px;
    }
    
    .diagram-example-visual {
        min-height: 240px;
    }
}

/* Formula Card Top - Moved to top of results */
.formula-card-top {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-left: 4px solid var(--accent);
    margin-bottom: 2rem;
}

.formula-card-top h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Full Width Results Section with Two Columns */
.result-full-width {
    background: white;
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.result-full-title {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
}

/* Two Column Layout for Desktop */
.result-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.result-column-left {
    display: flex;
    flex-direction: column;
}

.result-column-right {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.diagram-container-fullwidth {
    width: 100%;
    max-width: 100%;
}

.diagram-container-fullwidth svg {
    width: 100%;
    height: auto;
}

/* Mobile Responsive - Stack Columns */
@media (max-width: 768px) {
    .result-two-columns {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .result-column-right {
        min-height: 250px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Results - Centered calculated value */
.result-big-centered {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent);
    margin: 1.5rem 0;
    text-align: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: 4px;
}

/* Diagrams Grid - Show all 4 diagrams */
.diagrams-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.diagram-card {
    background: white;
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-top: 3px solid var(--secondary);
}

.diagram-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.diagram-container {
    width: 100%;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile: Stack diagrams vertically */
@media (max-width: 768px) {
    .diagrams-grid {
        grid-template-columns: 1fr;
    }
    
    .result-big-centered {
        font-size: 1.5rem;
    }
}

/* Footer SEO Internal Links */
.footer-seo-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 2rem 0;
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-link-column h3 {
    color: #FCD34D;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-link-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-link-column a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.footer-link-column a:hover {
    color: var(--accent);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .footer-seo-links {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Screen Reader Only - Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Content Area Internal Links - SEO - Improved Contrast */
.content-link {
    color: #1E40AF;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid #1E40AF;
    transition: all 0.3s;
}

.content-link:hover {
    color: #0EA5E9;
    border-bottom-color: #0EA5E9;
}

.content-link-white {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    transition: all 0.3s;
}

.content-link-white:hover {
    color: #FCD34D;
    border-bottom-color: #FCD34D;
}
