/* Archivo variable font — self-hosted, preloaded in index.html */
@font-face {
    font-family: 'Archivo';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/Archivo.woff2') format('woff2');
}

/* ---------- Custom properties ---------- */
:root {
    --bg: #f9f7f4;
    --text: #1a1814;
    --muted: #6e675f;
    --border: #e6e0d6;
    --gap: 4.5rem;
    --radius: 6px;
    --accent: #4a7fa5;
    /* Shared focus ring, used by the global :focus-visible rule and every
       component that needs a themed override (skewed buttons, clipped FABs). */
    --focus-color: var(--accent);
    --focus-width: 2px;
    --focus-offset: 3px;
    --skewX: skewX(-6deg);
    --skewX-counter: skewX(6deg);
    --skewX-dot: skewX(-20deg);
    /* Parallelogram clip for solid shapes (toggles, badge, cookie bar). Each
       consumer can override the corner offset via --clip-x. */
    --clip-para: polygon(
        var(--clip-x, 0.5rem) 0,
        100% 0,
        calc(100% - var(--clip-x, 0.5rem)) 100%,
        0 100%
    );

    /* Derived from --accent via relative color syntax */
    --accent-faded: oklch(from var(--accent) l c h / 0.3);
    --accent-subtle: oklch(from var(--accent) l c h / 0.12);
    --accent-shadow: oklch(from var(--accent) calc(l * 0.45) c h / 0.7);
    --tag-bg: oklch(from var(--accent) 93% calc(c * 0.25) h);
    --tag-text: oklch(from var(--accent) 28% calc(c * 0.7) h);

    @media (prefers-color-scheme: dark) {
        --bg: #111009;
        --text: #f5f3ef;
        --muted: #9e9890;
        --border: #2a2720;
        --accent-faded: oklch(from var(--accent) l c h / 0.55);
        --accent-subtle: oklch(from var(--accent) l c h / 0.2);
        --tag-bg: oklch(from var(--accent) 14% calc(c * 0.4) h);
        --tag-text: oklch(from var(--accent) 72% c h);
    }

    &[data-theme='light'] {
        --bg: #f9f7f4;
        --text: #1a1814;
        --muted: #6e675f;
        --border: #e6e0d6;
        --accent-faded: oklch(from var(--accent) l c h / 0.3);
        --accent-subtle: oklch(from var(--accent) l c h / 0.12);
        --tag-bg: oklch(from var(--accent) 93% calc(c * 0.25) h);
        --tag-text: oklch(from var(--accent) 28% calc(c * 0.7) h);
    }

    &[data-theme='dark'] {
        --bg: #111009;
        --text: #f5f3ef;
        --muted: #9e9890;
        --border: #2a2720;
        --accent-faded: oklch(from var(--accent) l c h / 0.55);
        --accent-subtle: oklch(from var(--accent) l c h / 0.2);
        --tag-bg: oklch(from var(--accent) 14% calc(c * 0.4) h);
        --tag-text: oklch(from var(--accent) 72% c h);
    }
}

::selection {
    background: var(--accent-subtle);
    color: var(--text);
}

@keyframes nudge {
    0% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(calc(var(--nudge-deg, 4deg) * -1));
    }
    45% {
        transform: rotate(var(--nudge-deg, 4deg));
    }
    65% {
        transform: rotate(calc(var(--nudge-deg, 4deg) * -0.5));
    }
    82% {
        transform: rotate(calc(var(--nudge-deg, 4deg) * 0.25));
    }
    100% {
        transform: rotate(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fa-btn .icon {
        transform: none !important;
        animation: none !important;
    }
}

@keyframes subtitle-shimmer {
    from {
        background-position: center 0%;
    }
    to {
        background-position: center 100%;
    }
}

@keyframes hero-shimmer {
    0% {
        background-position: 100% center;
    }
    100% {
        background-position: -100% center;
    }
}

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

ul {
    list-style: none;
}

img {
    display: block;
    max-width: 100%;
}

/* ---------- Base ---------- */
html {
    font-family:
        'Archivo',
        system-ui,
        -apple-system,
        sans-serif;
    font-size: 18px;
    line-height: 1.65;
    color: var(--text);
    /* Slight vertical accent wash over the page (fixed to the viewport). */
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--accent) 9%, var(--bg)) 0%,
        var(--bg) 55%
    );
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
}

/* Shared inner column for sections. */
.section,
.about,
.skills,
.projects,
.connect,
.hero {
    width: 100%;
    max-width: 76rem;
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 5vw, 3rem);
    padding-block: clamp(3.5rem, 9vw, 7rem);
}

a {
    color: inherit;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
    transition: color 0.15s;

    &:not(.btn):hover {
        color: var(--accent);
        opacity: 1;
    }
}

/* ---------- Global focus ---------- */
/* Every focusable element gets the same themed accent ring by default.
   Components with non-rectangular shapes (skewed .btn, clipped .fa-btn)
   override this below so the ring tracks their actual silhouette. */
:focus-visible {
    outline: var(--focus-width) solid var(--focus-color);
    outline-offset: var(--focus-offset);
}

/* ---------- Floating controls group (bottom-left) ---------- */
.fab-group {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------- Floating control toggles ---------- */
/* Shared parallelogram FAB; .accent-toggle / .theme-toggle add only colors. */
.fa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    --clip-x: 0.4rem;
    clip-path: var(--clip-para);
    border: none;
    cursor: pointer;
    z-index: 100;
    transition:
        background 0.15s,
        color 0.15s,
        box-shadow 0.15s;

    /* clip-path clips a normal outline, so trace the parallelogram with stacked
       drop-shadows that follow the clipped silhouette. */
    &:focus-visible {
        outline: none;
        filter: drop-shadow(var(--focus-width) 0 0 var(--focus-color))
            drop-shadow(calc(var(--focus-width) * -1) 0 0 var(--focus-color))
            drop-shadow(0 var(--focus-width) 0 var(--focus-color))
            drop-shadow(0 calc(var(--focus-width) * -1) 0 var(--focus-color));
    }

    .icon {
        width: 1.1rem;
        height: 1.1rem;
    }
}

.accent-toggle {
    background: var(--accent);
    color: #fff;

    /* Keep the accent background; just invert the icon to the bg color. */
    &:hover {
        color: var(--bg);
    }

    /* Triple-click slot-machine spin (see client.ts). */
    &.spinning {
        animation: accent-spin-pulse 0.28s ease-in-out infinite;
    }
}
@keyframes accent-spin-pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.14);
    }
}
@media (prefers-reduced-motion: reduce) {
    .accent-toggle.spinning {
        animation: none;
    }
}

.theme-toggle {
    background: var(--text);
    color: var(--bg);
    box-shadow: inset 0 0 0 1px var(--bg);

    &:hover {
        background: var(--muted);
        box-shadow: inset 0 0 0 2px var(--bg);
    }

    /* Default: light mode shows moon, dark mode shows sun */
    .icon-sun {
        display: none;

        @media (prefers-color-scheme: dark) {
            display: block;
        }
        [data-theme='dark'] & {
            display: block;
        }
        [data-theme='light'] & {
            display: none;
        }
    }

    .icon-moon {
        display: block;

        @media (prefers-color-scheme: dark) {
            display: none;
        }
        [data-theme='dark'] & {
            display: none;
        }
        [data-theme='light'] & {
            display: block;
        }
    }
}

/* ---------- Theme switch (View Transitions wipe) ---------- */
/* Replace the default cross-fade with a directional clip-path wipe so the new
   theme sweeps across the screen. JS sets [data-theme-switch] to the target
   theme to pick the direction; old snapshot sits still, new one is revealed. */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 0;
}

::view-transition-new(root) {
    z-index: 1;
    /* Default → switching to light: wipe in left → right. */
    animation: theme-wipe 0.45s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

/* Switching to dark: wipe in right → left. */
[data-theme-switch='dark']::view-transition-new(root) {
    animation-name: theme-wipe-rtl;
}

@keyframes theme-wipe {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes theme-wipe-rtl {
    from {
        clip-path: inset(0 0 0 100%);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }
}

/* Bare icon button: an unstyled control that shows only its icon. */
.icon-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--muted);
    line-height: 0;
    transition: color 0.15s;
}
.icon-btn:hover {
    color: var(--text);
}
.icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius);
    color: var(--text);
}

/* Parallelogram skew helpers: skew a container, counter-skew its contents back
   upright. Pairs with the --skewX / --skewX-counter tokens. */
.u-skew {
    transform: var(--skewX);
}
.u-unskew {
    transform: var(--skewX-counter);
}

/* ---------- header ---------- */
header {
    position: fixed;
    top: -4rem;
    left: 0;
    right: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 4rem;
    padding-inline: clamp(1.25rem, 5vw, 3rem);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: top 0.3s ease;

    /* JS reveals the header (drops it to top:0) once the hero scrolls out. */
    &.is-pinned {
        top: 0;
    }

    .nav-brand {
        display: flex;
        flex-direction: column;
        line-height: 1.1;
        text-decoration: none;
    }
    .nav-brand-name {
        font-size: 0.95rem;
        font-weight: 800;
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }
    .nav-brand-role {
        font-size: 0.9rem;
        font-weight: 500;
        letter-spacing: 0.18em;
        text-transform: uppercase;
        color: var(--muted);
    }
}
@media (prefers-reduced-motion: reduce) {
    header {
        transition: none;
    }
}

/* ---------- Section heads (eyebrow + title) ---------- */
.section-head {
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}
/* Small uppercase caption labels share size/weight/transform; each rule below
   keeps only its own letter-spacing, color, and spacing. */
.eyebrow,
.exp-label,
.about-label,
.project-cat,
.quote-band-cite {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
}
.eyebrow {
    display: block;
    letter-spacing: 0.22em;
    color: var(--muted);
    margin-bottom: 0.6rem;
}
.section-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.02;
}
.section-lead {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--muted);
    line-height: 1.6;
}

/* ---------- Featured quote band (full-bleed) ---------- */
.quote-band {
    width: 100%;
    margin-block: clamp(2rem, 6vw, 5rem);
    padding-block: clamp(4rem, 11vw, 8rem);
    padding-inline: clamp(1.25rem, 5vw, 3rem);
    border-block: 1px solid var(--border);
    background: var(--accent-subtle);
}
.quote-band-inner {
    max-width: 60rem;
    margin-inline: auto;
    text-align: center;
}
.quote-band-text {
    margin: 0;
    font-size: clamp(1.75rem, 5.5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.08;
    color: var(--text);
    text-wrap: balance;
}
/* The sentence-ending periods rendered as the site's accent parallelogram. */
.quote-band-dot {
    display: inline-block;
    width: 0.15em;
    height: 0.15em;
    margin-left: 0.02em;
    background: var(--accent);
    transform: var(--skewX);
}
.quote-band-cite {
    display: block;
    margin-top: clamp(1.25rem, 3vw, 2rem);
    font-style: normal;
    letter-spacing: 0.22em;
    color: var(--muted);
}

/* ---------- Hero ---------- */
.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100svh;
}
.hero-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--accent-subtle);
    padding: 0.4rem 1rem;
    margin-bottom: 1.5rem;
    clip-path: var(--clip-para);
}
.hero-badge-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse-dot 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .hero-badge-dot {
        animation: none;
    }
}
.hero-name {
    font-size: clamp(3rem, 11vw, 7rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.88;
    margin-bottom: 1rem;
    color: var(--text);
}
/* The period after "S" rendered as the site's accent parallelogram. */
.hero-name-dot {
    display: inline-block;
    width: 0.13em;
    height: 0.13em;
    margin-left: 0.02em;
    background: var(--accent-faded);
    transform: var(--skewX-dot);
}
/* Adina-style hero: badge on top, then a wide content column + a vertical
   social rail; role + tagline sit side-by-side under the name. */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: clamp(2rem, 6vw, 5rem);
    align-items: center;
}
.hero-role-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 3rem);
    margin-bottom: 2.25rem;
}
.hero-role {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    font-size: clamp(0.9rem, 1.6vw, 1rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    white-space: nowrap;
}
.hero-role-titles {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
}
.hero-rule {
    display: inline-block;
    width: 3rem;
    height: 1px;
    background: var(--accent);
}
.hero-tagline {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.5;
    color: var(--muted);
    max-width: 30rem;
    border-left: 1px solid var(--border);
    padding-left: 1.25rem;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.hero-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    padding-left: clamp(1.5rem, 4vw, 3rem);
    border-left: 1px solid var(--border);
}
.hero-rail a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    --para-bg: var(--accent-subtle);
    color: var(--muted);
    transition: color 0.15s;
}
.hero-rail a:hover {
    color: #fff;
    --para-bg: var(--accent);
}
.hero-rail .icon {
    width: 1.1rem;
    height: 1.1rem;
}
@media (max-width: 720px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    .hero-role-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
    /* Stack the two roles onto separate lines on small screens. */
    .hero-role-titles {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
    .hero-role-sep {
        display: none;
    }
    .hero-role {
        align-items: flex-start;
        white-space: normal;
    }
    /* Center the rule on the first line rather than the whole stacked block. */
    .hero-rule {
        align-self: flex-start;
        margin-top: 0.75em;
    }
    .hero-rail {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.9rem;
        margin-top: 2.5rem;
        padding-left: 0;
        padding-top: 1.5rem;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}
/* Parallelogram photo (clip-path keeps the image undistorted). */
.hero-photo {
    justify-self: center;
    width: 100%;
    max-width: 22rem;
}
.hero-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
@media (max-width: 820px) {
    .hero {
        min-height: auto;
        padding-top: 6rem;
    }
}
@keyframes pulse-dot {
    0%,
    100% {
        box-shadow: 0 0 0 0 var(--accent-faded);
    }
    50% {
        box-shadow: 0 0 0 6px transparent;
    }
}

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: clamp(1.5rem, 5vw, 3.5rem);
    align-items: start;
}
.about-photo {
    justify-self: end;
    position: sticky;
    top: 6rem;
}
.about-statement {
    font-size: clamp(1.25rem, 3vw, 1.9rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 1.25rem;
}
.about-body {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--muted);
}
.about-card {
    margin-top: 2.5rem;
}
.about-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.65rem;
    border-bottom: 1px solid var(--border);
}
.about-label {
    letter-spacing: 0.14em;
    color: var(--accent);
}
.about-value {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: right;
    color: var(--accent);
}
@media (max-width: 720px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
    /* Drop the portrait on small screens — the text stands on its own. */
    .about-photo {
        display: none;
    }
}

/* ---------- Skills ---------- */
.skills-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Shared parallelogram fill: a skewed ::before carries the background so the
   element's own text/icons stay upright. The -6deg slant matches the send
   button and the accent dots. Consumers set --para-bg; default is subtle. */
.btn,
.tag,
.hero-rail a {
    position: relative;
    isolation: isolate;
    border-radius: 0;
    background: transparent;
}
.btn::before,
.tag::before,
.hero-rail a::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--para-bg, var(--accent-subtle));
    transform: var(--skewX);
    transition: background 0.15s;
}

/* Themed focus ring: the visible shape is the skewed ::before, so the outline
   lives there too and slants with the parallelogram. The accent-shadow glow
   echoes the hover accent and stays visible against either fill. */
@keyframes btn-focus-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}
.btn:focus-visible,
.hero-rail a:focus-visible {
    outline: none;
    animation: btn-focus-pulse 5s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .btn:focus-visible,
    .hero-rail a:focus-visible {
        animation: none;
    }
}
.btn:focus-visible::before,
.hero-rail a:focus-visible::before {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px var(--accent-subtle);
}

/* Button system: .btn base + style variant (.btn-primary) + size variant
   (.btn-sm). The cookie consent buttons reuse .btn .btn-primary .btn-sm. */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    --para-bg: var(--accent-subtle);
    color: var(--text);
    border: none;
    transition: color 0.15s;

    &:hover {
        --para-bg: var(--accent);
        color: #fff;
    }

    .icon {
        width: 1.2em;
        height: 1.2em;
    }
}

.btn-primary {
    --para-bg: var(--accent);
    color: #fff;

    &:hover {
        opacity: 0.85;
        color: #fff;
    }
}

.btn-sm {
    padding: 0.25rem 0.85rem;
}

/* skill-chip reuses .btn; only the font size and (non-clickable) cursor differ.
   Declared after .btn so its size wins at equal specificity. */
.skill-chip {
    font-size: 0.95rem;
    cursor: default;
}

/* ---------- Experience ---------- */
/* Wrappers are transparent by default so the section reads as a normal
   vertical list. JS adds .exp-pinned to switch on the horizontal
   scrollytelling (pinned section, cards slide left as the page scrolls). */
.exp-sticky,
.exp-track {
    display: contents;
}

.exp-timeline {
    display: none;
}

.exp-item {
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--border);

    &:first-child {
        padding-top: 0;
    }

    &:last-child {
        border-bottom: none;
    }
}

.exp-meta {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 0.9rem;
}
.exp-meta-col {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.exp-label {
    letter-spacing: 0.16em;
    color: var(--muted);
}
.exp-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted-dark);
}

/* Title is now the prominent line; company is the secondary accent line below. */
.exp-role {
    font-size: 1.05rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.exp-company {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.9rem;
}

.exp-bullets {
    margin-bottom: 1rem;
}
.exp-bullets li {
    font-size: 1.05rem;
    color: var(--muted);
    line-height: 1.4;
    padding-left: 1.1rem;
    position: relative;
    margin-bottom: 0.6rem;

    &:hover {
        color: var(--text);
    }
}

.exp-bullets li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.exp-tools {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

/* Non-pinned fallback (reduced motion / no overflow): normal contained column. */
#experience:not(.exp-pinned) {
    max-width: 76rem;
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 5vw, 3rem);
    padding-block: clamp(3.5rem, 9vw, 7rem);
}

/* ---------- Experience: pinned horizontal scrollytelling ---------- */
/* JS sets the section height (scroll runway) and drives --exp-x. The section
   breaks out to full-bleed width so the card track spans the viewport. */
#experience.exp-pinned {
    --exp-card: min(92vw, 36rem);
    --exp-gap: clamp(2rem, 6vw, 5rem);
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
}

.exp-pinned .exp-sticky {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.exp-pinned > .exp-sticky > .section-head {
    text-align: center;
    padding-inline: clamp(1.25rem, 6vw, 5rem);
    margin-bottom: 1.5rem;
}

.exp-pinned .exp-track {
    display: flex;
    align-items: flex-start;
    width: max-content;
    gap: var(--exp-gap);
    /* Side padding centers the first card at the start and the last at the end. */
    padding-inline: calc((100vw - var(--exp-card)) / 2);
    will-change: transform;
    transform: translate3d(var(--exp-x, 0px), 0, 0);
}

.exp-pinned .exp-item {
    flex: 0 0 auto;
    width: var(--exp-card);
    padding: clamp(1.5rem, 3vw, 2.25rem);
    border: none;
    border-radius: var(--radius);
    background: var(--accent-subtle);
    /* Parallelogram: skew the card, counter-skew its contents upright. */
    transform: var(--skewX);
}
.exp-pinned .exp-item > * {
    transform: var(--skewX-counter);
}

/* Timeline: mirrors the card track geometry (same width, gap, padding, and
   --exp-x offset) so every dot stays centered under its experience card. */
.exp-pinned .exp-timeline {
    display: flex;
    align-items: flex-start;
    width: max-content;
    gap: var(--exp-gap);
    padding-inline: calc((100vw - var(--exp-card)) / 2);
    margin-top: 2rem;
    position: relative;
    will-change: transform;
    transform: translate3d(var(--exp-x, 0px), 0, 0);
}

/* Connecting line runs through the dot marks, from the first dot's center to
   the last. Each card-width slot centers its dot at 50vw from its own edge, so
   the line insets 50vw on both sides; top aligns with the 12px mark's center. */
.exp-pinned .exp-timeline::before {
    content: '';
    position: absolute;
    inset-inline: 50vw;
    top: 6px;
    height: 2px;
    background: var(--muted);
}

.exp-pinned .exp-dot {
    position: relative;
    flex: 0 0 auto;
    width: var(--exp-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.exp-dot-mark {
    width: 12px;
    height: 12px;
    border: 2px solid var(--muted);
    background: var(--bg);
    /* Parallelogram marker matching the site's -6deg motif. */
    transform: var(--skewX);
    transition:
        transform 0.8s,
        background 0.2s,
        border-color 0.2s;
}

.exp-dot-year {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--muted);
    transition:
        color 0.2s,
        transform 0.2s;
}

.exp-dot:hover .exp-dot-mark {
    border-color: var(--accent);
}

.exp-dot.is-active .exp-dot-mark {
    background: var(--accent);
    border-color: var(--accent);
    transform: var(--skewX) scale(1.8);
}

.exp-dot.is-active .exp-dot-year {
    color: var(--accent);
    font-weight: 700;
    transform: scale(1.1);
}

/* ---------- Tags ---------- */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tag {
    display: inline-block;
    padding: 0.1875rem 0.625rem;
    --para-bg: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ---------- Projects ---------- */
.proj-grid {
    display: grid;
    /* min(100%, 18rem) lets a column shrink below 18rem on narrow screens
       instead of forcing a hard 324px floor that overflowed under ~390px. */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: 1.5rem;
    padding: 0 2rem;
}
.project-item {
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--accent-subtle);
    /* .u-skew parallelogram; thumb mark + body counter-skew (see markup). */
    transition: transform 0.15s;
}
.project-item:hover {
    transform: var(--skewX) translateY(-4px);
}
.project-item[hidden] {
    display: none;
}
/* Card is skewed; thumb mark + body counter-skew their contents upright. */
.project-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 8;
    text-decoration: none;
    background: oklch(from var(--accent) 0.55 0.14 calc(h + var(--shift, 0)));
    overflow: hidden;
}
.project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* No counter-skew: the image inherits the card's .u-skew (-6deg) so it
       skews along with the parallelogram and fills the container edge to edge. */
}
.project-thumb-mark {
    font-size: 3.5rem;
    font-weight: 900;
    color: #fff;
    opacity: 0.92;
    letter-spacing: -0.02em;
}
.project-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
}
.project-cat {
    letter-spacing: 0.16em;
    color: var(--accent);
}
.project-title {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1.15rem;
    font-weight: 800;
    text-decoration: none;
}
.project-title .icon {
    width: 0.85rem;
    height: 0.85rem;
}
.project-desc {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.6;
}
.project-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 0.5rem;
}
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}
/* Source-link icons (GitHub / npm) ride a bit larger than the text. */
.source-link .icon {
    width: 1.25em;
    height: 1.25em;
}

.source-link:hover {
    color: var(--accent);
}

/* Drop the parallelogram skew on project cards at mobile widths; the thumb
   image rides the card transform, so clearing it leaves everything upright. */
@media (max-width: 720px) {
    .project-item.u-skew {
        transform: none;
    }
    .project-item:hover {
        transform: translateY(-4px);
    }
    .project-body.u-unskew,
    .project-thumb-mark.u-unskew {
        transform: none;
    }
    /* The section already supplies side padding; the extra 2rem here only
       squeezed the cards on small screens. */
    .proj-grid {
        padding-inline: 0;
    }
}

.icon {
    display: inline-block;
    width: 0.875em;
    height: 0.875em;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ---------- Connect ---------- */
.connect-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.75rem, 2.5vw, 1.75rem);
    align-items: stretch;
}
.connect-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
/* Angled buttons matching the contact form: accent border, no fill, skewed;
   contents are counter-skewed upright. The buttons grow to fill the column so
   their stack lines up with the contact form's height. */
.connect-item {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: none;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    transition: background 0.15s;
}
/* Light up with a diagonal accent sweep, matching the angled form block. */
.connect-item:hover {
    background: var(--accent);
}
.connect-item:hover .connect-label {
    color: #fff;
}
/* The whole card is the visual button, so show focus on the card (not the
   inner control, which would draw a cramped rectangle inside the border).
   Echo the hover fill so a focused card reads as clearly active. */
.connect-item:has(:focus-visible) {
    outline: var(--focus-width) solid var(--focus-color);
    outline-offset: var(--focus-offset);
    background: var(--accent);
}
.connect-item:has(:focus-visible) .connect-label {
    color: #fff;
}
.connect-item a:focus-visible,
.connect-item button:focus-visible {
    outline: none;
}
.connect-label {
    transition: color 0.15s;
}
.connect-item > * {
    transform: var(--skewX-counter);
}
.connect-num {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
}
.connect-item a,
.connect-item button {
    display: flex;
    flex: 1;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    text-decoration: none;
    font: inherit;
    text-align: left;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
}
.connect-label {
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.01em;
}
/* Right-aligned hint on each card: "Take the quiz" / social handle. Muted until
   the card lights up on hover/focus, then matches the white label. */
.connect-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.15s;
}
.connect-action .icon {
    width: 0.95em;
    height: 0.95em;
}
.connect-item:hover .connect-action,
.connect-item:has(:focus-visible) .connect-action {
    color: #fff;
}
.connect-meta {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--muted);
}
.connect-meta a {
    color: var(--accent);
    text-decoration: none;
}
@media (max-width: 720px) {
    /* minmax(0, …) stops a card's nowrap hint from stretching the track wider
       than the viewport; stacking the label above the hint then lets long
       handles like "/in/iambriansreed" fit a narrow column. */
    .connect-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .connect-item a,
    .connect-item button {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 0.3rem;
    }
}

/* ---------- Recruiter quiz modal ---------- */
.quiz-modal {
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 0;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    overflow: auto;

    &[open] {
        display: block;
    }
}

.quiz-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.quiz-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.quiz-close {
    padding: 0.25rem;

    .icon {
        width: 1.25rem;
        height: 1.25rem;
    }
}
.quiz-intro {
    padding: 1.25rem 1.5rem 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.quiz {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding: 1.75rem;
}
.quiz-question {
    border: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
}
.quiz-question h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.quiz-question.unanswered h4 {
    color: #e2483d;
}

/* Compensation: stylized salary input + "not available" poison. */
.quiz-amount {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}
.quiz-amount:focus-within {
    border-color: var(--accent);
}
.quiz-amount-prefix {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--muted);
}
.quiz-amount-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 1.3rem;
    font-weight: 700;
    appearance: textfield;
    -moz-appearance: textfield;
}
.quiz-amount-input::-webkit-outer-spin-button,
.quiz-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.quiz-amount-suffix {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}
.quiz-na {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--muted);
    cursor: pointer;
}
.quiz-na:has(:checked) {
    color: #e2483d;
}
.quiz-na:has(:checked) + .quiz-fail-reason {
    display: block;
}

/* Expertise: multi-select pills. */
.quiz-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.quiz-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    border: 1.5px solid var(--border);
    border-radius: 9999px;
    background: var(--tag-bg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s,
        color 0.15s;
}
.quiz-pill input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.quiz-pill:hover {
    border-color: var(--accent);
}
.quiz-pill:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.quiz-pill:has(:checked) {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}
.quiz-pill:has(input[value='fail']:checked) {
    border-color: #e2483d;
    background: oklch(from #e2483d l c h / 0.12);
    color: #e2483d;
}
.quiz-pills:has(input[value='fail']:checked) + .quiz-fail-reason {
    display: block;
}
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.quiz-options label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition:
        border-color 0.15s,
        background 0.15s;
}
.quiz-options label:hover {
    border-color: var(--accent);
}
.quiz-options label:has(:checked) {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.quiz-options label:has(:checked)[for$='fail'] {
    border-color: #e2483d;
    background: oklch(from #e2483d l c h / 0.12);
}
/* Custom-styled but still-native radios & checkboxes (keeps label/aria). */
.quiz-options input[type='radio'],
.quiz-na input[type='checkbox'] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    display: grid;
    place-content: center;
    border: 1.5px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
}
.quiz-options input[type='radio'] {
    border-radius: 50%;
}
.quiz-options input[type='radio']::before {
    content: '';
    width: 0.58rem;
    height: 0.58rem;
    border-radius: 50%;
    background: var(--accent);
    transform: scale(0);
    transition: transform 0.12s ease;
}
.quiz-options input[type='radio']:checked {
    border-color: var(--accent);
}
.quiz-options input[type='radio']:checked::before {
    transform: scale(1);
}
.quiz-na input[type='checkbox'] {
    border-radius: 5px;
}
.quiz-na input[type='checkbox']::before {
    content: '';
    width: 0.32rem;
    height: 0.6rem;
    margin-top: -2px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.12s ease;
}
.quiz-na input[type='checkbox']:checked {
    border-color: #e2483d;
    background: #e2483d;
}
.quiz-na input[type='checkbox']:checked::before {
    transform: rotate(45deg) scale(1);
}
.quiz-options input:focus-visible,
.quiz-na input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.quiz-fail-reason {
    display: none;
    color: #e2483d;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0.1rem 0.25rem 0.25rem;
}
.quiz-options label:has(:checked) + .quiz-fail-reason {
    display: block;
}
.quiz-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.quiz-error {
    display: none;
    color: #e2483d;
    font-size: 0.9rem;
    font-weight: 600;
}
/* Show validation prompts only after a submit attempt. */
.quiz:has(.quiz-question.unanswered) .quiz-foot .quiz-error,
.quiz-pass.submitted:has(input:invalid) .quiz-error {
    display: block;
}

.quiz-result {
    display: none;
    padding: 1.5rem;
}
.quiz-result h3 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}
.quiz-result p {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}
.quiz-result a {
    color: var(--accent);
}
.quiz-email {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0 0.5rem;
}
.quiz-email input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}
.quiz-email input:focus {
    outline: none;
    border-color: var(--accent);
}

/* State machine: only the active step is shown. */
.quiz,
.quiz-intro,
.quiz-result {
    display: none;
}
.quiz-modal[data-state='quiz'] .quiz,
.quiz-modal[data-state='fail'] .quiz {
    display: flex;
}
.quiz-modal[data-state='quiz'] .quiz-intro {
    display: block;
}
.quiz-modal[data-state='fail'] .quiz-fail,
.quiz-modal[data-state='pass'] .quiz-pass,
.quiz-modal[data-state='sent'] .quiz-sent {
    display: block;
}
.quiz-modal[data-state='fail'] .quiz-foot .btn {
    display: none;
}

/* ---------- Message form (#msg-form — inline card in #contact) ---------- */
.msg-card {
    position: relative; /* containing block for the .msg-success overlay */
    display: flex;
    flex-direction: column;
    background: var(--bg);
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    padding: 0;
    overflow: hidden;
    color: var(--text);
    /* .u-skew parallelogram (see markup); direct children counter-skew upright. */
    & > * {
        transform: var(--skewX-counter);
    }

    .msg-textarea {
        resize: none;
        border: none;
        outline: none;
        padding: 1.1rem 1.25rem;
        font-family: inherit;
        font-size: 0.9375rem;
        line-height: 1.65;
        background: var(--bg);
        color: var(--text);
        min-height: 170px;
        transition: background 0.15s;
        flex-grow: 1;

        &:focus {
            background: var(--tag-bg);
        }
        &::placeholder {
            color: var(--muted);
        }
    }

    .msg-actions {
        display: flex;
        align-items: stretch; /* send button fills the row's full height */
        justify-content: flex-end;
        gap: 0.75rem;
        border-top: 1px solid var(--border);

        .msg-hint {
            align-self: center;
            font-size: 0.9rem;
            color: var(--muted);
            padding: 0.75rem 0.85rem;
            margin-right: auto;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            /* Without this the nowrap hint refuses to shrink (flex min-width is
               auto), forcing the card wider than a narrow viewport instead of
               letting the ellipsis kick in. */
            min-width: 0;
            transform-origin: center bottom;

            &.nudge {
                animation: nudge 0.55s ease-out;
            }
        }
    }

    /* Stretches to the row's full height; the shared .btn ::before draws the
       -6deg parallelogram, matching the card and every other button. */
    .msg-send {
        flex-shrink: 0;
        padding-block: 0;
        padding-inline: 1.1rem;
        font-size: 0.9rem;
    }

    .msg-success {
        display: none;
        position: absolute;
        inset: 0;
        background: var(--bg);
        align-items: center;
        justify-content: center;
        border-radius: var(--radius);
        font-size: 0.9375rem;
        color: var(--accent);
        font-weight: 600;

        &.is-visible {
            display: flex;
        }
    }
}

/* ---------- Dialog / popover open/close animation ---------- */
/* #msg-modal is a modal <dialog> — open state is [open], it renders ::backdrop.
   #cookie-bar / #cookie-policy are popovers — open state is :popover-open.
   Both animate via @starting-style + allow-discrete so the display:none toggle
   transitions instead of cutting instantly. The closed transform comes from
   --dialog-enter so each element keeps its own direction (and reduced-motion
   can neutralise it in one place). */
dialog {
    opacity: 0;
    transform: var(--dialog-enter, translateY(20px));
    transition:
        opacity 0.3s ease,
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        overlay 0.3s allow-discrete,
        display 0.3s allow-discrete;
}

#cookie-bar {
    --dialog-enter: translateX(calc(100% + 1.5rem));
}
#cookie-policy {
    --dialog-enter: translateY(100%);
}
#recruiter-quiz {
    --dialog-enter: translateY(20px);
}

/* Open state. :popover-open for the cookie popovers; [open] for the quiz, which
   is a true modal opened via showModal(). */
dialog:popover-open,
#recruiter-quiz[open] {
    opacity: 1;
    transform: none;
}

@starting-style {
    dialog:popover-open,
    #recruiter-quiz[open] {
        opacity: 0;
        transform: var(--dialog-enter, translateY(20px));
    }
}

/* Modal backdrop fade. */
#recruiter-quiz::backdrop {
    background: rgba(0, 0, 0, 0);
    transition:
        background 0.3s ease,
        overlay 0.3s allow-discrete,
        display 0.3s allow-discrete;
}
#recruiter-quiz[open]::backdrop {
    background: rgba(0, 0, 0, 0.65);
}
@starting-style {
    #recruiter-quiz[open]::backdrop {
        background: rgba(0, 0, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    dialog {
        transform: none;
        transition-property: opacity, overlay, display;
    }

    @starting-style {
        dialog:popover-open,
        #recruiter-quiz[open] {
            transform: none;
        }
    }
}

/* ---------- Cookie consent ---------- */
/* #cookie-bar and #cookie-policy are popovers: when open they're promoted to
   the top layer, so they position themselves (the container no longer clips
   them) and animate via the dialog block above (@starting-style). */

/* ---------- Cookie bar (popover) ---------- */

#cookie-bar {
    position: fixed;
    inset: auto 1.25rem 1.25rem auto;
    margin: 0;
    height: 2.5rem;
    width: 22rem;
    max-width: calc(100vw - 2.5rem);
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
    padding: 0 1rem 0 0.875rem;

    /* Closed popover stays display:none (UA); flex only when open. */
    &:popover-open {
        display: flex;
    }
    /* Frosted accent glass: translucent tinted gradient over a backdrop blur
       (clip-path clips the blurred region to the parallelogram). */
    background: linear-gradient(
        120deg,
        color-mix(in srgb, var(--accent) 35%, rgba(0, 0, 0, 0.82)),
        color-mix(in srgb, var(--accent) 18%, rgba(0, 0, 0, 0.82))
    );
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border: none;
    border-radius: 0;
    --clip-x: 0.6rem;
    clip-path: var(--clip-para);
    white-space: nowrap;
    color: var(--text);

    .label {
        font-size: 0.9rem;
        font-weight: 800;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--accent);
    }

    .policy-btn {
        margin-right: 0.25rem;
        line-height: 1;
        gap: 0.35rem;

        .icon {
            width: 1rem;
            height: 1rem;
        }

        &:hover {
            color: var(--accent);
        }

        :root:has(#cookie-policy:popover-open) & {
            color: var(--accent);
        }
    }

    .cookie-close .icon {
        width: 1.05rem;
        height: 1.05rem;
    }
}

[data-cookie-accepted='true'] [data-cookie='false'] {
    display: none;
}

[data-cookie-accepted='false'] [data-cookie='true'] {
    display: none;
}

/* ---------- Cookie policy (popover) ---------- */
#cookie-policy {
    position: fixed;
    inset: auto 1.25rem 4rem auto;
    margin: 0;
    width: 15rem;
    max-width: calc(100vw - 2.5rem);
    padding: 1rem 1.125rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.1),
        0 1px 4px rgba(0, 0, 0, 0.06);

    h3 {
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--accent);
        margin-bottom: 0.5rem;
    }

    p {
        font-size: 0.9rem;
        color: var(--muted);
        line-height: 1.6;
        margin-bottom: 0.5rem;

        &:last-of-type {
            margin-bottom: 0;
        }
    }
}

/* ---------- Footer ---------- */
footer {
    max-width: 76rem;
    margin-inline: auto;
    padding: 2.5rem clamp(1.25rem, 5vw, 3rem) 6rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--muted);
    display: flex;
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;

    .footer-brand {
        display: flex;
        flex-direction: column;
        line-height: 1.2;
    }
    .footer-name {
        font-size: 1rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        color: var(--text);
    }
    .footer-role {
        font-size: 0.9rem;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    .footer-links {
        display: flex;
        gap: 1.5rem;

        a,
        button {
            background: none;
            border: none;
            font-size: 0.9rem;
            font-weight: 600;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            text-decoration: none;
            color: var(--muted);
            transition: color 0.15s;

            &:hover {
                color: var(--accent);
            }

            &[popovertarget='cookie-bar'] {
                svg {
                    width: 1.25rem;
                    height: 1.25rem;
                }
            }
        }
    }
}

@media (max-width: 720px) {
    /* Stack the footer into a single left-aligned column. The desktop layout
       reserves a 10rem left gutter for the docked toggles and spreads its rows
       with space-between, which collapses into a cramped sliver on narrow
       screens. Drop the gutter and clear the controls that float over the
       bottom of the viewport — the accent/theme toggles (bottom-left) and the
       cookie bar (bottom-right). Both sit at bottom:1.25rem and are 2.5rem
       tall, so reserve well past that (plus the device safe-area) as bottom
       padding so footer content never sits behind them. */
    footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
        padding-left: clamp(1.25rem, 5vw, 3rem);
        padding-bottom: calc(8rem + env(safe-area-inset-bottom, 0px));
    }

    #cookie-bar {
        bottom: 4.85rem;
    }
}
