/* Tokens. Light: electric blue on white. Dark: white on deep electric blue. The theme is set on <html data-theme>
   by the inline script in index.html (saved choice, else the OS setting).
   Shapes: interactive elements are pills, images get 6px. */
:root {
    --bg: #f7f9ff;
    --ink: #06102e;
    --muted: #4e5a80;
    --name: #005cff;
    --line: rgb(6 16 46 / 0.12);
    --tint: rgb(0 92 255 / 0.07);
    --accent: #005cff;
    --dots-from: #5d8bff;
    --dots-to: #00d9ff;
    --sketch: #0033d6;
    --gutter: clamp(16px, 5vw, 96px);
    /* Same left/right edge for the hero and every section: 1400px content, centred. */
    --edge: max(var(--gutter), calc((100% - 1400px) / 2));
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #04124f;
    --ink: #eef3ff;
    --muted: rgb(238 243 255 / 0.68);
    --name: #ffffff;
    --line: rgb(238 243 255 / 0.14);
    --tint: rgb(238 243 255 / 0.06);
    --accent: #3fd0ff;
    --dots-from: #1f4dff;
    --dots-to: #00b7ff;
    --sketch: #dfe8ff;
    color-scheme: dark;
}

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

/* Starting state of the intro animations (site.js), applied from the first paint. */
@media (prefers-reduced-motion: no-preference) {
    .js .name .word > span { transform: translateY(105%); }
    .js :is(.nav, .hero-intro, .hero-skills, .hero-clients, .reveal) { opacity: 0; }
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
    background: var(--bg);
    color: var(--ink);
    font: 400 1rem/1.6 Outfit, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s, color 0.4s;
}
a { color: inherit; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* Hero: the name sits behind the WebGL canvas, the copy sits in front of it. */
.hero {
    position: relative;
    min-height: max(100dvh, 720px);
    padding: 0 var(--edge);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr auto;
    overflow: hidden;
    isolation: isolate;
    container-type: inline-size;
}
.hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}
.nav, .hero-intro, .hero-skills, .hero-clients { position: relative; z-index: 3; }

.nav {
    grid-column: 1 / -1;
    height: 72px;
    /* Equal side columns keep the links centred on the page, whatever the logo/actions widths. */
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
}
.logo { justify-self: start; }
.nav-actions { justify-self: end; }
.logo { font: 400 1.6rem/1 Anton, sans-serif; text-decoration: none; color: var(--name); }
.nav-links { display: flex; gap: 32px; }
.nav-links a, .nav-cta { text-decoration: none; font-weight: 500; }
.nav-links a { color: var(--muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-cta:hover, .theme-toggle:hover { transform: translateY(-2px); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle .ph-sun, [data-theme="dark"] .theme-toggle .ph-moon { display: none; }
[data-theme="dark"] .theme-toggle .ph-sun { display: block; }
.nav-cta:active { transform: translateY(1px) scale(0.98); }

.name {
    grid-column: 1 / -1;
    z-index: 1;
    margin-top: clamp(16px, 4vh, 56px);
    display: flex;
    justify-content: center;
    gap: 0.18em;
    font: 400 clamp(4.5rem, 16.2cqi, 17rem)/0.86 Anton, sans-serif;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--name);
}
.word { display: inline-block; flex-shrink: 0; overflow: hidden; padding: 0.02em 0; }
.word > span { display: inline-block; }

.hero-intro { grid-column: 1; align-self: center; max-width: 30ch; }
.hero-intro p { font-size: 1.2rem; font-weight: 500; line-height: 1.45; }
.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    text-transform: uppercase;
}
.hero-cta i { transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.hero-cta:hover i { transform: translateX(6px); }

.hero-skills { grid-column: 2; justify-self: end; align-self: center; display: grid; gap: 10px; font-size: 1.15rem; }
.hero-skills li { color: var(--muted); opacity: 0.55; transition: opacity 0.4s, color 0.4s; }
.hero-skills li.is-active { color: var(--ink); opacity: 1; }

.hero-clients {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 32px;
    padding: 28px 0 32px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--muted);
}

/* Sections */
main, .contact { padding: 0 var(--edge); }
section { padding: clamp(72px, 12vw, 160px) 0 0; }
.section-title {
    font: 400 clamp(3rem, 8vw, 7rem)/0.9 Anton, sans-serif;
    text-transform: uppercase;
    color: var(--name);
    margin-bottom: 48px;
}

.about { display: grid; grid-template-columns: 1fr 1.6fr; gap: 48px; }
.about-text { display: grid; gap: 24px; max-width: 62ch; }
.about-text p { color: var(--muted); font-size: 1.1rem; }
.about-text .lead { color: var(--ink); font-size: clamp(1.4rem, 2.4vw, 2.1rem); line-height: 1.3; font-weight: 500; }
.about-meta { font-size: 0.95rem !important; }

.jobs { display: grid; }
.job { padding: 32px 0; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.job h3 { font-size: clamp(1.3rem, 2vw, 1.7rem); font-weight: 600; line-height: 1.2; }
.job h3 span { color: var(--name); }
.job h3 span::before { content: "@ "; opacity: 0.6; }
.job time { color: var(--muted); font-variant-numeric: tabular-nums; }
.job > p { color: var(--muted); max-width: 70ch; }
.job .stack { font-size: 0.95rem; color: var(--ink); }
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 32px; margin-top: 8px; }
.clients li { padding: 16px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem; }
.clients b { display: block; color: var(--ink); font-weight: 600; }

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px 28px; }
.project { position: relative; display: grid; gap: 16px; align-content: start; }
.project-media {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: 6px;
    overflow: hidden;
    background: var(--tint);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.project:hover .project-media { transform: translateY(-4px); }
.project-media img, .project-media canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* The WebGL sketch replaces the plain screenshot once it is ready. */
.project-media.is-drawn img { visibility: hidden; }
.project-body { display: grid; gap: 6px; }
.project h3 { font-size: 1.3rem; font-weight: 600; line-height: 1.25; }
.project-link { text-decoration: none; }
.project-link::after { content: ""; position: absolute; inset: 0; }
.project-link:focus-visible { outline: none; }
.project:has(.project-link:focus-visible) .project-media { outline: 2px solid var(--accent); outline-offset: 4px; }
.project p { color: var(--muted); max-width: 52ch; }
.project-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.9rem; color: var(--muted); }
.project-repo { position: relative; z-index: 1; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.project-repo:hover { color: var(--name); }

.posts { display: grid; }
.post a {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 20px 12px;
    border-top: 1px solid var(--line);
    text-decoration: none;
    transition: background 0.25s;
}
.post a:hover { background: var(--tint); }
.post figure { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; background: var(--line); }
.post img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.post a:hover img { transform: scale(1.05); }
.post-fallback {
    display: grid;
    place-items: center;
    height: 100%;
    font: 400 1.4rem/1 Anton, sans-serif;
    text-transform: uppercase;
    color: var(--name);
    background: var(--tint);
}
.post-meta { font-size: 0.85rem; color: var(--muted); }
.post h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.3; margin-top: 4px; }
.post .ph { font-size: 1.4rem; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.post a:hover .ph { transform: translate(3px, -3px); }
.more {
    margin-top: 32px;
    padding: 14px 26px;
    font: 500 1rem/1 Outfit, sans-serif;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    cursor: pointer;
}
.more:active { transform: scale(0.98); }

.contact { padding-top: clamp(96px, 14vw, 200px); padding-bottom: 64px; display: grid; gap: 24px; }
.contact-kicker { color: var(--muted); font-size: 1.2rem; }
.contact { container-type: inline-size; }
/* The address is ~12.9em wide in Anton: 7.4cqi keeps it on one line at ~95% of the column. */
.contact-mail {
    font: 400 clamp(1rem, 7.4cqi, 6.5rem)/1 Anton, sans-serif;
    color: var(--name);
    text-decoration: none;
    white-space: nowrap;
}
.contact-mail:hover { text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.12em; }
.contact-links { display: flex; gap: 28px; margin-top: 16px; }
.contact-links a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; color: var(--muted); }
.contact-links a:hover { color: var(--ink); }

@media (max-width: 900px) {
    .hero-clients { display: none; }
    .hero-skills {
        grid-column: 1 / -1;
        justify-self: start;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 24px;
        font-size: 0.9rem;
    }
    .hero-skills li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; opacity: 0.8; }
    .hero-skills li.is-active { border-color: var(--name); color: var(--ink); }
    .project-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
    /* The last row holds the portrait (see layout() in hero.js): on short screens, grow the hero
       past the viewport rather than squeeze the portrait over the copy. */
    .hero { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto minmax(300px, 1fr); min-height: 100dvh; }
    .nav { grid-template-columns: 1fr auto; }
    .nav-links { display: none; }
    .name { flex-direction: column; align-items: flex-start; font-size: 25vw; line-height: 0.84; margin-top: 8px; }
    .hero-intro { align-self: start; margin-top: 20px; }
    .hero-intro p { font-size: 1.05rem; }
    .hero-cta { margin-top: 16px; }
    .about { grid-template-columns: 1fr; gap: 0; }
    .post a { grid-template-columns: 96px 1fr; gap: 16px; padding: 16px 0; }
    .post .ph { display: none; }
    .project-grid { grid-template-columns: 1fr; }
}
