:root {
    /* Colors */
    --bg-dark: #121418;
    --bg-card: #1e2229;
    --text-primary: #e6e8eb;
    --text-secondary: #a0a4ab;
    --primary: #3b82f6;
    /* Tech Blue */
    --primary-hover: #2563eb;
    --secondary: #64748b;
    --accent: #f59e0b;
    /* Amber for attention/warnings */

    /* Gradients */
    --gradient-hero: linear-gradient(135deg, #1e2229 0%, #121418 100%);

    /* Spacing */
    --container-width: 1200px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 32px;
    --spacing-xl: 64px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    /* Reduced opacity of overlay to make the background pattern visible */
    background-image: linear-gradient(rgba(18, 20, 24, 0.85), rgba(18, 20, 24, 0.88)), url('../images/bg-mechanics.png');
    background-attachment: fixed;
    background-size: 600px;
    color: var(--text-primary);
    line-height: 1.6;
    scroll-behavior: smooth;
}

h1,
h2,
h3,
h4 {
    font-weight: 700;
    color: #fff;
    margin-bottom: var(--spacing-md);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

ul {
    list-style: none;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.site-header {
    background-color: rgba(18, 20, 24, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: var(--spacing-md) 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-suffix {
    color: var(--primary);
}

.main-nav ul {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.main-nav a:hover {
    color: var(--primary);
}

.main-nav a:hover {
    color: var(--primary);
}

.lang-switcher select {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.lang-switcher select:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-switcher select option {
    background-color: var(--bg-card);
    color: white;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Hero Section */
.hero {
    padding: 80px 0;
    min-height: 80vh;
    display: flex;
    align-items: center;
    background: radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.08), transparent 40%);
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.hero-text h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.hero-text .subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.intro-text {
    margin-bottom: var(--spacing-lg);
    color: var(--text-secondary);
    max-width: 500px;
}

.hero-actions {
    display: flex;
    gap: var(--spacing-md);
}

/* Technical Graphic (Abstract) */
.tech-graphic {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tech-graphic .circle {
    position: absolute;
    border: 1px dashed var(--text-secondary);
    border-radius: 50%;
}

.c1 {
    width: 300px;
    height: 300px;
    animation: rotate 20s linear infinite;
}

.c2 {
    width: 200px;
    height: 200px;
    border-color: var(--primary);
    animation: rotate-rev 15s linear infinite;
}

.tech-graphic .line {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.1);
}

.l1 {
    width: 100%;
    height: 1px;
}

.l2 {
    width: 1px;
    height: 100%;
}

.dimension {
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: var(--primary);
    border: 1px solid var(--primary);
    z-index: 1;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rotate-rev {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

/* Calculator Section */
.section-calculateur {
    padding: var(--spacing-xl) 0;
    background-color: #171b21;
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.calculator-card {
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.form-group input[type="number"] {
    width: 100%;
    padding: 12px;
    background-color: #0f1115;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.1rem;
    font-family: 'Roboto Mono', monospace;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}

.hint {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .radio-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tables Section */
.iso-table-img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    /* "Adapt theme": Invert the white image to match dark mode */
    filter: invert(1) hue-rotate(180deg) contrast(0.9);
    mix-blend-mode: screen;
    /* Helps blend the background if nice */
}

.table-wrapper.image-mode {
    background: transparent;
    border: none;
    padding: 0;
    overflow: hidden;
}

.radio-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
}

.radio-card {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.radio-card:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.radio-card.selected {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
}

.radio-card input {
    position: absolute;
    opacity: 0;
}

.class-letter {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.class-name {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Result Box */
.result-box {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-top: var(--spacing-lg);
    animation: slideDown 0.3s ease-out;
}

.result-box.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    text-align: center;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    text-align: center;
}

.res-item {
    display: flex;
    flex-direction: column;
}

.res-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.res-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

#resTolerance {
    color: var(--primary);
}

#resMin,
#resMax {
    color: #fff;
}

/* Content Section */
.section-content {
    padding: var(--spacing-xl) 0;
}

.content-grid {
    max-width: 800px;
    margin: 0 auto;
}

.feature-list {
    margin: var(--spacing-lg) 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.feature-list li {
    display: flex;
    gap: var(--spacing-md);
    background: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
}

.feature-list .icon {
    font-size: 2rem;
}

.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.class-card {
    background: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
}

.badge {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 50%;
    margin-bottom: var(--spacing-sm);
    font-weight: bold;
    color: #121418;
}

.badge.f {
    background-color: #60a5fa;
}

.badge.m {
    background-color: #34d399;
}

.badge.c {
    background-color: #fbbf24;
}

.badge.v {
    background-color: #f87171;
}

/* FAQ Section */
.section-faq {
    padding: var(--spacing-xl) 0;
    background-color: #171b21;
}

.faq-grid {
    display: grid;
    gap: var(--spacing-md);
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
}

.faq-item h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.faq-item p {
    color: var(--text-secondary);
}

/* Footer */
.site-footer {
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-col h4 {
    margin-bottom: var(--spacing-md);
}

.footer-col ul li {
    margin-bottom: var(--spacing-sm);
}

.footer-col a {
    color: var(--text-secondary);
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-actions {
        justify-content: center;
    }

    .tech-graphic {
        display: none;
        /* Hide confusing visual on mobile if space is tight */
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* Tables Section */
    .section-tables {
        padding: var(--spacing-xl) 0;
        background-color: var(--bg-dark);
    }

    .table-wrapper {
        overflow-x: auto;
        margin-bottom: var(--spacing-lg);
        background: var(--bg-card);
        border-radius: var(--radius-md);
        padding: var(--spacing-md);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .iso-table {
        width: 100%;
        border-collapse: collapse;
        min-width: 800px;
    }

    .iso-table th,
    .iso-table td {
        padding: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
        font-size: 0.9rem;
    }

    .iso-table th {
        background-color: rgba(59, 130, 246, 0.1);
        color: var(--primary);
        font-weight: 600;
    }

    .iso-table td:first-child {
        font-weight: bold;
        color: var(--text-primary);
        background-color: rgba(255, 255, 255, 0.02);
    }

    .iso-table tbody tr:hover {
        background-color: rgba(255, 255, 255, 0.02);
    }

    .action-bar {
        text-align: center;
        margin-top: var(--spacing-lg);
    }