/* ---------- Design tokens (from the old site's site.css) ---------- */
:root {
    --color-black: #000;
    --color-white: #fff;
    --color-light: #f5f5f5;
    --color-error: #c00;
    --color-error-on-dark: #ff8a8a;

    --font-heading: "Manrope", system-ui, sans-serif;
    --font-body: "Poppins", system-ui, sans-serif;

    --text-small: 0.9rem;
    --text-normal: 1rem;
    --h4: clamp(1.3rem, 2vw, 1.6rem);
    --h3: clamp(1.6rem, 3vw, 2.2rem);
    --h2: clamp(2rem, 4vw, 2.8rem);
    --h1: clamp(2.4rem, 6vw, 4rem);
    --marquee-size: clamp(3.5rem, 11vw, 10rem);

    --gutter: clamp(16px, 4vw, 58px);
    --section-padding: clamp(3rem, 8vw, 6.5rem);
    --content-width: 1440px;
    --header-height: 6rem;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-normal);
    line-height: 1.5;
    background: var(--color-light);
    color: var(--color-black);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    margin: 0 0 1rem;
    font-family: var(--font-heading);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1, .display {
    font-size: var(--h1);
}

h2 {
    font-size: var(--h2);
}

p {
    margin: 0 0 1rem;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

h1:focus {
    outline: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--color-white);
    color: var(--color-black);
}

.skip-link:focus {
    top: 1rem;
}

/* ---------- Header: overlays the first section and takes its text color ---------- */
.site-header {
    position: absolute;
    inset: 0 0 auto;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--gutter);
    color: var(--color-black);
}

body:has(main > .theme-dark:first-child) .site-header {
    color: var(--color-white);
}

main > .page-section:first-child {
    padding-top: calc(var(--header-height) + var(--section-padding) / 2);
}

.site-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    letter-spacing: -0.02em;
    text-decoration: none;
}

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

.nav-link {
    text-decoration: none;
}

.nav-link.active,
.nav-link:hover {
    text-decoration: underline;
    text-underline-offset: 0.3em;
}

.menu-toggle {
    display: grid;
    gap: 6px;
    padding: 0.75rem;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 28px;
    height: 1px;
    background: currentColor;
}

.nav-mobile {
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: var(--header-height) var(--gutter);
    border: 0;
    background: var(--color-light);
    color: var(--color-black);
    font-family: var(--font-heading);
    font-size: var(--h2);
    letter-spacing: -0.02em;
}

.nav-mobile:popover-open {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.nav-mobile a {
    text-decoration: none;
}

.nav-mobile .cta-button {
    font-size: var(--text-normal);
}

.menu-close {
    position: absolute;
    top: 1.5rem;
    right: var(--gutter);
    border: 0;
    background: none;
    color: inherit;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
}

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

    .menu-toggle {
        display: none;
    }
}

/* ---------- Buttons ---------- */
.cta-button {
    display: inline-block;
    padding: 1.1rem 1.6rem;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: var(--text-small);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cta-button:hover,
.cta-button:focus-visible {
    background: var(--section-fg, var(--color-black));
    color: var(--section-bg, var(--color-white));
}

/* ---------- Layout helpers ---------- */
.split {
    display: grid;
    gap: 2rem 4rem;
}

@media (min-width: 900px) {
    .split {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .split-3 {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.full-bleed {
    display: block;
    width: 100%;
}

.content-image {
    display: block;
    width: 100%;
    margin-top: 2rem;
}

.hero {
    min-height: 85vh;
    display: grid;
    align-content: center;
    text-align: center;
}

.hero .lead {
    max-width: 34rem;
    margin: 0 auto 2.5rem;
    font-size: var(--text-small);
}

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

.page-header {
    min-height: 40vh;
    display: grid;
    align-content: end;
}

.simulator-detail {
    display: grid;
    gap: 2rem 4rem;
    align-items: center;
}

.simulator-detail p {
    max-width: 40rem;
}

@media (min-width: 900px) {
    .simulator-detail {
        grid-template-columns: 1.2fr 1fr;
    }
}

/* ---------- Forms (global: <form>/<input> come from framework components, which CSS isolation can't reach) ---------- */
.contact-form {
    display: grid;
    gap: 1.5rem;
    font-size: var(--text-small);
}

.contact-form fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.contact-form legend {
    padding: 0;
    margin-bottom: 0.5rem;
    font-size: var(--text-normal);
}

.contact-form .field {
    display: grid;
    gap: 0.25rem;
}

.contact-form .required {
    opacity: 0.7;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.75rem 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font: inherit;
}

.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.contact-form .cta-button {
    justify-self: start;
}

.contact-form .honeypot {
    position: absolute;
    left: -10000px;
}

.validation-message,
.form-error {
    margin: 0;
    color: var(--color-error);
}

.theme-dark .validation-message,
.theme-dark .form-error {
    color: var(--color-error-on-dark);
}

.form-success {
    font-family: var(--font-heading);
    font-size: var(--h3);
}

/* ---------- Blazor error UI ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}
