/* ============================================================
   Theme tokens
   ============================================================ */

:root,
:root[data-theme="default"] {
    color-scheme: dark;

    --background: #080808;
    --surface: #131313;
    --surface-border: #292929;

    --header-background: #000000;
    --footer-background: #000000;
    --footer-border: #292929;

    --primary: #d00000;
    --primary-hover: #ff2020;

    --text: #ffffff;
    --text-muted: #b8b8b8;
    --button-text: #ffffff;

    --control-background: #131313;
    --control-border: #555555;

    --focus-color: #ff2020;

    --max-width: 1200px;
}

/* Pastel gray and blue */

:root[data-theme="light"] {
    color-scheme: light;

    --background: #e9edf3;
    --surface: #f8faff;
    --surface-border: #cbd5e1;

    --header-background: #dce5f0;
    --footer-background: #dce5f0;
    --footer-border: #b8c7d8;

    --primary: #365f91;
    --primary-hover: #8a9db4;

    --text: #202b3a;
    --text-muted: #4e5e71;
    --button-text: #ffffff;

    --control-background: #ffffff;
    --control-border: #8a9db4;

    --focus-color: #365f91;
}

/* Black with green accents */

:root[data-theme="color2"] {
    color-scheme: dark;

    --background: #080b08;
    --surface: #111711;
    --surface-border: #29402d;

    --header-background: #000000;
    --footer-background: #000000;
    --footer-border: #29402d;

    --primary: #1f5d29;
    --primary-hover: #398b47;

    --text: #ffffff;
    --text-muted: #b8c9bb;
    --button-text: #ffffff;

    --control-background: #111711;
    --control-border: #42734b;

    --focus-color: #62ad70;
}

/* ============================================================
   Global
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    background: var(--background);
    color: var(--text);

    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

.container {
    width: min(
        var(--max-width),
        calc(100% - 40px)
    );

    margin-inline: auto;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
    background: var(--header-background);
    border-bottom: 2px solid var(--primary);
}

.header-content {
    min-height: 84px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;

    color: var(--text);
    text-decoration: none;
}

.brand-accent {
    color: var(--primary);
}


/* ============================================================
   Navigation
   ============================================================ */

.primary-navigation,
.footer-navigation {
    display: flex;
    align-items: center;
    gap: 28px;
}

.primary-navigation a,
.footer-navigation a {
    color: var(--text);

    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;

    transition: color 0.2s ease;
}

.primary-navigation a:hover,
.primary-navigation a:focus-visible,
.footer-navigation a:hover,
.footer-navigation a:focus-visible {
    color: var(--primary-hover);
}

/* Hidden by default; displayed only on mobile with JavaScript. */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 44px;
    padding: 8px 12px;

    background: var(--control-background);
    color: var(--text);

    border: 1px solid var(--control-border);
    border-radius: 4px;

    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.nav-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-toggle-icon span {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
}

.nav-toggle:hover {
    border-color: var(--primary);
}

.skip-link {
    position: absolute;
    z-index: 1000;
    top: -100px;
    left: 12px;

    padding: 12px 16px;

    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--focus-color);
}

.skip-link:focus {
    top: 12px;
}


/* ============================================================
   Theme picker
   ============================================================ */

.theme-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-picker label {
    color: var(--text-muted);

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.theme-picker select {
    min-height: 38px;
    padding: 7px 12px;

    background: var(--control-background);
    color: var(--text);

    border: 1px solid var(--control-border);
    border-radius: 4px;

    font: inherit;
    font-size: 13px;

    cursor: pointer;
}

.theme-picker select:hover {
    border-color: var(--primary);
}

/* ============================================================
   Main
   ============================================================ */

main {
    flex: 1;
    padding-block: 60px;
}

.content-panel {
    min-height: 350px;
    padding: 50px;

    background: var(--surface);

    border: 1px solid var(--surface-border);
    border-top: 3px solid var(--primary);
    border-radius: 6px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 18px;

    color: var(--primary-hover);

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 24px;

    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.2;
}

h1::after {
    content: "";
    display: block;

    width: 70px;
    height: 4px;
    margin-top: 20px;

    background: var(--primary);
}

p {
    max-width: 680px;
    margin-bottom: 20px;

    color: var(--text-muted);
    font-size: 17px;
}

/* ============================================================
   Buttons
   ============================================================ */

.actions {
    margin-top: 36px;
}

.button {
    display: inline-block;
    padding: 13px 28px;

    background: var(--primary);
    color: var(--button-text);

    border-radius: 4px;

    font-weight: 700;
    text-decoration: none;

    transition: background 0.2s ease;
}

.button:hover {
    background: var(--primary-hover);
}

a:focus-visible,
button:focus-visible,
select:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 4px;
}


/* ============================================================
   Footer
   ============================================================ */

.site-footer {
    background: var(--footer-background);
    padding: 28px 0;

    border-top: 1px solid var(--footer-border);

    color: var(--text-muted);
    font-size: 13px;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-brand .brand-accent {
    font-weight: 700;
}

.footer-navigation {
    gap: 20px;
}

.footer-navigation a {
    font-size: 12px;
}



/* ============================================================
   Responsive layout
   ============================================================ */

@media (max-width: 1000px) and (min-width: 701px) {
    .header-content {
        flex-wrap: wrap;
        justify-content: space-between;
        padding-block: 16px;
    }

    .brand {
        flex: 1 1 100%;
    }

    .primary-navigation {
        gap: 20px;
    }
}

@media (max-width: 700px) {
    .container {
        width: calc(100% - 32px);
    }

    .header-content {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 14px;

        padding-block: 16px;
    }

    .brand {
        min-width: 0;
        overflow-wrap: anywhere;
        font-size: clamp(14px, 3.5vw, 18px);
    }

    .js-nav .nav-toggle {
        display: inline-flex;
        grid-column: 2;
        grid-row: 1;
    }

    .primary-navigation {
        grid-column: 1 / -1;
        grid-row: 2;

        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;

        width: 100%;
        padding-block: 8px;

        border-top: 1px solid var(--surface-border);
    }

    .js-nav .primary-navigation {
        display: none;
    }

    .js-nav .primary-navigation.is-open {
        display: flex;
    }

    .primary-navigation a {
        display: block;
        padding: 13px 12px;
        border-radius: 4px;
    }

    .primary-navigation a:hover,
    .primary-navigation a:focus-visible {
        background: var(--surface);
    }

    .theme-picker {
        grid-column: 1 / -1;
        grid-row: 3;

        justify-content: space-between;
        padding-top: 12px;

        border-top: 1px solid var(--surface-border);
    }

    .theme-picker select {
        min-height: 44px;
    }

    main {
        padding-block: 30px;
    }

    .content-panel {
        padding: 30px 24px;
        min-height: 0;
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
        gap: 18px;
        text-align: center;
    }

    .footer-navigation {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
}

@media (max-width: 380px) {
    .container {
        width: calc(100% - 24px);
    }

    .header-content {
        gap: 10px;
    }

    .nav-toggle {
        padding: 8px;
    }

    .nav-toggle-label {
        display: none;
    }

    .content-panel {
        padding: 24px 18px;
    }
}

/* ============================================================
   Reduced motion accessibility
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ============================================================
   Page presentation — Issue #8
   ============================================================ */

.page-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 460px;
    overflow: hidden;

    padding: clamp(36px, 6vw, 80px);

    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-top: 3px solid var(--primary);
    border-radius: 6px;
}

.home-hero {
    min-height: 540px;
}

.page-hero-compact {
    min-height: 300px;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

.page-hero h1 {
    max-width: 760px;
    margin-bottom: 28px;

    font-size: clamp(36px, 6vw, 76px);
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.page-hero-compact h1 {
    font-size: clamp(36px, 5vw, 60px);
}

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

.hero-description {
    max-width: 650px;
    margin: 0;

    font-size: clamp(17px, 2vw, 21px);
    line-height: 1.75;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.button-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--primary);
}

.button-outline:hover {
    background: var(--surface-border);
}

/* ============================================
   Animated Hero Background
   ============================================ */

.hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.hero-content {
    position: relative;
    z-index: 5;
}

.hero-decoration {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    display: block;
    box-sizing: border-box;
    will-change: transform, opacity;
}

/* ============================================
   Squares - Right to Left
   ============================================ */

.square {
    border: 3px solid var(--primary);
    background: transparent;

    animation-name: square-drift;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.square-1 {
    width: 65px;
    height: 65px;
    top: 12%;

    animation-duration: 32s;
    animation-delay: -4s;
}

.square-2 {
    width: 140px;
    height: 140px;
    top: 48%;

    animation-duration: 45s;
    animation-delay: -20s;
}

.square-3 {
    width: 95px;
    height: 95px;
    top: 75%;

    animation-duration: 38s;
    animation-delay: -30s;
}

.square-4 {
    width: 210px;
    height: 210px;
    top: 25%;

    animation-duration: 42s;
    animation-delay: -15s;
}

.square-5 {
    width: 45px;
    height: 45px;
    top: 35%;

    animation-duration: 55s;
    animation-delay: -42s;
}

.square-6 {
    width: 110px;
    height: 110px;
    top: 55%;

    animation-duration: 75s;
    animation-delay: -28s;
}

.square-7 {
    width: 250px;
    height: 250px;
    top: 75%;

    animation-duration: 25s;
    animation-delay: -12s;
}

@keyframes square-drift {
    from {
        transform:
            translateX(110vw)
            rotate(0deg);
    }

    to {
        transform:
            translateX(-250px)
            rotate(180deg);
    }
}

/* ============================================
   Circles - Pulsing
   ============================================ */

.circle {
    border: 3px solid var(--primary);
    border-radius: 50%;
    background: transparent;

    animation-name: circle-pulse;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.circle-1 {
    width: 90px;
    height: 90px;

    top: 15%;
    left: 12%;

    animation-duration: 4s;
    animation-delay: -1s;
}

.circle-2 {
    width: 180px;
    height: 180px;

    top: 55%;
    left: 72%;

    animation-duration: 6s;
    animation-delay: -3s;
}

.circle-3 {
    width: 65px;
    height: 65px;

    top: 72%;
    left: 35%;

    animation-duration: 3.5s;
    animation-delay: -2s;
}

.circle-4 {
    width: 250px;
    height: 250px;

    top: 5%;
    left: 82%;

    animation-duration: 8s;
    animation-delay: -5s;
}

.circle-5 {
    width: 125px;
    height: 125px;

    top: 15%;
    left: 52%;

    animation-duration: 12s;
    animation-delay: -3s;
}


.circle-6 {
    width: 50px;
    height: 50px;

    top: 18%;
    left: 88%;

    animation-duration: 15s;
    animation-delay: -8s;
}

@keyframes circle-pulse {
    from {
        transform: scale(0.8);
        opacity: 0.35;
    }

    to {
        transform: scale(1.25);
        opacity: 1;
    }
}

/* ============================================
   Triangles - Falling
   ============================================ */

.triangle {
    background: var(--primary);

    clip-path: polygon(
        50% 0%,
        0% 100%,
        100% 100%
    );

    animation-name: triangle-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.triangle-1 {
    width: 35px;
    height: 35px;

    left: 15%;

    animation-duration: 12s;
    animation-delay: -2s;
}

.triangle-2 {
    width: 75px;
    height: 75px;

    left: 42%;

    animation-duration: 18s;
    animation-delay: -12s;
}

.triangle-3 {
    width: 115px;
    height: 115px;

    left: 78%;

    animation-duration: 23s;
    animation-delay: -8s;
}

.triangle-4 {
    width: 55px;
    height: 55px;

    left: 92%;

    animation-duration: 15s;
    animation-delay: -13s;
}

.triangle-5 {
    width: 155px;
    height: 155px;

    left: 17%;

    animation-duration: 19s;
    animation-delay: -23s;
}

.triangle-6 {
    width: 30px;
    height: 30px;

    left: 32%;

    animation-duration: 11s;
    animation-delay: -6s;
}

@keyframes triangle-fall {
    0% {
        transform:
            translateY(-150px)
            rotate(-20deg);

        opacity: 0;
    }

    10% {
        opacity: 0.7;
    }

    90% {
        opacity: 0.7;
    }

    100% {
        transform:
            translateY(calc(100vh + 150px))
            rotate(60deg);

        opacity: 0;
    }
}

/* ============================================
   Responsive Geometry
   ============================================ */

@media (max-width: 700px) {

    .layer-squares {
        opacity: 0.07;
    }

    .layer-circles {
        opacity: 0.12;
    }

    .layer-triangles {
        opacity: 0.16;
    }

    .square-4,
    .circle-4,
    .triangle-3 {
        display: none;
    }

    .circle-2 {
        left: 65%;
    }

    .circle-3 {
        left: 20%;
    }
}

/* Depth */

.layer-squares {
    z-index: 1;
    opacity: 0.12;
}

.layer-circles {
    z-index: 2;
    opacity: 0.22;
}

.layer-triangles {
    z-index: 3;
    opacity: 0.3;
}

/* Sections */

.page-section {
    padding-block: clamp(42px, 6vw, 80px);
}

.section-heading {
    margin-bottom: 32px;
}

.section-heading h2,
.callout-section h2 {
    margin: 0 0 18px;

    color: var(--text);
    font-size: clamp(26px, 3.5vw, 42px);
    line-height: 1.2;
}

.section-heading p {
    margin: 0;
}

.section-copy p:first-child {
    margin-top: 0;
}

/* Reusable feature cards */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 280px), 1fr)
    );
    gap: 24px;
}

.feature-card,
.contact-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    padding: 32px;

    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
}

.feature-card h3,
.contact-card h3 {
    margin: 12px 0;

    color: var(--text);
    font-size: 22px;
}

.feature-card p,
.contact-card p {
    margin: 0 0 20px;
    font-size: 16px;
}

.card-number {
    color: var(--primary-hover);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
}

.text-link {
    margin-top: auto;

    color: var(--primary-hover);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.text-link:hover,
.text-link:focus-visible {
    text-decoration: underline;
}

/* About page */

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: clamp(24px, 5vw, 70px);
}

.split-layout .section-heading {
    margin-bottom: 0;
}

.callout-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 28px;

    padding: clamp(28px, 5vw, 50px);

    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-left: 4px solid var(--primary);
    border-radius: 6px;
}

.callout-section p {
    margin-bottom: 0;
}

/* Contact page */

.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.contact-status {
    padding: 10px 14px;

    background: var(--background);
    color: var(--text-muted);

    border: 1px solid var(--surface-border);
    border-radius: 4px;

    font-size: 13px;
}

/* Responsive page layouts */

@media (max-width: 800px) {
    .split-layout,
    .contact-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .page-hero,
    .home-hero,
    .page-hero-compact {
        min-height: 0;
        padding: 36px 24px;
    }

    .page-hero h1 {
        font-size: clamp(34px, 9vw, 52px);
    }

    .hero-actions {
        gap: 12px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .feature-card,
    .contact-card {
        padding: 26px 22px;
    }

    .hero-decoration {
        opacity: 0.5;
    }

    .callout-section {
        align-items: stretch;
    }
}

@media (max-width: 380px) {
    .page-hero,
    .home-hero,
    .page-hero-compact {
        padding: 28px 18px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions .button {
        text-align: center;
    }
}

/* ============================================
   Reduced Motion Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {

    .shape {
        animation: none !important;
        will-change: auto;
    }

    .square {
        transform: translateX(20vw) rotate(25deg);
    }

    .triangle {
        transform: translateY(30px);
    }

    .circle {
        transform: scale(1);
        opacity: 0.7;
    }
}