/* =========================================================
   RESET & DESIGN TOKENS
   ========================================================= */
:root {
    --paper: #FAF9F5;
    --paper-dim: #F2F0E8;
    --ink: #14171F;
    --ink-soft: #5A5F6B;
    --ink-faint: #6C6F79;
    /* darkened from #8D9098 to meet 4.5:1 contrast on --paper for small mono text */
    --line: #DEDCD1;
    --accent: #E19A3C;
    --accent-ink: #7A5418;
    --teal: #2E7D6B;
    --radius: 3px;
    --maxw: 1120px;
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -.02em;
}

p {
    margin: 0
}

a {
    color: inherit
}

button,
.btn {
    font: inherit
}

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
}

.wrap {
    width: min(var(--maxw), calc(100% - 56px));
    margin: 0 auto;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: .06em;
    color: var(--teal);
}

.eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 1px;
}

/* Skip link: hidden until focused, lets keyboard users jump past the nav */
.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 14px;
    transition: top .15s ease;
}

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

/* =========================================================
   HEADER / NAV
   ========================================================= */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 249, 245, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.nav {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: baseline;
    gap: 9px;
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 17px;
}

.logo .tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-soft);
}

.navlinks {
    display: flex;
    align-items: center;
    gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.navlinks a {
    color: var(--ink-soft);
    text-decoration: none;
}

.navlinks a:hover {
    color: var(--ink)
}

.navlinks a.active:not(.btn) {
    color: var(--ink);
    font-weight: 500;
}

.mobile-toggle {
    display: none;
    border: 0;
    background: none;
    padding: 6px;
    cursor: pointer;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: .15s ease;
}

.btn:hover {
    background: var(--accent-ink);
    border-color: var(--accent-ink);
}

.btn.ghost {
    color: var(--ink);
    background: transparent;
    border-color: var(--line);
}

.btn.ghost:hover {
    background: transparent;
    border-color: var(--ink);
}

.btn.small {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 13px;
}

.btn:disabled {
    cursor: default;
    opacity: .7;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
    padding: 96px 0 84px;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.12fr .88fr;
    gap: 64px;
    align-items: center;
}

.hero h1 {
    max-width: 13ch;
    font-size: clamp(42px, 5vw, 64px);
}

.hero h1 em {
    font-style: normal;
    color: var(--accent-ink);
    background: linear-gradient(to top, rgba(225, 154, 60, .26) 0%, rgba(225, 154, 60, .26) 30%, transparent 30%);
}

.hero .sub {
    max-width: 51ch;
    margin-top: 24px;
    color: var(--ink-soft);
    font-size: 18px;
}

.hero .cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 34px;
}

.hero .microcopy {
    margin-top: 18px;
    color: var(--ink-faint);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

/* Hero cell-grid animation */
.cellstage {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
}

.cellgrid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1px;
    background: var(--paper-dim);
    transition: transform 1.1s cubic-bezier(.22, 1, .36, 1), background 1.1s ease, border-color 1.1s ease, opacity .9s ease;
}

.cell span {
    white-space: nowrap;
    color: var(--ink-faint);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
}

.cell.resolved {
    background: #fff
}

.cell.resolved.hit {
    background: rgba(225, 154, 60, .22);
    border-color: var(--accent);
}

.cell.scatter {
    transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 0deg));
    opacity: .52;
}

/* =========================================================
   VALUE STRIP
   ========================================================= */
.value-strip {
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.value-strip .wrap {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.value-item {
    padding: 17px 20px;
    border-left: 1px solid var(--line);
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    color: var(--ink-soft);
}

.value-item:last-child {
    border-right: 1px solid var(--line)
}

/* =========================================================
   GENERIC SECTION LAYOUT
   ========================================================= */
section.content {
    padding: 86px 0
}

.band {
    background: var(--paper-dim);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.section-head {
    max-width: 700px;
    margin-bottom: 48px;
}

.section-head h2 {
    font-size: clamp(30px, 3vw, 38px)
}

.section-head p {
    margin-top: 14px;
    color: var(--ink-soft);
}

/* =========================================================
   PROBLEMS SHEET
   ========================================================= */
.sheet {
    border: 1px solid var(--line);
    background: #fff;
}

.sheet-head,
.sheet-row {
    display: grid;
    grid-template-columns: 64px 1fr 44px;
}

.sheet-head {
    border-bottom: 1px solid var(--line);
    background: var(--paper-dim);
    color: var(--ink-faint);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
}

.sheet-head div {
    padding: 10px 16px
}

.sheet-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    transition: background .15s ease;
}

.sheet-row:last-child {
    border-bottom: 0
}

.sheet-row:hover {
    background: rgba(225, 154, 60, .08)
}

.sheet-row .ref {
    align-self: stretch;
    display: flex;
    align-items: center;
    padding: 18px 16px;
    border-right: 1px solid var(--line);
    color: var(--ink-faint);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

.sheet-row .txt {
    padding: 18px 16px
}

.sheet-row .arrow {
    padding: 18px 16px;
    color: var(--ink-faint);
    text-align: center;
}

/* =========================================================
   SERVICES
   ========================================================= */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
}

.service {
    padding: 32px 30px;
    background: #fff;
}

.service .num {
    display: block;
    margin-bottom: 14px;
    color: var(--teal);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

.service h3 {
    margin-bottom: 14px;
    font-size: 20px;
}

.service ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.service li {
    position: relative;
    padding: 8px 0 8px 16px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 14.5px;
}

.service li:first-child {
    border-top: 0
}

.service li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18px;
    width: 6px;
    height: 1px;
    background: var(--ink-faint);
}

/* =========================================================
   PROCESS
   ========================================================= */
.process-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.step {
    min-height: 210px;
    padding: 24px;
    border: 1px solid var(--line);
    background: #fff;
}

.step .num {
    display: block;
    margin-bottom: 28px;
    color: var(--accent-ink);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
}

.step h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.step p {
    color: var(--ink-soft);
    font-size: 14.5px;
}

/* =========================================================
   INDUSTRIES / FIT
   ========================================================= */
.fit-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.fit {
    padding: 26px;
    border: 1px solid var(--line);
    background: #fff;
}

.fit h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.fit p {
    color: var(--ink-soft);
    font-size: 14.5px;
}

/* =========================================================
   PROJECTS / CASES
   ========================================================= */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.case {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 26px 24px;
    border: 1px solid var(--line);
    background: #fff;
}

.case .tag {
    align-self: flex-start;
    padding: 4px 8px;
    border-radius: 1px;
    background: rgba(225, 154, 60, .18);
    color: var(--accent-ink);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10.5px;
    letter-spacing: .05em;
}

.case h3 {
    font-size: 18px
}

.case p {
    color: var(--ink-soft);
    font-size: 14.5px;
}

.case .flow {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--ink-faint);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
}

/* =========================================================
   ABOUT
   ========================================================= */
.about-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 52px;
    align-items: start;
}

.avatar {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    border: 1px solid var(--line);
    background: var(--paper-dim);
    object-fit: cover;
}

.about-body p {
    margin-bottom: 16px;
    color: var(--ink-soft);
}

.about-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

/* =========================================================
   CONTACT
   ========================================================= */
.contact-band {
    padding: 82px 0;
    background: var(--ink);
    color: var(--paper);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 56px;
    align-items: center;
}

.contact-grid h2 {
    color: var(--paper);
    font-size: clamp(30px, 3vw, 38px);
}

.contact-grid p {
    max-width: 48ch;
    margin-top: 14px;
    color: #B9BCC4;
}

.contact-card {
    padding: 28px;
    border: 1px solid #2C3042;
    background: #1D2130;
}

.contact-card .field {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #2C3042;
}

.contact-card label {
    display: block;
    margin-bottom: 7px;
    color: #8B8FA0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
}

.contact-card .value-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-card .value {
    display: block;
    color: var(--accent);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.contact-card .value:hover {
    text-decoration: underline;
}

.copy-btn {
    flex-shrink: 0;
    border: 1px solid #2C3042;
    background: transparent;
    color: #B9BCC4;
    border-radius: var(--radius);
    padding: 5px 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: .15s ease;
}

.copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.copy-btn[data-copied="true"] {
    border-color: var(--teal);
    color: #6FCBB2;
}

.contact-card .btn {
    width: 100%;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ink);
}

.contact-card .btn:hover {
    background: #efad58;
    border-color: #efad58;
}

footer {
    padding: 28px 0;
    background: var(--ink);
    border-top: 1px solid #2C3042;
    color: #8B8FA0;
    font-size: 13px;
}

footer .wrap {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

footer a {
    color: #B9BCC4;
    text-decoration: none;
}

/* =========================================================
   BACK TO TOP
   ========================================================= */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease, background .15s ease;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--accent-ink);
}

/* =========================================================
   SCROLL REVEAL
   ========================================================= */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s ease, transform .6s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================
   RESPONSIVE: <= 900px
   ========================================================= */
@media (max-width:900px) {

    .hero-grid,
    .contact-grid {
        grid-template-columns: 1fr
    }

    .hero {
        padding: 62px 0 66px
    }

    .hero .cellstage {
        order: -1;
        max-width: 340px;
        margin: 0 auto;
    }

    .value-strip .wrap {
        grid-template-columns: repeat(2, 1fr)
    }

    .value-item:nth-child(2) {
        border-right: 1px solid var(--line)
    }

    .value-item:nth-child(n+3) {
        border-top: 1px solid var(--line)
    }

    .services-grid {
        grid-template-columns: 1fr
    }

    .process-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .fit-grid,
    .cases-grid {
        grid-template-columns: 1fr
    }

    .about-grid {
        grid-template-columns: 1fr
    }

    .avatar {
        width: 150px
    }

    .navlinks {
        position: fixed;
        top: 68px;
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 28px 18px;
        background: var(--paper);
        border-bottom: 1px solid var(--line);
    }

    .navlinks.open {
        display: flex
    }

    .navlinks li {
        border-top: 1px solid var(--line)
    }

    .navlinks li:first-child {
        border-top: 0
    }

    .navlinks a {
        display: block;
        padding: 14px 0
    }

    .mobile-toggle {
        display: block
    }
}

/* =========================================================
   RESPONSIVE: <= 580px
   ========================================================= */
@media (max-width:580px) {
    .wrap {
        width: min(var(--maxw), calc(100% - 32px))
    }

    .logo .tag {
        display: none
    }

    .hero h1 {
        font-size: 39px
    }

    section.content {
        padding: 64px 0
    }

    .value-strip .wrap {
        grid-template-columns: 1fr
    }

    .value-item {
        border-right: 1px solid var(--line);
        border-top: 1px solid var(--line);
    }

    .value-item:first-child {
        border-top: 0
    }

    .process-grid {
        grid-template-columns: 1fr
    }

    .sheet-head,
    .sheet-row {
        grid-template-columns: 54px 1fr 34px
    }

    .sheet-row .ref,
    .sheet-row .txt,
    .sheet-row .arrow {
        padding: 16px 12px
    }

    footer .wrap {
        flex-direction: column
    }

    .back-to-top {
        right: 16px;
        bottom: 16px;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion:reduce) {
    html {
        scroll-behavior: auto
    }

    .cell {
        transition: none
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .back-to-top {
        transition: none;
    }
}
