/* Shared foundation for every page: tokens, base, accessibility, header, footer.
   Page-specific layout and components live in each page's own <style>. */

:root {
    /* Color */
    --ink: #32404F;
    --muted: rgba(50, 64, 79, 0.76);     /* body/secondary text, 4.9:1 on --bg (WCAG AA) */
    --muted-2: rgba(50, 64, 79, 0.72);   /* labels/captions, 4.6:1 on --bg (WCAG AA) */
    --faint: rgba(50, 64, 79, 0.35);     /* decorative only: numerals, dots, dashed frames */
    --line: rgba(50, 64, 79, 0.12);
    --bg: #FAFCFD;
    --surface: #FFFFFF;

    /* Type */
    --font: 'Geist', Arial, Helvetica, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-mono: 'Geist Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

    /* Layout */
    --header-h: 72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
::selection { background: rgba(50, 64, 79, 0.16); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }

/* Accessibility */
.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    background: var(--ink);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
a.card:focus-visible { border-radius: 24px; }
/* Page transitions: moving between pages of the site cross-fades and the header stays put.
   Browsers without support just switch pages. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-group(*) { animation-duration: 0.45s; animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1); }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

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

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 252, 253, 0.85);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
@media (max-width: 700px) {
    .site-header { transition: border-color 0.2s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
    .site-header.away { transform: translateY(-100%); }
}
.site-nav {
    min-height: var(--header-h);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}
.wordmark {
    font-family: var(--font-serif);
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
    justify-self: start;
    padding: 10px 0;
}
.nav-links { display: flex; align-items: center; gap: 12px; }
.nav-links a {
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    padding: 12px 10px;
    border-radius: 8px;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-links a:hover { color: var(--ink); background: rgba(50, 64, 79, 0.06); }
.nav-links a[aria-current] {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 8px;
    text-decoration-thickness: 1px;
}
.btn-pill {
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.nav-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }

/* Human | Agent view switch: two real routes, styled like a light/dark toggle */
.mode-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); letter-spacing: 0.02em; white-space: nowrap; }
.mode-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
}
.mode-switch a {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 7px;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.mode-switch a:not([aria-current]):hover { color: var(--ink); background: rgba(50, 64, 79, 0.06); }
.mode-switch a[aria-current] { background: var(--ink); color: #fff; }
.btn-pill:hover { box-shadow: 0 4px 12px rgba(50, 64, 79, 0.1); border-color: rgba(50, 64, 79, 0.25); }
.btn-pill:active { transform: translateY(1px); box-shadow: none; }
@media (max-width: 700px) {
    :root { --header-h: 96px; }
    .site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; min-height: 0; padding-top: 6px; padding-bottom: 2px; }
    .nav-actions { display: contents; }                 /* let switch and Resume join the header rows */
    .wordmark { order: 1; flex: 1 1 auto; font-size: 18px; }
    .mode-label { display: none; }
    .mode-switch { order: 2; }
    .nav-links { order: 3; flex: 1 0 100%; margin-left: -10px; gap: 4px; }
    .nav-links a { padding: 12px 10px; }
    .btn-pill { order: 4; padding: 10px 12px; }
    .mode-switch a { padding: 9px 10px; }
}

/* Footer */
.site-footer { padding-bottom: 28px; display: flex; flex-direction: column; gap: 22px; }
.footer-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    border-top: 1px solid var(--line);
    padding-top: 32px;
}
@media (min-width: 640px) { .footer-row { flex-direction: row; align-items: flex-end; } }
.footer-say { display: flex; flex-direction: column; gap: 6px; }
.footer-cta { font-family: var(--font-serif); font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); }
@media (min-width: 768px) { .footer-cta { font-size: 32px; } }
.footer-nudge { font-family: var(--font-serif); font-size: 22px; line-height: 1.3; letter-spacing: -0.015em; color: var(--ink); }
@media (min-width: 768px) { .footer-nudge { font-size: 24px; } }
.footer-mail { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.mail-link { position: relative; font-family: var(--font); font-size: 15px; color: var(--ink); text-decoration: none; }
.mail-link::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: var(--faint); transform-origin: left; transition: background 0.25s ease; }
.mail-link:hover::after { background: var(--ink); animation: mailLine 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes mailLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.mail-copy { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease; }
.mail-copy:hover { color: var(--ink); border-color: rgba(50, 64, 79, 0.25); transform: translateY(-1px); }
.mail-copy.done { color: #fff; background: var(--ink); border-color: var(--ink); }
.mail-copy:focus-visible, .mail-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .mail-link:hover::after { animation: none; } }
.social-row { display: flex; gap: 10px; list-style: none; }
.social-row a {
    width: 48px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 15px;
    text-decoration: none;
    transition: color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.social-row .ic-adplist { width: 17px; height: 17px; display: block; }
.social-row a:hover { color: var(--ink); box-shadow: 0 4px 12px rgba(50, 64, 79, 0.12); transform: translateY(-1px); }
@media (pointer: coarse) { .social-row a { height: 44px; width: 52px; } }
.footer-meta { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.copyright { font-size: 12px; color: var(--muted-2); }
.to-top {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted-2);
    text-decoration: none;
    padding: 14px 0;
}
.to-top:hover { color: var(--ink); }

/* Case-study wayfinding */
.breadcrumb { font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; color: var(--muted-2); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.breadcrumb li { display: flex; align-items: center; }
.breadcrumb li + li::before { content: '/'; margin-right: 8px; color: var(--faint); }
.page > .breadcrumb { margin-bottom: -32px; }
@media (min-width: 768px) { .page > .breadcrumb { margin-bottom: -60px; } }
.breadcrumb a { color: var(--muted-2); text-decoration: none; padding: 13px 0; display: inline-block; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.breadcrumb [aria-current] { color: var(--ink); }

.next-project {
    display: block;
    text-decoration: none;
    border-top: 1px solid var(--line);
    padding-top: 32px;
}
.next-project .np-label { font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; color: var(--muted-2); }
.next-project .np-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-top: 10px;
    font-family: var(--font-serif);
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.next-project .np-arrow { transition: transform 0.25s ease; }
.next-project:hover .np-arrow, .next-project:focus-visible .np-arrow { transform: translateX(6px); }
.next-project .np-desc { margin-top: 8px; font-size: 15px; line-height: 1.6; color: var(--muted); }

/* Reading measure: the case-study column spans the full header/footer width for figures and diagrams,
   while running text stays at a comfortable line length. */
.page .section > p,
.page .hero > p { max-width: 760px; }
