/* =========================================================
   Design tokens
   ========================================================= */
:root {
    /* Colour */
    --paper: #F7F7F2;
    --paper-warm: #EDEEE8;
    --white: #FFFFFF;
    --ink: #191D22;
    --muted: #60656D;
    --rule: #DADCD6;
    --cobalt: #2454E8;
    --cobalt-dark: #1E48CC;
    --cobalt-tint: #DCE5FF;
    --forest: #287546;
    --charcoal: #191D22;
    --charcoal-card: #252A32;
    --charcoal-track: #363C46;
    --on-dark-muted: #B9BEC7;
    --on-dark-accent: #B4C5FF;

    /* Type scale: seven sizes, nothing in between */
    --fs-meta: 0.75rem;    /* 12px, mono metadata only */
    --fs-small: 0.875rem;  /* 14px */
    --fs-body: 1rem;       /* 16px */
    --fs-lead: 1.125rem;   /* 18px */
    --fs-h3: 1.375rem;     /* 22px */
    --fs-h2: clamp(1.75rem, 3.4vw, 2.5rem);   /* 28 to 40px */
    --fs-h1: clamp(2.75rem, 6.4vw, 5rem);     /* 44 to 80px */

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Spacing on a 4/8 grid */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 72px;

    /* Two radii: controls and surfaces */
    --r-control: 8px;
    --r-surface: 16px;

    --gutter: clamp(20px, 5vw, 64px);

    /* Motion: transform and opacity only */
    --mint: #7EE2A8;
    --motion-fast: 150ms;
    --motion-base: 300ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

::selection { background: var(--cobalt); color: var(--white); }

:focus-visible {
    outline: 3px solid var(--cobalt);
    outline-offset: 3px;
    border-radius: 4px;
}
.band :focus-visible { outline-color: var(--on-dark-accent); }

[hidden] { display: none !important; }

.wrap {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.skip-link {
    position: absolute;
    left: var(--s-4);
    top: -100px;
    z-index: 100;
    background: var(--ink);
    color: var(--white);
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-control);
}
.skip-link:focus { top: var(--s-4); }

.mono {
    font-family: var(--font-mono);
    font-size: var(--fs-meta);
    line-height: 1.5;
}

/* Text link inside copy */
.link {
    color: var(--cobalt);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.link:hover { text-decoration-thickness: 2px; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid var(--rule);
    border-radius: var(--r-control);
    background: var(--white);
    color: var(--ink);
    font-size: var(--fs-small);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:hover { border-color: var(--cobalt); color: var(--cobalt); }
.btn:active { transform: scale(0.98); }

.btn--primary {
    background: var(--cobalt);
    border-color: var(--cobalt);
    color: var(--white);
}
.btn--primary:hover {
    background: var(--cobalt-dark);
    border-color: var(--cobalt-dark);
    color: var(--white);
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(247, 247, 242, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-1) var(--s-5);
    padding-block: var(--s-4);
}

.brand {
    font-size: var(--fs-lead);
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
}
.brand:hover { color: var(--cobalt); }

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-1) var(--s-5);
    font-size: var(--fs-small);
    font-weight: 500;
}
.site-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: none;
}
.site-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    height: 2px;
    background: var(--cobalt);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform var(--motion-fast) var(--ease-out);
}
.site-nav a:hover { color: var(--cobalt); }
@media (hover: hover) {
    .site-nav a:hover::after { transform: scaleX(1); }
}
.site-nav .nav-contact { color: var(--cobalt); }
.site-nav a[aria-current="location"] { color: var(--cobalt); }
@media (hover: hover) {
    .site-nav a[aria-current="location"]::after { transform: scaleX(1); }
}

.menu-toggle {
    display: none;
    align-items: center;
    gap: var(--s-2);
    min-height: 44px;
    padding: 0 var(--s-4);
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-control);
    font-size: var(--fs-small);
    font-weight: 500;
}
.menu-toggle:hover { border-color: var(--cobalt); color: var(--cobalt); }
.menu-toggle-icon,
.menu-toggle-icon::before {
    display: block;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}
.menu-toggle-icon { position: relative; }
.menu-toggle-icon::before {
    content: "";
    position: absolute;
    left: 0;
    top: -5px;
    box-shadow: 0 10px 0 currentColor;
}

/* =========================================================
   Sections
   ========================================================= */
.section {
    padding-block: var(--s-8);
    scroll-margin-top: 84px;
}
.section--warm { background: var(--paper-warm); }

.section-head {
    display: grid;
    gap: var(--s-3);
    margin-bottom: var(--s-6);
}

h2 {
    font-size: var(--fs-h2);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

h3 {
    font-size: var(--fs-h3);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.section-intro {
    font-size: var(--fs-lead);
    color: var(--muted);
    max-width: 62ch;
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
    padding-block: var(--s-8) var(--s-7);
    background: radial-gradient(60% 70% at 88% 8%, rgba(36, 84, 232, 0.11), rgba(36, 84, 232, 0) 70%);
}

.hero-grid {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: var(--s-7);
    align-items: start;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-5);
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--forest);
}
.status-dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--forest);
    flex: none;
}
.status-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--forest);
    opacity: 0;
}

h1 {
    font-size: var(--fs-h1);
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 1;
    margin-bottom: var(--s-5);
}

.lead {
    font-size: clamp(1.125rem, 1.6vw, 1.375rem);
    line-height: 1.5;
    color: var(--muted);
    max-width: 34em;
    margin-bottom: var(--s-6);
}
.lead strong { color: var(--ink); font-weight: 500; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
}

.hero-side {
    display: grid;
    gap: var(--s-5);
}

.me {
    display: flex;
    align-items: center;
    gap: var(--s-4);
}
.me img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 4px solid var(--white);
    box-shadow: 0 0 0 1px var(--rule), 0 6px 20px rgba(25, 29, 34, 0.1);
    flex: none;
}
.me p { font-size: var(--fs-small); color: var(--muted); line-height: 1.5; }
.me strong { display: block; font-size: var(--fs-body); font-weight: 600; color: var(--ink); }

/* LCP result card: the one animated moment on the page */
.lcp-card {
    background: var(--charcoal);
    color: var(--white);
    border-radius: var(--r-surface);
    padding: var(--s-5);
}
.lcp-card figcaption {
    font-size: var(--fs-small);
    color: var(--on-dark-muted);
    margin-bottom: var(--s-1);
}
.lcp-figure {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--s-1) var(--s-3);
    margin-bottom: var(--s-5);
}
.lcp-figure strong {
    font-size: 2.75rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.1;
}
.lcp-figure span {
    font-size: var(--fs-body);
    font-weight: 500;
    color: var(--on-dark-accent);
}
.lcp-row {
    display: grid;
    grid-template-columns: 56px 1fr 48px;
    gap: var(--s-3);
    align-items: center;
    margin-top: var(--s-3);
    font-size: var(--fs-small);
    color: var(--on-dark-muted);
}
.lcp-row .value { text-align: right; color: var(--white); }
.lcp-track {
    height: 12px;
    border-radius: 4px;
    background: var(--charcoal-track);
    overflow: hidden;
}
.lcp-bar {
    display: block;
    height: 100%;
    border-radius: 4px;
    transform-origin: left center;
}
.lcp-bar--before { width: 100%; background: var(--on-dark-muted); }
.lcp-bar--after { width: 16.4%; background: #5C82FF; }

@keyframes lcp-grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* Stats and organisations */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-6);
    margin-top: var(--s-7);
    padding-top: var(--s-6);
    border-top: 1px solid var(--rule);
}
.stats strong {
    display: block;
    font-size: var(--fs-h2);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: var(--s-1);
    font-variant-numeric: tabular-nums;
}
.stats span { font-size: var(--fs-small); color: var(--muted); }

.orgs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-3);
    margin-top: var(--s-6);
}
.orgs-label { font-size: var(--fs-small); color: var(--muted); margin-right: var(--s-2); }

.org-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px;
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-control);
    transition: border-color 0.15s ease, transform 0.15s var(--ease-out);
}
.org-logo:hover { border-color: var(--cobalt); }
@media (hover: hover) {
    .org-logo:hover { transform: translateY(-2px); }
}
.org-logo img { height: 22px; width: auto; max-width: 96px; object-fit: contain; }

/* =========================================================
   Selected work
   ========================================================= */
.projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-5);
}

.project {
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
    padding: var(--s-6);
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-surface);
    scroll-margin-top: 96px;
}
.project-category { font-size: var(--fs-small); font-weight: 500; color: var(--cobalt); margin-bottom: var(--s-2); }
.project h3 { font-size: var(--fs-h2); letter-spacing: -0.03em; line-height: 1.15; margin-bottom: var(--s-3); }
.project-summary { color: var(--muted); }
.project-meta { color: var(--muted); margin-top: var(--s-3); }

.project-result {
    background: var(--paper);
    border-radius: var(--r-control);
    padding: var(--s-4) var(--s-5);
}
.project-result strong { display: block; font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.project-result span { font-size: var(--fs-small); color: var(--muted); }

.project details { border-top: 1px solid var(--rule); padding-top: var(--s-2); }
.project summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    min-height: 44px;
    list-style: none;
    font-size: var(--fs-small);
    font-weight: 500;
    width: fit-content;
}
.project summary::-webkit-details-marker { display: none; }
.project summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform var(--motion-fast) var(--ease-out);
    flex: none;
}
.project details[open] summary::before { transform: translateY(2px) rotate(-135deg); }
.project summary:hover { color: var(--cobalt); }
.project-detail { display: grid; gap: var(--s-4); margin-top: var(--s-2); padding-bottom: var(--s-2); }
.project-detail dt { font-weight: 600; font-size: var(--fs-small); margin-bottom: 2px; }
.project-detail dd { font-size: var(--fs-small); color: var(--muted); max-width: 62ch; }

.project-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-top: auto;
    padding-top: var(--s-4);
    border-top: 1px solid var(--rule);
    color: var(--muted);
}
.project-foot a { font-family: var(--font-sans); font-size: var(--fs-small); font-weight: 500; color: var(--cobalt); }

/* The one featured card */
.project--featured {
    background: var(--cobalt);
    border-color: var(--cobalt);
    color: var(--white);
}
.project--featured .project-category,
.project--featured .project-summary,
.project--featured .project-meta,
.project--featured .project-result span,
.project--featured .project-detail dd,
.project--featured .project-foot { color: var(--cobalt-tint); }
.project--featured .project-result { background: rgba(255, 255, 255, 0.14); }
.project--featured details,
.project--featured .project-foot { border-color: rgba(255, 255, 255, 0.25); }
.project--featured summary:hover { color: var(--white); text-decoration: underline; }
.project--featured :focus-visible { outline-color: var(--white); }

/* Dark card (AI Review Agent) */
.project--dark {
    background: var(--charcoal);
    border-color: var(--charcoal);
    color: var(--white);
}
.project--dark .project-category { color: var(--on-dark-accent); }
.project--dark .project-summary,
.project--dark .project-meta,
.project--dark .project-result span,
.project--dark .project-detail dd,
.project--dark .project-foot { color: var(--on-dark-muted); }
.project--dark .project-result { background: var(--charcoal-card); }
.project--dark details,
.project--dark .project-foot { border-color: rgba(255, 255, 255, 0.16); }
.project--dark .project-foot a { color: var(--on-dark-accent); }
.project--dark summary:hover { color: var(--on-dark-accent); }
.project--dark :focus-visible { outline-color: var(--on-dark-accent); }

/* What is inside each AI tool */
.inside-label { font-size: var(--fs-small); font-weight: 600; margin-bottom: var(--s-3); }
.inside { display: grid; gap: var(--s-2); }
.inside li {
    position: relative;
    padding-left: 28px;
    font-size: var(--fs-small);
    line-height: 1.5;
}
.inside li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.35em;
    width: 11px;
    height: 6px;
    border-left: 2px solid var(--mint);
    border-bottom: 2px solid var(--mint);
    transform: rotate(-45deg);
}

/* Mock review comment */
.review-mock {
    background: var(--charcoal-card);
    border-radius: var(--r-control);
    padding: var(--s-4) var(--s-5);
}
.review-mock-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-1) var(--s-3);
    margin-bottom: var(--s-3);
    color: var(--on-dark-muted);
}
.review-mock-head strong { font-family: var(--font-sans); font-size: var(--fs-small); color: var(--white); }

/* =========================================================
   Hero pipeline: the signature animated element
   ========================================================= */
.pipeline {
    background: var(--charcoal);
    color: var(--white);
    border-radius: var(--r-surface);
    padding: var(--s-5);
    box-shadow: 0 24px 48px -24px rgba(25, 29, 34, 0.45);
}
.pipeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    min-height: 44px;
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--on-dark-muted);
}
.pipeline-replay {
    min-height: 44px;
    padding: 0 var(--s-3);
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--r-control);
    color: var(--white);
    font-size: var(--fs-small);
    font-weight: 500;
}
.pipeline-replay:hover { border-color: var(--on-dark-accent); color: var(--on-dark-accent); }
.pipeline :focus-visible { outline-color: var(--on-dark-accent); }

.pipeline-mr {
    margin-block: var(--s-2) var(--s-4);
    padding: var(--s-3) var(--s-4);
    background: var(--charcoal-card);
    border-radius: var(--r-control);
    color: var(--on-dark-accent);
    overflow-wrap: anywhere;
}

.pipeline-steps li {
    position: relative;
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: var(--s-1) var(--s-3);
    align-items: start;
    padding-bottom: var(--s-4);
}
.pipeline-steps li:last-child { padding-bottom: 0; }

/* Connector between marks */
.pipeline-steps li:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 30px;
    bottom: 2px;
    width: 2px;
    background: var(--mint);
    opacity: 0.6;
    transform-origin: center top;
}

.pipeline-mark {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.pipeline-mark svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 7px;
    border-radius: 50%;
    background: var(--mint);
    color: var(--charcoal);
}

.pipeline-steps h3 { font-size: var(--fs-lead); line-height: 28px; }
.pipeline-steps p { font-size: var(--fs-small); color: var(--on-dark-muted); line-height: 1.5; }
.pipeline-state { color: var(--mint); line-height: 28px; }

.pipeline-note { margin-top: var(--s-4); color: var(--on-dark-muted); }

@keyframes step-in { from { opacity: 0.3; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.4); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes line-down { from { transform: scaleY(0); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes ping { from { opacity: 0.6; transform: scale(1); } to { opacity: 0; transform: scale(3); } }

/* =========================================================
   Performance band (dark)
   ========================================================= */
.band {
    background: var(--charcoal);
    color: var(--white);
}
.band .section-intro { color: var(--on-dark-muted); }

.perf-grid {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: var(--s-7);
    align-items: start;
}
.band .lcp-card { background: var(--charcoal-card); }
.cases {
    display: grid;
    gap: var(--s-5);
}
.case {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: var(--s-4);
}
.case h3 { margin-bottom: var(--s-2); }
.case p { font-size: var(--fs-small); color: var(--on-dark-muted); }

/* =========================================================
   Experience
   ========================================================= */
.role {
    display: grid;
    grid-template-columns: 4fr 8fr;
    gap: var(--s-4) var(--s-7);
    padding-block: var(--s-6);
    border-top: 1px solid var(--rule);
}
.role:last-child { padding-bottom: 0; }

.role-when { font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 500; }
.role-where { font-size: var(--fs-small); color: var(--muted); margin-top: var(--s-1); }
.role-logos { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }

.role-summary { color: var(--muted); margin-top: var(--s-2); max-width: 68ch; }

.role-points {
    display: grid;
    gap: var(--s-3);
    margin-top: var(--s-4);
    max-width: 68ch;
}
.role-points li { position: relative; padding-left: var(--s-5); }
.role-points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.72em;
    width: 10px;
    height: 2px;
    background: var(--cobalt);
}
.role-points strong { font-weight: 600; }

.badge {
    display: inline-block;
    margin-top: var(--s-3);
    padding: 6px 12px;
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-control);
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--forest);
}

/* =========================================================
   Skills
   ========================================================= */
.skills { border-bottom: 1px solid var(--rule); }
.skills > div {
    display: grid;
    grid-template-columns: 4fr 8fr;
    gap: var(--s-1) var(--s-7);
    padding-block: var(--s-4);
    border-top: 1px solid var(--rule);
}
.skills dt { font-weight: 600; }
.skills dd { color: var(--muted); max-width: 68ch; }

/* =========================================================
   Contact and footer
   ========================================================= */
.contact-email {
    display: inline-block;
    font-size: clamp(1.375rem, 4.4vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--cobalt);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.contact-email:hover { text-decoration: underline; text-underline-offset: 6px; }

.contact-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-4) var(--s-5);
    margin-top: var(--s-5);
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2) var(--s-6);
    margin-top: var(--s-6);
    font-weight: 500;
}
.contact-links a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.contact-links a:hover { color: var(--cobalt); text-decoration: underline; text-underline-offset: 4px; }

.site-footer {
    border-top: 1px solid var(--rule);
    padding-block: var(--s-5);
    font-size: var(--fs-small);
    color: var(--muted);
}
.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
}

.back-top {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    min-height: 44px;
    color: var(--cobalt);
    font-weight: 500;
    text-decoration: none;
}
.back-top svg { transition: transform var(--motion-fast) var(--ease-out); }
.back-top:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (hover: hover) {
    .back-top:hover svg { transform: translateY(-2px); }
}

/* Toast */
.toast {
    position: fixed;
    right: var(--s-5);
    bottom: var(--s-5);
    z-index: 50;
    max-width: calc(100vw - 48px);
    padding: var(--s-3) var(--s-4);
    background: var(--ink);
    color: var(--white);
    border-radius: var(--r-control);
    font-size: var(--fs-small);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

/* =========================================================
   CV page
   ========================================================= */
.cv-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    padding-block: var(--s-5);
}

.cv-sheet {
    max-width: 880px;
    margin: 0 auto var(--s-8);
    padding: clamp(24px, 5vw, 56px);
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-surface);
}
.cv-sheet h1 {
    font-size: 2.25rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: var(--s-1);
}
.cv-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s-4);
    padding-bottom: var(--s-5);
    border-bottom: 1px solid var(--rule);
}
.cv-title { font-weight: 500; color: var(--muted); }
.cv-contact { font-size: var(--fs-small); line-height: 1.7; }
.cv-contact a { color: var(--cobalt); text-decoration: none; }
.cv-contact a:hover { text-decoration: underline; }

.cv-section { margin-top: var(--s-6); }
.cv-section h2 {
    font-size: var(--fs-body);
    font-weight: 600;
    letter-spacing: 0;
    color: var(--cobalt);
    padding-bottom: var(--s-2);
    margin-bottom: var(--s-3);
    border-bottom: 1px solid var(--rule);
}
.cv-section p, .cv-section li { font-size: var(--fs-small); line-height: 1.6; }
.cv-item { margin-bottom: var(--s-4); }
.cv-item:last-child { margin-bottom: 0; }
.cv-item-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--s-1) var(--s-4);
    font-size: var(--fs-small);
    font-weight: 600;
    margin-bottom: var(--s-1);
}
.cv-item-head span { font-weight: 400; color: var(--muted); }
.cv-list { list-style: disc; padding-left: 20px; color: #3A3F46; }
.cv-list li { margin-bottom: 4px; }
.cv-skills li { margin-bottom: 6px; color: #3A3F46; }
.cv-skills strong { color: var(--ink); font-weight: 600; }
.cv-stack { color: var(--muted); }

/* =========================================================
   Motion (only when the visitor has not asked for less)
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
    /* Hero copy rises in once on load */
    .hero-copy > * { animation: rise-in var(--motion-base) var(--ease-out) both; }
    .hero-copy > :nth-child(2) { animation-delay: 60ms; }
    .hero-copy > :nth-child(3) { animation-delay: 120ms; }
    .hero-copy > :nth-child(4) { animation-delay: 180ms; }

    /* Availability dot: a live status, so it pulses */
    .status-dot::after { animation: ping 2s ease-out infinite; }

    /* Pipeline: each stage completes in turn. --i is the stage index. */
    .pipeline.is-playing .pipeline-steps li {
        animation: step-in var(--motion-base) ease-out both;
        animation-delay: calc(var(--i) * 800ms + 400ms);
    }
    .pipeline.is-playing .pipeline-mark svg {
        animation: pop-in var(--motion-base) var(--ease-out) both;
        animation-delay: calc(var(--i) * 800ms + 900ms);
    }
    .pipeline.is-playing .pipeline-state {
        animation: fade-in var(--motion-base) ease-out both;
        animation-delay: calc(var(--i) * 800ms + 900ms);
    }
    .pipeline.is-playing .pipeline-steps li::before {
        animation: line-down var(--motion-base) ease-out both;
        animation-delay: calc(var(--i) * 800ms + 1000ms);
    }

    /* Scroll reveal. Only active when JavaScript is running (html.js). */
    .js [data-reveal] {
        opacity: 0;
        transform: translateY(16px);
        transition: opacity var(--motion-base) ease-out, transform var(--motion-base) var(--ease-out);
        transition-delay: calc(var(--i, 0) * 60ms);
    }
    .js [data-reveal].is-in { opacity: 1; transform: none; }

    /* LCP bars grow when the card scrolls into view */
    .js .lcp-card:not(.is-in) .lcp-bar { transform: scaleX(0); }
    .js .lcp-card.is-in .lcp-bar { animation: lcp-grow 900ms var(--ease-out) 200ms both; }
    .js .lcp-card.is-in .lcp-bar--after { animation-duration: 300ms; animation-delay: 600ms; }

    /* Expanding "What I did" */
    .project details[open] .project-detail { animation: rise-in var(--motion-base) var(--ease-out); }
}

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

/* =========================================================
   Responsive: wide is the default, then medium and narrow
   ========================================================= */
@media (max-width: 900px) {
    :root { --s-8: 56px; }

    /* Without JavaScript the nav simply wraps under the brand.
       With JavaScript it collapses behind a Menu button. */
    .site-nav { flex-basis: 100%; gap: 0 var(--s-5); }

    .js .site-header .wrap { flex-wrap: nowrap; }
    .js .menu-toggle { display: inline-flex; }
    .js .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        padding: var(--s-2) var(--gutter) var(--s-4);
        max-height: calc(100vh - 84px);
        overflow-y: auto;
        background: var(--paper);
        border-bottom: 1px solid var(--rule);
        box-shadow: 0 16px 32px -16px rgba(25, 29, 34, 0.25);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out), visibility 0s linear var(--motion-fast);
    }
    .js .site-nav.is-open {
        visibility: visible;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        transition-delay: 0s;
    }
    .js .site-nav a {
        min-height: 52px;
        font-size: var(--fs-body);
        border-top: 1px solid var(--rule);
    }
    .js .site-nav a:first-child { border-top: 0; }
    .js .site-nav a::after { display: none; }
    .js .site-nav a[aria-current="location"] { font-weight: 600; }

    .hero-grid { grid-template-columns: 1fr; gap: var(--s-6); }
    .stats { grid-template-columns: repeat(2, 1fr); gap: var(--s-5); }
    .projects { grid-template-columns: 1fr; }
    .perf-grid { grid-template-columns: 1fr; gap: var(--s-6); }
    .role, .skills > div { grid-template-columns: 1fr; }
    .role { gap: var(--s-4); }
}

@media (max-width: 560px) {
    .site-nav { gap: 0 var(--s-4); }
    .project, .pipeline { padding: var(--s-5) var(--s-4); }
    .pipeline-steps li { grid-template-columns: 28px 1fr; }
    .pipeline-state { grid-column: 2; line-height: 1.5; }
    .actions .btn, .contact-row .btn { flex: 1 1 100%; }
    .me img { width: 72px; height: 72px; }
    .toast { left: var(--s-4); right: var(--s-4); bottom: var(--s-4); max-width: none; }
}

/* =========================================================
   Print (CV page saves cleanly to A4 PDF)
   ========================================================= */
@media print {
    @page { size: A4; margin: 14mm 16mm; }

    html, body { background: #FFFFFF; color: #000000; font-size: 10pt; }
    .no-print, .site-header, .site-footer, .toast, .skip-link { display: none !important; }
    .wrap { max-width: none; padding: 0; }
    .cv-sheet { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; }
    .cv-sheet a { color: #000000; text-decoration: none; }
    .cv-section h2 { color: #000000; }
    .cv-item { break-inside: avoid; }
}
