:root {
    --white:          #ffffff;
    --off-white:      #fafafa;
    --light-gray:     #f5f5f5;
    --border-gray:    #e5e5e5;
    --muted:          #a3a3a3;
    --body:           #525252;
    --headings:       #171717;
    --black:          #000000;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: "ss01", "cv11";
    color: var(--body);
    line-height: 1.6;
    background: var(--off-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3 {
    color: var(--headings);
    letter-spacing: -0.02em;
    font-weight: 600;
    line-height: 1.1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Editorial caption used above every section heading */
.eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 24px;
}

.eyebrow-light {
    color: rgba(255, 255, 255, 0.6);
}

/* Skip link (a11y) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--black);
    color: var(--white);
    padding: 10px 16px;
    text-decoration: none;
    font-weight: 600;
    z-index: 10000;
}

.skip-link:focus,
.skip-link:focus-visible {
    left: 12px;
    top: 12px;
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

/* Global focus-visible */
a:focus-visible,
button:focus-visible,
.hamburger:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 3px;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid transparent;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: border-color 0.2s ease;
}

.navbar.scrolled {
    border-bottom-color: var(--border-gray);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
}

.nav-logo .logo {
    /* Reduced another 1/3 after the halving still felt large. Desktop = 88px;
     * mobile capped lower in the @media block. PNG already trimmed to its
     * artwork bbox. */
    height: 88px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--headings);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    padding-bottom: 3px;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: var(--black);
    transition: width 0.2s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 6px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--black);
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: block;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Hero */
.hero {
    background: var(--off-white);
    /* Top padding clears the fixed navbar (88px logo + 14px*2 padding ≈
     * 116px) plus breathing room above the headline. */
    padding: 160px 0 64px;
}

.hero .container {
    max-width: 900px;
    margin: 0;
    padding-left: clamp(24px, 8vw, 120px);
    padding-right: 24px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.0;
    color: var(--headings);
    margin-bottom: 28px;
    max-width: 880px;
}

.hero-subtitle {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    line-height: 1.35;
    color: var(--body);
    font-weight: 400;
    max-width: 600px;
}

.hero-rule {
    border: 0;
    border-top: 1px solid var(--border-gray);
    margin: 56px 0 24px;
    max-width: 600px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    max-width: 600px;
    font-size: 1rem;
}

.hero-cta {
    color: var(--black);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.hero-cta:hover {
    border-bottom-color: var(--black);
}

.hero-stamp {
    color: var(--muted);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* Numbers strip */
.stats {
    background: var(--white);
    border-top: 1px solid var(--border-gray);
    border-bottom: 1px solid var(--border-gray);
    padding: 64px 0;
}

.stats-grid {
    list-style: none;
    display: grid;
    /* Three hero numbers. Real numbers only — certifications live in the
     * credentials strip below. */
    grid-template-columns: repeat(3, 1fr);
    gap: 60px;
    align-items: baseline;
    max-width: 1000px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stat-num {
    /* Three stats — dial down from the 2-stat hero size so the row breathes. */
    font-size: clamp(2.75rem, 6vw, 4.5rem);
    font-weight: 600;
    color: var(--black);
    line-height: 1;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.stat-caption {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
}

/* Credentials block — categorised <dl> below the numbers. Reads like the
 * "Capabilities" page of a capability statement, not a tag-cloud dump. */
.credentials {
    margin-top: 56px;
    padding-top: 36px;
    border-top: 1px solid var(--border-gray);
    max-width: 960px;
}

.credentials-label {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 24px;
}

.credentials-grid {
    display: grid;
    /* Left col = small uppercase category label, right col = the list.
     * Auto-row, gap between rows = visible hairline divider effect. */
    grid-template-columns: minmax(160px, 220px) 1fr;
    column-gap: 48px;
    row-gap: 0;
}

.credentials-grid dt,
.credentials-grid dd {
    padding: 14px 0;
    border-top: 1px solid var(--border-gray);
}

/* Suppress the top border on the first row so it doesn't double-up with the
 * outer .credentials border-top. */
.credentials-grid dt:first-of-type,
.credentials-grid dt:first-of-type + dd {
    border-top: 0;
    padding-top: 0;
}

.credentials-grid dt {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    margin: 0;
}

.credentials-grid dd {
    color: var(--headings);
    font-size: 1.0625rem;
    line-height: 1.6;
    font-weight: 500;
    margin: 0;
}

/* Mobile: stack each pair vertically so the long category labels don't crush
 * the values. */
@media (max-width: 640px) {
    .credentials-grid {
        grid-template-columns: 1fr;
        column-gap: 0;
    }
    .credentials-grid dd {
        padding-top: 4px;
        padding-bottom: 18px;
        border-top: 0;
    }
    .credentials-grid dt {
        padding-bottom: 4px;
    }
    .credentials-grid dt:first-of-type + dd {
        padding-top: 4px;
    }
}

/* About */
.about {
    background: var(--off-white);
    padding: 72px 0;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

.about-col {
    grid-column: 3 / span 7;
}

.about-title {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    margin-bottom: 32px;
}

.about-col p {
    color: var(--body);
    font-size: 1.125rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

.about-quote {
    margin-top: 32px;
    padding-left: 16px;
    border-left: 3px solid var(--black);
    color: var(--headings);
    font-style: italic;
    font-size: 1.125rem;
    line-height: 1.6;
    max-width: 560px;
}

/* Section heading shared */
.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 64px;
    max-width: 720px;
}

/* Services — vertical numbered list */
.services {
    background: var(--white);
    padding: 72px 0;
}

.service-list {
    list-style: none;
    border-top: 1px solid var(--border-gray);
}

.service-row {
    display: grid;
    grid-template-columns: 64px 1fr 1.2fr;
    gap: 32px;
    align-items: baseline;
    padding: 28px 16px;
    border-bottom: 1px solid var(--border-gray);
    transition: background 0.2s ease, transform 0.2s ease;
}

.service-row:hover {
    background: var(--off-white);
    transform: translateX(8px);
}

.service-num {
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.service-name {
    font-size: 1.5rem;
    color: var(--headings);
    font-weight: 600;
    line-height: 1.3;
}

.service-desc {
    font-size: 1rem;
    color: var(--body);
    line-height: 1.6;
}

/* Tooling — inline pill list (just type) */
.tooling {
    background: var(--light-gray);
    padding: 60px 0;
}

.tool-list {
    font-size: 1.125rem;
    line-height: 2.2;
    color: var(--headings);
    max-width: 900px;
}

.tool {
    display: inline-block;
    padding: 4px 0;
    color: var(--headings);
    font-weight: 500;
}

.tool + .tool::before {
    content: "·";
    color: var(--muted);
    padding: 0 12px;
    font-weight: 400;
}

/* Recent work */
.work {
    background: var(--white);
    padding: 72px 0;
}

.work-list {
    list-style: none;
    border-top: 1px solid var(--border-gray);
}

.work-row {
    display: grid;
    grid-template-columns: 100px 1fr 1fr;
    gap: 32px;
    align-items: baseline;
    padding: 32px 16px;
    border-bottom: 1px solid var(--border-gray);
}

.work-year {
    color: var(--muted);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.work-title {
    font-size: 1.5rem;
    color: var(--headings);
    font-weight: 600;
    line-height: 1.3;
}

.work-stack {
    font-size: 0.95rem;
    color: var(--body);
}

/* Contact */
.contact {
    background: var(--headings);
    color: var(--white);
    padding: 88px 0;
}

.contact-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: var(--white);
    margin-bottom: 56px;
    line-height: 1.0;
}

.contact-mail {
    display: inline-block;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    letter-spacing: -0.02em;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
    word-break: break-word;
}

.contact-mail:hover {
    border-bottom-color: var(--white);
}

.contact-meta {
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

/* Footer */
.footer {
    background: var(--off-white);
    border-top: 1px solid var(--border-gray);
    padding: 32px 0;
}

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

.footer-left {
    color: var(--muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.footer-left strong {
    color: var(--headings);
    font-weight: 500;
}

.footer-links {
    list-style: none;
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-links a:hover {
    color: var(--headings);
    border-bottom-color: var(--headings);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    min-width: 280px;
    max-width: 360px;
    background: var(--white);
    color: var(--headings);
    padding: 14px 18px;
    border-radius: 6px;
    border: 1px solid var(--black);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    font-weight: 500;
    font-size: 0.95rem;
    z-index: 10000;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.toast.error {
    border-color: #7f1d1d;
    color: #7f1d1d;
}

/* Reveal-on-scroll */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

.reveal.in {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }

    .about-col {
        grid-column: 1 / -1;
    }

    .service-row {
        grid-template-columns: 48px 1fr;
        grid-template-areas:
            "num name"
            "num desc";
        gap: 8px 20px;
        padding: 24px 8px;
    }

    .service-num { grid-area: num; }
    .service-name { grid-area: name; }
    .service-desc { grid-area: desc; }

    .work-row {
        grid-template-columns: 80px 1fr;
        grid-template-areas:
            "year title"
            "year stack";
        gap: 4px 20px;
    }

    .work-year { grid-area: year; }
    .work-title { grid-area: title; font-size: 1.25rem; }
    .work-stack { grid-area: stack; }
}

@media (max-width: 768px) {
    .nav-logo .logo {
        /* Mobile cap — reduced 1/3 alongside desktop. 44px reads at standard
         * navbar logo size for phones. */
        height: 44px;
    }

    .nav-links {
        display: none;
    }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 72px;             /* clears the 44px logo + 14px padding ×2 */
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 1px solid var(--border-gray);
        border-bottom: 1px solid var(--border-gray);
        padding: 20px 24px;
        gap: 16px;
        align-items: flex-start;
    }

    .nav-links.active a {
        display: block;
        padding: 8px 0;
        font-size: 1rem;
    }

    .hamburger {
        display: flex;
    }

    .hero {
        /* Mobile navbar = 44px logo + 14px*2 padding ≈ 72px tall.
         * Add breathing room above the headline. */
        padding: 110px 0 56px;
    }

    .hero .container {
        padding-left: 24px;
    }

    .stats {
        padding: 40px 0;
    }

    .about,
    .services,
    .tooling,
    .work {
        padding: 56px 0;
    }

    .contact {
        padding: 60px 0;
    }

    .section-title {
        margin-bottom: 48px;
    }

    .toast {
        right: 16px;
        left: 16px;
        bottom: 16px;
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
