:root {
    /* Color Palette - derived from project logos */
    --charcoal: #1a1a1a;
    --navy: #0d126e;
    --terracotta: #b75b39;
    --warm-white: #faf9f7;
    --pure-white: #ffffff;
    
    /* Text colors */
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    /* Borders */
    --border-light: #e5e5e5;
    --border-subtle: #f0f0f0;
    
    /* Type Scale (base 16px, ratio 1.25) */
    --text-xs: 0.8rem;      /* 12.8px - fine print */
    --text-sm: 0.875rem;    /* 14px - captions, meta */
    --text-base: 1rem;      /* 16px - body */
    --text-lg: 1.125rem;    /* 18px - lead text */
    --text-xl: 1.25rem;     /* 20px - subheadings */
    --text-2xl: 1.5rem;     /* 24px - headings */
    
    /* Line Heights */
    --leading-tight: 1.3;   /* headings */
    --leading-normal: 1.5;  /* body, UI */
    --leading-relaxed: 1.7; /* prose blocks */
    
    /* Letter Spacing */
    --tracking-tight: -0.01em;  /* large headings */
    --tracking-normal: 0;       /* body */
    --tracking-wide: 0.02em;    /* small caps, meta */
    
    /* Spacing Scale (8px base) */
    --space-1: 0.5rem;    /* 8px */
    --space-2: 1rem;      /* 16px */
    --space-3: 1.5rem;    /* 24px */
    --space-4: 2rem;      /* 32px */
    --space-5: 3rem;      /* 48px */
    --space-6: 4rem;      /* 64px */
}

.text-terracotta {
    color: var(--terracotta);
}

.text-navy {
    color: var(--navy);
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--warm-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-5) var(--space-3);
}

.container {
    max-width: 820px;
    width: 100%;
    background: var(--pure-white);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    padding: var(--space-5);
    text-align: center;
}

/* Logo */
header {
    margin-bottom: var(--space-5);
}

.logo {
    max-width: 320px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Tagline - for tagline variant */
.tagline {
    font-family: 'Vollkorn', Georgia, serif;
    font-size: var(--text-lg);
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 0;
    margin-bottom: var(--space-2);
    letter-spacing: var(--tracking-normal);
}

/* Manifesto - for manifesto variant */
.manifesto-block {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-bottom: var(--space-5);
    transition: transform 0.2s ease;
}

.manifesto-block:hover {
    transform: translateY(-3px);
}

.manifesto-block:hover .manifesto-cta {
    color: var(--text-primary);
}

.manifesto-block .manifesto {
    margin-bottom: 0;
}

.manifesto {
    max-width: 480px;
    margin: 0 auto var(--space-5) auto;
    padding: var(--space-4) 0;
}

.manifesto-cta {
    color: var(--text-muted);
    white-space: nowrap;
    transition: color 0.2s ease;
}

.manifesto-headline {
    font-family: 'Vollkorn', Georgia, serif;
    font-size: var(--text-2xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    letter-spacing: var(--tracking-tight);
}

.manifesto-text {
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* Projects Section */
.projects {
    margin-bottom: var(--space-5);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.project-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-4) var(--space-3);
    background: var(--warm-white);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

.project-card--navy:hover {
    border-color: var(--navy);
}

.project-card--terracotta:hover {
    border-color: var(--terracotta);
}

.project-logo {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-2);
    object-fit: contain;
}

.project-name {
    font-family: 'Vollkorn', Georgia, serif;
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.project-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-1);
}

.project-url {
    font-size: var(--text-xs);
    color: var(--text-muted);
    letter-spacing: var(--tracking-wide);
}

/* How We Build Page */
.logo-back {
    display: block;
    transition: opacity 0.2s ease;
}

.logo-back:hover {
    opacity: 0.7;
}

.logo-back .logo {
    margin: 0 auto;
}

.logo--small {
    max-width: 140px;
}

/* Prose intro */
.prose-intro {
    margin-bottom: var(--space-4);
}

.prose-lead {
    font-family: 'Vollkorn', Georgia, serif;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    line-height: var(--leading-normal);
}

/* Build principles grid */
.build-principles {
    margin-bottom: var(--space-5);
}

.build-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    text-align: left;
}

.build-item {
    padding: 0;
}

.build-item-title {
    font-family: 'DM Sans', sans-serif;
    font-size: var(--text-base);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.build-item-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-normal);
}

/* Contact Section */
.contact {
    margin-bottom: var(--space-5);
}

.contact-link {
    font-family: 'Vollkorn', Georgia, serif;
    font-size: var(--text-base);
    color: var(--text-primary);
    text-decoration: none;
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--charcoal);
    border-radius: 6px;
    display: inline-block;
    transition: all 0.2s ease;
}

.contact-link.glow-active {
    animation: contactGlow 3s ease-in-out infinite;
}

@keyframes contactGlow {
    0%, 100% {
        box-shadow: 0 0 12px rgba(255, 215, 100, 0.4);
    }
    50% {
        box-shadow: 0 0 28px rgba(255, 210, 80, 0.6), 0 0 50px rgba(255, 200, 70, 0.35);
    }
}

.contact-link:hover {
    background: var(--charcoal);
    color: var(--pure-white);
    animation: contactGlow 3s ease-in-out infinite;
    box-shadow: 0 0 28px rgba(255, 210, 80, 0.6), 0 0 50px rgba(255, 200, 70, 0.35);
}

button.contact-link {
    cursor: pointer;
    background: transparent;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(250, 249, 247, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    padding: var(--space-3);
}

.modal-overlay.modal-open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--pure-white);
    border-radius: 12px;
    padding: var(--space-5);
    max-width: 480px;
    width: 100%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.modal-open .modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: var(--space-4);
    height: var(--space-4);
    border: none;
    background: transparent;
    font-size: var(--text-2xl);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

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

.modal-title {
    font-family: 'Vollkorn', Georgia, serif;
    font-size: var(--text-2xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.modal-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-3);
}

.form-group {
    margin-bottom: var(--space-3);
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: var(--leading-normal);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-1) var(--space-2);
    font-family: 'DM Sans', sans-serif;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--warm-white);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.modal-submit {
    width: 100%;
    padding: var(--space-1) var(--space-3);
    font-family: 'Vollkorn', Georgia, serif;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.modal-submit.sending {
    color: var(--text-muted);
    pointer-events: none;
}

.modal-submit.sent {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--pure-white);
    font-size: var(--text-lg);
    animation: sentBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-submit .checkmark {
    display: inline-block;
    font-size: 1.3em;
    font-weight: 700;
    margin-left: 0.25em;
    vertical-align: middle;
}

@keyframes sentBounce {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Footer */
footer {
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

footer p {
    font-size: var(--text-xs);
    color: var(--text-muted);
    letter-spacing: var(--tracking-wide);
}

.footer-outside {
    text-align: center;
    padding: var(--space-3);
    border-top: none;
}

/* Footer philosophy - for footer variant */
.footer-philosophy {
    font-family: 'Vollkorn', Georgia, serif;
    font-style: italic;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: var(--space-3) var(--space-2);
    }

    .container {
        padding: var(--space-4) var(--space-3);
    }

    .logo {
        max-width: 260px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .project-card {
        padding: var(--space-3) var(--space-2);
    }

    .manifesto {
        padding: var(--space-3) 0;
    }

    .manifesto-headline {
        font-size: var(--text-xl);
    }

    .prose-lead {
        font-size: var(--text-lg);
    }

    .build-grid {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .logo--small {
        max-width: 100px;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: var(--space-4) var(--space-3);
    }
}

@media (max-width: 400px) {
    .container {
        padding: var(--space-4) var(--space-2);
    }

    .logo {
        max-width: 220px;
    }
}
