/* Base styles and CSS variables */
:root {
    --primary-color: #1976d2;
    --secondary-color: #1a237e;
    --background-color: #f8f9fa;
    --text-color: #333;
    --border-color: #ddd;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
    --container-width: 1200px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
    line-height: 1.6;
    color: var(--text-color);
    padding: 1.5em 4em;
    margin: 0 auto;
    max-width: var(--container-width);
}

/* Typography */
h1, h2, h3, p {
    text-align: center;
    margin-bottom: 0.5em;
    margin-left: auto;
    margin-right: auto;
    max-width: 1000px;
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--primary-color);
    margin-top: 1.5em;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-top: 1.2em;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--secondary-color);
    margin-top: 1em;
}

p {
    font-size: clamp(1rem, 2vw, 1.5rem);
}

/* Form elements */
input[type="number"],
input[type="text"],
select {
    font-size: clamp(1.1rem, 2vw, 2.5rem);
    padding: 0.7em 1em;
    width: 100%;
    max-width: 400px;
    min-width: 140px;
    border: 1px solid var(--border-color);
    border-radius: 0.3em;
    margin: 0.2em 0 0.8em;
    transition: border-color var(--transition-speed);
}

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

select {
    width: 7em;
    max-width: 6em;
    min-width: 6em;
}

label {
    display: block;
    font-size: clamp(1rem, 1.5vw, 1.22rem);
    font-weight: 500;
    margin-bottom: 0.8em;
}

/* Navigation */
.navmenu {
    background: var(--background-color);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.navlink {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.navlink a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color var(--transition-speed);
}

.navlink a:hover {
    background-color: #e9ecef;
}

.navlink a.current {
    background-color: var(--primary-color);
    color: white;
}

/* Containers and components */
.main-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 20px;
}

.chart-container {
    width: min(90vw, 900px);
    margin: 40px auto;
    height: clamp(300px, 50vh, 400px);
}

/* Responsive SVG container */
.svg-container {
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    padding: 0 10px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible !important;
    overflow-clip-margin: unset;
}

.svg-container object,
.svg-container img,
.svg-container svg {
    width: 100%;
    height: auto;
    display: block;
    min-height: auto;
    max-width: 100%;
    overflow: visible !important;
    overflow-clip-margin: unset;
}

/* Info box styling */
.info-box {
    background-color: #f5f5f5;
    border-left: 4px solid #1976d2;
    padding: 1rem;
    margin: 1.5rem auto;
    max-width: 1000px;
    border-radius: 4px;
    display: flex;
    gap: 1rem;
}

.info-box .info-icon {
    font-size: 1.25rem;
    color: #1976d2;
}

/* Lists - align with paragraph width */
ul {
    font-size: clamp(1rem, 2vw, 1.5rem);
    line-height: 1.6;
    margin: 1em auto;
    max-width: 1000px;
    padding-left: 2em;
    text-align: left;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

ul li {
    margin-bottom: 0.5em;
    text-align: left;
}

/* Agenda / Table of Contents */
.agenda-section {
    background-color: #f5f5f5;
    border-left: 4px solid var(--primary-color);
    border-radius: 0.5em;
    padding: 1.5em;
    margin: 2em auto;
    max-width: 1000px;
}

.table-container  .measurement-table {
    text-align: center;
    width: 100%;
    max-width: 1000px;
    margin: 2em auto;
    overflow-x: auto;
}

.contact-button {
    display: inline-block;
    padding: 0.7em 1.5em;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 0.3em;
    transition: background-color var(--transition-speed);
    margin: 1em auto;
}

.contact-button:hover {
    background-color: #005ea6;
    cursor: pointer;
}

/* Center the contact button container */
.contact-section {
    text-align: center;
    width: 100%;
    margin: 2em 0;
    padding: 2em;
}

.contact-section .contact-button {
    display: inline-block;
    text-align: center;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        padding: 1em;
    }

    .hamburger {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
        z-index: 100;
    }

    .navlink {
        display: none;
        flex-direction: column;
        width: 100%;
        text-align: center;
        gap: 0.5rem;
    }

    .navlink.active {
        display: flex;
    }

    input[type="number"],
    input[type="text"],
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 8px 12px;
    }
    
    .info-box {
        margin: 1rem;
        padding: 0.8rem;
    }

    .svg-container {
        margin: 10px auto;
        padding: 0 5px;
        width: 95%;
    }

    .svg-container object,
    .svg-container img,
    .svg-container svg {
        width: 100%;
        height: auto;
        margin-bottom: 10px;
    }

    .contact-section {
        text-align: center;
        padding: 1.5em;
        margin: 1.5em 0;
    }

    .contact-button {
        display: inline-block;
        padding: 0.6em 1.2em;
        font-size: 1rem;
    }

    h1, h2, h3, p {
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }

    ul {
        text-align: left;
        max-width: 90%;
        margin: 1em auto;
        padding-left: 1.5em;
        margin-left: auto;
        margin-right: auto;
    }

    ul li {
        text-align: left;
        margin-bottom: 0.5em;
    }

    .agenda-section {
        max-width: 90%;
    }

    .table-container .measurement-table {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    h1, h2, h3, p {
        max-width: 95%;
    }

    ul {
        max-width: 95%;
        text-align: left;
        margin: 1em auto;
        padding-left: 1.2em;
        margin-left: auto;
        margin-right: auto;
    }

    .info-box {
        max-width: 95%;
    }

    .agenda-section {
        max-width: 95%;
    }

    .table-container .measurement-table {
        max-width: 95%;
    }
}

/* Add specific iPhone optimizations */
@media screen and (max-width: 430px) {
    .svg-container {
        width: 98%;
        margin: 5px auto;
    }

    .svg-container object,
    .svg-container img,
    .svg-container svg {
        width: 100%;
        height: auto;
        margin-bottom: 15px;
    }

    .contact-section {
        padding: 1em;
    }

    .contact-button {
        display: block;
        width: 80%;
        max-width: 300px;
        margin: 1em auto;
        padding: 0.8em 1.5em;
    }
}

/* Fix for iOS 100vh issue */
@supports (-webkit-touch-callout: none) {
    .full-height {
        height: -webkit-fill-available;
    }
}