/* Bio page styles: shared layout, then one block per theme, then the customisation options.
   Pages are rendered by lib/render.js. Colours use light-dark(), driven by data-mode. */

/* ---------- Base ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
    color-scheme: light dark;
    min-height: 100%;
    background: var(--page-bg, var(--bg));
    background-attachment: fixed;
}

html[data-mode="light"] { color-scheme: light; }
html[data-mode="dark"] { color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    font-family: var(--font);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: rgba(0, 0, 0, var(--bg-dim, 0));
    -webkit-backdrop-filter: blur(var(--bg-blur, 0px));
    backdrop-filter: blur(var(--bg-blur, 0px));
}

.icon {
    font-family: "Material Symbols Rounded";
    font-size: 20px;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    display: inline-block;
    flex: none;
    width: 1em;
    overflow: hidden;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    font-feature-settings: "liga";
}

.icon--filled { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

.emoji {
    display: inline-block;
    flex: none;
    width: 1.2em;
    font-size: 18px;
    line-height: 1;
    text-align: center;
}

/* ---------- Layout ---------- */

.page {
    width: min(100% - 32px, var(--width, 720px));
    margin: 0 auto;
    padding: 32px 0 40px;
    display: flex;
    flex-direction: column;
    gap: var(--gap, 16px);
}

/* ---------- Header ---------- */

.profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 0 16px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 50%;
    border: var(--avatar-border, 0);
    background: var(--avatar-bg);
    box-shadow: var(--avatar-shadow, var(--shadow-1));
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

html[data-fit="contain"] .avatar img {
    width: 64%;
    height: 64%;
    object-fit: contain;
}

.avatar--letter {
    font-family: var(--heading-font);
    font-size: 48px;
    font-weight: 600;
    color: var(--on-accent);
}

.display {
    margin: 0;
    font-family: var(--heading-font);
    font-size: clamp(40px, 11vw, 57px);
    line-height: 1.12;
    font-weight: var(--heading-weight, 400);
    letter-spacing: var(--heading-tracking, -0.25px);
    overflow-wrap: anywhere;
}

.pronouns {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.profile__tag {
    margin: 8px 0 0;
    font-size: 22px;
    line-height: 28px;
}

.profile__meta {
    margin: 12px 0 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
}

.profile__meta .icon { font-size: 18px; }

.profile__body {
    display: flex;
    flex-direction: column;
    align-items: var(--justify, center);
    min-width: 0;
}

.profile__name {
    display: flex;
    align-items: center;
    justify-content: var(--justify, center);
    flex-wrap: wrap;
    gap: 4px 12px;
    max-width: 100%;
}

.profile__links {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: var(--justify, center);
    gap: 8px;
}

.sections {
    display: flex;
    flex-direction: column;
    gap: var(--gap, 16px);
}

.links-block .profile__links { margin-top: 0; }

/* ---------- Badges ---------- */

.badges {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: var(--justify, center);
    gap: 6px;
}

.profile__body > .badges--labels { margin: 10px 0 4px; }
.profile__body > .badges--labels:first-child { margin: 0 0 12px; }

.pbadge {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--badge);
    background: color-mix(in srgb, var(--badge) 16%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--badge) 40%, transparent);
    cursor: default;
    transition: transform 160ms ease;
}

.pbadge .icon { font-size: 18px; }
.pbadge:hover { transform: translateY(-2px) scale(1.06); }

.badges--labels .pbadge {
    display: inline-flex;
    gap: 5px;
    width: auto;
    height: 28px;
    padding: 0 11px 0 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.badges--labels .pbadge .icon { font-size: 17px; }

/* ---------- Buttons ---------- */

.btn,
.project--link {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn::after,
.project--link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: currentColor;
    opacity: 0;
    transition: opacity 150ms linear;
    pointer-events: none;
}

.btn:hover::after,
.project--link:hover::after { opacity: 0.08; }

.btn:active::after,
.project--link:active::after { opacity: 0.12; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 24px 0 16px;
    border: var(--btn-border, 1px solid transparent);
    border-radius: var(--btn-radius, 999px);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
    box-shadow: var(--btn-shadow, none);
    transition: box-shadow 200ms ease, transform 200ms ease, border-color 200ms ease;
}

.btn .icon { font-size: 18px; }
.btn:not(:has(.icon, .emoji)) { padding: 0 20px; }

.btn--filled { background: var(--accent); color: var(--on-accent); }
.btn--tonal { background: var(--tonal); color: var(--on-tonal); }
.btn--outlined { border-color: var(--outline); color: var(--accent-text, var(--accent)); background: var(--btn-outline-bg, transparent); }

/* ---------- Sections ---------- */

.section {
    padding: 20px;
    border-radius: var(--radius, 12px);
    background: var(--surface);
    border: var(--card-border, 0 solid transparent);
    box-shadow: var(--card-shadow, none);
}

.section > * + * { margin-top: 12px; }

.section__title {
    margin: 0;
    font-family: var(--heading-font);
    font-size: var(--title-size, 22px);
    line-height: 1.3;
    font-weight: var(--title-weight, 400);
    letter-spacing: var(--title-tracking, 0);
    text-transform: var(--title-case, none);
    color: var(--title-color, var(--text));
}

.section__text p {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.section__text p:last-child { margin-bottom: 0; }

.list {
    list-style: none;
    margin: 0 -4px;
    padding: 0;
}

.section > .list { margin-top: 4px; }
/* The last row's bottom padding would otherwise stack on the section's own. */
.section > .list:last-child { margin-bottom: -8px; }

.list__item {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 56px;
    padding: 8px 4px;
}

.list__item + .list__item { border-top: 1px solid var(--border); }

.list__item > .icon { font-size: 24px; color: var(--muted); }
.list__item > .emoji { font-size: 22px; }

.list__item div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.list__overline {
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.list__text {
    font-size: 16px;
    line-height: 24px;
    overflow-wrap: anywhere;
}

.chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 14px;
    border: 1px solid var(--outline);
    border-radius: var(--chip-radius, 8px);
    background: var(--chip-bg, transparent);
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}

.chip--fav {
    padding-left: 8px;
    border-color: transparent;
    background: var(--tonal);
    color: var(--on-tonal);
}

.chip .icon { font-size: 18px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.project {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 16px 12px;
    border-radius: var(--radius, 12px);
    background: var(--surface-2);
    border: var(--card2-border, 0 solid transparent);
    box-shadow: var(--card2-shadow, var(--shadow-1));
    transition: box-shadow 200ms ease, transform 200ms ease;
}

.project--link:hover { box-shadow: var(--card2-hover-shadow, var(--shadow-2)); }

.project--soon { opacity: 0.75; box-shadow: none; border: 1px solid var(--border); background: transparent; }

.project__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border-radius: calc(var(--radius, 12px) * 0.75 + 3px);
    background: var(--icon-bg);
    color: var(--on-icon-bg);
}

.project__icon .icon { font-size: 24px; }
.project__icon .emoji { font-size: 24px; width: auto; }
.project--soon .project__icon { background: var(--soon-bg, var(--tonal)); color: var(--on-soon-bg, var(--on-tonal)); }

.project__label {
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.project__name {
    margin: 0;
    font-family: var(--heading-font);
    font-size: 22px;
    line-height: 1.35;
    font-weight: var(--title-weight, 400);
}

.project__desc {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
}

.project__cta {
    align-self: flex-end;
    margin-top: auto;
    padding: 10px 4px 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-text, var(--accent));
}

.project__cta .icon { font-size: 18px; }

.footer {
    padding-top: 8px;
    text-align: center;
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.4px;
    color: var(--muted);
}

.footer p { margin: 0; }

/* Signatures left by the bio.mass.fyi team ("ruxi was here") */
.signs { display: flex; justify-content: center; }

.signs__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.sign {
    max-width: 100%;
    padding: 6px 14px;
    border: 1px solid var(--outline, currentColor);
    border-radius: 999px;
    background: var(--surface, transparent);
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    color: var(--text);
    overflow-wrap: anywhere;
}

.footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Theme: Material ---------- */

html[data-theme="material"] {
    --bg: light-dark(#fef7ff, #141218);
    --base: light-dark(#fef7ff, #141218);
    --text: light-dark(#1d1b20, #e6e0e9);
    --muted: light-dark(#49454f, #cac4d0);
    --surface: light-dark(#e6e0e9, #36343b);
    --surface-2: light-dark(#f7f2fa, #1d1b20);
    --border: light-dark(#cac4d0, #49454f);
    --outline: light-dark(#79747e, #938f99);
    --accent: light-dark(#6750a4, #d0bcff);
    --on-accent: light-dark(#ffffff, #381e72);
    --tonal: light-dark(#e8def8, #4a4458);
    --on-tonal: light-dark(#1d192b, #e8def8);
    --icon-bg: light-dark(#eaddff, #4f378b);
    --on-icon-bg: light-dark(#21005d, #eaddff);
    --soon-bg: light-dark(#ffd8e4, #633b48);
    --on-soon-bg: light-dark(#31111d, #ffd8e4);
    --avatar-bg: light-dark(#6750a4, #4f378b);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --radius: 12px;
}

html[data-theme="material"] .profile__tag { color: var(--text); }
html[data-theme="material"] .project--soon { opacity: 1; background: var(--base); border-color: var(--border); }

/* ---------- Theme: Glass (bio.mass.fyi) ---------- */

html[data-theme="glass"] {
    --bg: radial-gradient(ellipse at 50% 12%, rgba(255, 255, 255, 0.06), transparent 45%),
          radial-gradient(ellipse at 80% 90%, rgba(255, 255, 255, 0.03), transparent 40%), #000;
    --base: #000;
    --text: #fff;
    --muted: rgba(255, 255, 255, 0.62);
    --surface: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035) 48%, rgba(255, 255, 255, 0.075));
    --surface-2: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03) 48%, rgba(255, 255, 255, 0.06));
    --border: rgba(255, 255, 255, 0.1);
    --outline: rgba(255, 255, 255, 0.22);
    --accent: #fff;
    --accent-text: #fff;
    --on-accent: #000;
    --tonal: rgba(255, 255, 255, 0.12);
    --on-tonal: #fff;
    --icon-bg: rgba(255, 255, 255, 0.1);
    --on-icon-bg: #fff;
    --avatar-bg: rgba(255, 255, 255, 0.08);
    --avatar-border: 1px solid rgba(255, 255, 255, 0.2);
    --chip-bg: rgba(255, 255, 255, 0.06);
    --btn-outline-bg: rgba(255, 255, 255, 0.05);
    --card-border: 1px solid rgba(255, 255, 255, 0.2);
    --card2-border: 1px solid rgba(255, 255, 255, 0.16);
    --card-shadow: 0 20px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    --card2-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    --card2-hover-shadow: 0 16px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    --shadow-1: 0 8px 28px rgba(255, 255, 255, 0.06);
    --radius: 28px;
    --chip-radius: 999px;
    --heading-weight: 600;
    --heading-tracking: -0.06em;
    --title-size: 12px;
    --title-weight: 600;
    --title-tracking: 0.14em;
    --title-case: uppercase;
    --title-color: rgba(255, 255, 255, 0.55);
    --gap: 20px;
}

html[data-theme="glass"] .section,
html[data-theme="glass"] .project:not(.project--soon) {
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    backdrop-filter: blur(24px) saturate(150%);
}

html[data-theme="glass"] .section { padding: 26px 28px; }
html[data-theme="glass"] .project { padding: 20px 22px 16px; }
html[data-theme="glass"] .project--link:hover { transform: translateY(-3px); }
html[data-theme="glass"] .project__name { font-weight: 600; letter-spacing: -0.03em; }
html[data-theme="glass"] .btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.4); }
html[data-theme="glass"] .section__text p { color: rgba(255, 255, 255, 0.85); }

/* ---------- Theme: Minimal ---------- */

html[data-theme="minimal"] {
    --bg: light-dark(#ffffff, #0b0b0c);
    --base: light-dark(#ffffff, #0b0b0c);
    --text: light-dark(#18181b, #f4f4f5);
    --muted: light-dark(#52525b, #a1a1aa);
    --surface: transparent;
    --surface-2: light-dark(#f4f4f5, #18181b);
    --border: light-dark(#e4e4e7, #27272a);
    --outline: light-dark(#d4d4d8, #3f3f46);
    --accent: light-dark(#18181b, #fafafa);
    --on-accent: light-dark(#ffffff, #09090b);
    --tonal: light-dark(#f4f4f5, #27272a);
    --on-tonal: var(--text);
    --icon-bg: light-dark(#f4f4f5, #27272a);
    --on-icon-bg: var(--text);
    --avatar-bg: light-dark(#18181b, #fafafa);
    --shadow-1: none;
    --card2-shadow: none;
    --card2-hover-shadow: none;
    --card2-border: 1px solid var(--border);
    --radius: 10px;
    --chip-radius: 999px;
    --heading-weight: 700;
    --heading-tracking: -0.04em;
    --title-size: 13px;
    --title-weight: 600;
    --title-tracking: 0.08em;
    --title-case: uppercase;
    --title-color: var(--muted);
    --gap: 8px;
}

html[data-theme="minimal"] .section {
    /* The gap between sections sits under each one, so take it off the bottom to keep the divider centred. */
    padding: 24px 0 calc(24px - var(--gap));
    border-radius: 0;
    border-top: 1px solid var(--border);
}

html[data-theme="minimal"] .project--link:hover { border-color: var(--outline); }

/* ---------- Theme: Paper ---------- */

html[data-theme="paper"] {
    --bg: radial-gradient(circle at 20% 10%, #fbf7ef, transparent 50%) #f4efe6;
    --base: light-dark(#f4efe6, #1c1a17);
    --text: light-dark(#292524, #ede6da);
    --muted: light-dark(#57534e, #b5aa98);
    --surface: light-dark(#fffdf8, #26231f);
    --surface-2: light-dark(#faf6ee, #2d2924);
    --border: light-dark(#e7dfd1, #3d3830);
    --outline: light-dark(#c9bca6, #5a5246);
    --accent: light-dark(#9a3412, #f0a37a);
    --on-accent: light-dark(#fffaf0, #2a1206);
    --tonal: light-dark(#f6e3d3, #4a2e1f);
    --on-tonal: light-dark(#5c1f09, #f9dcc8);
    --icon-bg: light-dark(#f6e3d3, #4a2e1f);
    --on-icon-bg: light-dark(#7c2d12, #f9dcc8);
    --avatar-bg: light-dark(#9a3412, #7c2d12);
    --card-shadow: 0 1px 2px rgba(60, 40, 20, 0.08), 0 8px 24px rgba(60, 40, 20, 0.08);
    --card-border: 1px solid var(--border);
    --shadow-1: 0 2px 10px rgba(60, 40, 20, 0.12);
    --shadow-2: 0 6px 22px rgba(60, 40, 20, 0.18);
    --radius: 6px;
    --btn-radius: 6px;
    --chip-radius: 4px;
    --heading-weight: 700;
    --title-size: 26px;
    --title-weight: 700;
}

html[data-theme="paper"] .section { padding: 28px 30px; }
html[data-theme="paper"] .profile__tag { font-style: italic; }
html[data-theme="paper"] .section__text p { font-size: 17px; line-height: 1.75; }

/* ---------- Theme: Pastel ---------- */

html[data-theme="pastel"] {
    --bg: linear-gradient(160deg, #fdf2f8 0%, #eef2ff 50%, #ecfeff 100%);
    --base: light-dark(#fdf2f8, #1f1724);
    --text: light-dark(#4a2040, #fbe7f3);
    --muted: light-dark(#7a5070, #d6b4c9);
    --surface: light-dark(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.06));
    --surface-2: light-dark(#ffffff, rgba(255, 255, 255, 0.08));
    --border: light-dark(#f6d7ea, rgba(255, 255, 255, 0.1));
    --outline: light-dark(#f0b6d8, rgba(255, 182, 216, 0.35));
    --accent: light-dark(#ec4899, #f9a8d4);
    --on-accent: light-dark(#ffffff, #3b0a24);
    --tonal: light-dark(#fce7f3, rgba(249, 168, 212, 0.18));
    --on-tonal: light-dark(#9d174d, #fbcfe8);
    --icon-bg: light-dark(#e0e7ff, rgba(165, 180, 252, 0.2));
    --on-icon-bg: light-dark(#4338ca, #c7d2fe);
    --soon-bg: light-dark(#cffafe, rgba(103, 232, 249, 0.18));
    --on-soon-bg: light-dark(#0e7490, #a5f3fc);
    --avatar-bg: light-dark(#f9a8d4, #be185d);
    --avatar-border: 4px solid light-dark(#ffffff, rgba(255, 255, 255, 0.15));
    --card-shadow: 0 10px 30px light-dark(rgba(236, 72, 153, 0.12), rgba(0, 0, 0, 0.3));
    --card2-shadow: 0 6px 18px light-dark(rgba(99, 102, 241, 0.12), rgba(0, 0, 0, 0.3));
    --card2-hover-shadow: 0 12px 28px light-dark(rgba(99, 102, 241, 0.2), rgba(0, 0, 0, 0.4));
    --shadow-1: 0 10px 30px rgba(236, 72, 153, 0.25);
    --radius: 26px;
    --chip-radius: 999px;
    --heading-weight: 800;
    --title-weight: 800;
    --gap: 18px;
}

html[data-theme="pastel"] .section { padding: 24px 26px; }
html[data-theme="pastel"] .project--link:hover { transform: translateY(-4px) rotate(-0.5deg); }
html[data-theme="pastel"] .btn { font-weight: 700; }
html[data-theme="pastel"] .btn:hover { transform: translateY(-2px); }

/* ---------- Theme: Brutal ---------- */

html[data-theme="brutal"] {
    --bg: light-dark(#fff4cc, #111111);
    --base: light-dark(#fff4cc, #111111);
    --text: light-dark(#000000, #ffffff);
    --muted: light-dark(#1f1f1f, #e5e5e5);
    --surface: light-dark(#ffffff, #1c1c1c);
    --surface-2: light-dark(#a5f3fc, #1e3a8a);
    --border: light-dark(#000000, #ffffff);
    --outline: light-dark(#000000, #ffffff);
    --accent: #ff5c5c;
    --accent-text: light-dark(#000000, #ffffff);
    --on-accent: #000000;
    --tonal: light-dark(#c4b5fd, #6d28d9);
    --on-tonal: light-dark(#000000, #ffffff);
    --icon-bg: #ffde59;
    --on-icon-bg: #000000;
    --avatar-bg: #ff5c5c;
    --avatar-border: 3px solid var(--border);
    --avatar-shadow: 6px 6px 0 var(--border);
    --card-border: 3px solid var(--border);
    --card2-border: 3px solid var(--border);
    --card-shadow: 6px 6px 0 var(--border);
    --card2-shadow: 5px 5px 0 var(--border);
    --card2-hover-shadow: 8px 8px 0 var(--border);
    --btn-border: 3px solid var(--border);
    --btn-shadow: 4px 4px 0 var(--border);
    --btn-outline-bg: var(--surface);
    --chip-bg: var(--surface);
    --radius: 0;
    --btn-radius: 0;
    --chip-radius: 0;
    --heading-weight: 700;
    --heading-tracking: -0.04em;
    --title-weight: 700;
    --title-case: uppercase;
    --gap: 22px;
}

html[data-theme="brutal"] .chip { border-width: 2px; color: var(--text); }
html[data-theme="brutal"] .btn { font-weight: 700; text-transform: uppercase; }
html[data-theme="brutal"] .btn:hover,
html[data-theme="brutal"] .project--link:hover { transform: translate(-2px, -2px); }
html[data-theme="brutal"] .btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--border); }
html[data-theme="brutal"] .list__item + .list__item { border-top-width: 2px; }
html[data-theme="brutal"] .project__icon { border: 2px solid #000; }
html[data-theme="brutal"] .project--soon { border: 3px dashed var(--border); box-shadow: none; }
html[data-theme="brutal"] .display { text-transform: uppercase; }

/* ---------- Theme: Terminal ---------- */

html[data-theme="terminal"] {
    --bg: repeating-linear-gradient(0deg, rgba(57, 255, 136, 0.025) 0 1px, transparent 1px 3px), #050a05;
    --base: #050a05;
    --text: #b6f5b0;
    --muted: #6fbf72;
    --surface: #081008;
    --surface-2: #0b160b;
    --border: rgba(57, 255, 136, 0.18);
    --outline: rgba(57, 255, 136, 0.5);
    --accent: #39ff88;
    --on-accent: #001a09;
    --tonal: rgba(57, 255, 136, 0.14);
    --on-tonal: #39ff88;
    --icon-bg: rgba(57, 255, 136, 0.1);
    --on-icon-bg: #39ff88;
    --avatar-bg: #0b160b;
    --avatar-border: 1px solid #39ff88;
    --avatar-shadow: 0 0 24px rgba(57, 255, 136, 0.25);
    --card-border: 1px dashed rgba(57, 255, 136, 0.4);
    --card2-border: 1px solid rgba(57, 255, 136, 0.3);
    --card2-shadow: none;
    --card2-hover-shadow: 0 0 18px rgba(57, 255, 136, 0.2);
    --radius: 0;
    --btn-radius: 0;
    --chip-radius: 0;
    --heading-weight: 700;
    --title-size: 16px;
    --title-weight: 700;
    --title-color: #39ff88;
}

html[data-theme="terminal"] body { text-shadow: 0 0 6px rgba(57, 255, 136, 0.25); }
html[data-theme="terminal"] .display::before { content: "> "; color: var(--accent); }
html[data-theme="terminal"] .display::after {
    content: "_";
    margin-left: 4px;
    color: var(--accent);
    animation: caret 1.1s steps(1) infinite;
}
html[data-theme="terminal"] .section__title::before { content: "## "; opacity: 0.6; }
html[data-theme="terminal"] .chip::before { content: "#"; opacity: 0.6; }
html[data-theme="terminal"] .btn--outlined:hover { background: rgba(57, 255, 136, 0.08); }

@keyframes caret { 50% { opacity: 0; } }

/* ---------- Theme: Neon ---------- */

html[data-theme="neon"] {
    --bg: radial-gradient(ellipse at 15% 0%, rgba(255, 60, 172, 0.35), transparent 50%),
          radial-gradient(ellipse at 85% 100%, rgba(43, 134, 197, 0.4), transparent 55%),
          linear-gradient(180deg, #120428, #0a0218);
    --base: #120428;
    --text: #f5e9ff;
    --muted: #c4a8e0;
    --surface: rgba(31, 11, 61, 0.6);
    --surface-2: rgba(45, 16, 84, 0.65);
    --border: rgba(255, 60, 172, 0.18);
    --outline: rgba(255, 60, 172, 0.55);
    --accent: #ff3cac;
    --on-accent: #ffffff;
    --tonal: rgba(120, 75, 160, 0.4);
    --on-tonal: #f5e9ff;
    --icon-bg: linear-gradient(135deg, #ff3cac, #784ba0 50%, #2b86c5);
    --on-icon-bg: #fff;
    --avatar-bg: linear-gradient(135deg, #ff3cac, #784ba0 50%, #2b86c5);
    --avatar-shadow: 0 0 40px rgba(255, 60, 172, 0.45);
    --glow: #ff3cac;
    --card-border: 1px solid rgba(255, 60, 172, 0.3);
    --card2-border: 1px solid rgba(120, 75, 160, 0.5);
    --card-shadow: 0 0 30px rgba(255, 60, 172, 0.12), inset 0 0 30px rgba(120, 75, 160, 0.15);
    --card2-shadow: 0 0 18px rgba(43, 134, 197, 0.15);
    --card2-hover-shadow: 0 0 28px rgba(255, 60, 172, 0.35);
    --btn-shadow: 0 0 18px rgba(255, 60, 172, 0.35);
    --radius: 18px;
    --chip-radius: 999px;
    --heading-weight: 700;
    --heading-tracking: -0.03em;
    --title-weight: 600;
}

html[data-theme="neon"] .display {
    background: linear-gradient(90deg, #ff3cac, #b18cff, #2bd2ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 18px rgba(255, 60, 172, 0.35));
}
html[data-theme="neon"] .section {
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}
html[data-theme="neon"] .btn:hover { transform: translateY(-2px); box-shadow: 0 0 26px var(--glow); }

/* ---------- Theme: Midnight ---------- */

html[data-theme="midnight"] {
    --bg: radial-gradient(ellipse at 50% -10%, rgba(96, 165, 250, 0.22), transparent 55%),
          radial-gradient(ellipse at 100% 100%, rgba(129, 140, 248, 0.14), transparent 50%), #070b1a;
    --base: #070b1a;
    --text: #e6ecff;
    --muted: #9aa8cc;
    --surface: rgba(17, 26, 51, 0.72);
    --surface-2: rgba(26, 38, 72, 0.7);
    --border: rgba(148, 170, 255, 0.12);
    --outline: rgba(148, 170, 255, 0.32);
    --accent: #60a5fa;
    --on-accent: #04122b;
    --tonal: rgba(96, 165, 250, 0.16);
    --on-tonal: #cfe2ff;
    --icon-bg: rgba(96, 165, 250, 0.16);
    --on-icon-bg: #93c5fd;
    --avatar-bg: linear-gradient(135deg, #3b82f6, #6366f1);
    --avatar-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18), 0 12px 40px rgba(59, 130, 246, 0.35);
    --glow: #60a5fa;
    --card-border: 1px solid rgba(148, 170, 255, 0.14);
    --card2-border: 1px solid rgba(148, 170, 255, 0.12);
    --card-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --card2-shadow: none;
    --card2-hover-shadow: 0 0 0 1px rgba(96, 165, 250, 0.45), 0 10px 30px rgba(59, 130, 246, 0.2);
    --radius: 20px;
    --chip-radius: 999px;
    --heading-weight: 700;
    --heading-tracking: -0.04em;
    --title-size: 13px;
    --title-weight: 600;
    --title-tracking: 0.12em;
    --title-case: uppercase;
    --title-color: #7ea6e8;
}

html[data-theme="midnight"] .section { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
html[data-theme="midnight"] .btn:hover { transform: translateY(-2px); }

/* ---------- Theme: Aurora ---------- */

html[data-theme="aurora"] {
    --bg: radial-gradient(ellipse 80% 50% at 20% 0%, rgba(45, 212, 191, 0.32), transparent 60%),
          radial-gradient(ellipse 70% 45% at 85% 10%, rgba(167, 139, 250, 0.3), transparent 60%),
          radial-gradient(ellipse 60% 40% at 50% 100%, rgba(34, 197, 94, 0.16), transparent 60%), #03121a;
    --base: #03121a;
    --text: #e7fffb;
    --muted: #94c9c3;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-2: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.1);
    --outline: rgba(94, 234, 212, 0.4);
    --accent: #5eead4;
    --on-accent: #022c27;
    --tonal: rgba(94, 234, 212, 0.14);
    --on-tonal: #ccfbf1;
    --icon-bg: linear-gradient(135deg, rgba(94, 234, 212, 0.3), rgba(167, 139, 250, 0.3));
    --on-icon-bg: #f0fdfa;
    --avatar-bg: linear-gradient(135deg, #2dd4bf, #a78bfa);
    --avatar-shadow: 0 0 50px rgba(94, 234, 212, 0.35);
    --glow: #5eead4;
    --card-border: 1px solid rgba(255, 255, 255, 0.12);
    --card2-border: 1px solid rgba(255, 255, 255, 0.1);
    --card-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    --card2-shadow: none;
    --card2-hover-shadow: 0 0 30px rgba(94, 234, 212, 0.18);
    --radius: 24px;
    --chip-radius: 999px;
    --heading-weight: 600;
    --heading-tracking: -0.04em;
    --title-weight: 600;
    --gap: 18px;
}

html[data-theme="aurora"] .section,
html[data-theme="aurora"] .project:not(.project--soon) { -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%); }
html[data-theme="aurora"] .display {
    background: linear-gradient(90deg, #99f6e4, #e9d5ff, #bbf7d0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Theme: Sunset ---------- */

html[data-theme="sunset"] {
    --bg: linear-gradient(170deg, #fff1db 0%, #ffd9c2 45%, #ffc4d6 100%);
    --base: light-dark(#fff1db, #1f0f12);
    --text: light-dark(#431407, #ffe9dc);
    --muted: light-dark(#7c2d12, #f3b59a);
    --surface: light-dark(rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.06));
    --surface-2: light-dark(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.08));
    --border: light-dark(rgba(234, 88, 12, 0.16), rgba(255, 180, 140, 0.14));
    --outline: light-dark(rgba(234, 88, 12, 0.45), rgba(255, 160, 120, 0.45));
    --accent: light-dark(#ea580c, #fb923c);
    --on-accent: light-dark(#ffffff, #2a0d02);
    --tonal: light-dark(#ffe4d0, rgba(251, 146, 60, 0.18));
    --on-tonal: light-dark(#9a3412, #fed7aa);
    --icon-bg: linear-gradient(135deg, #fb923c, #f43f5e);
    --on-icon-bg: #ffffff;
    --avatar-bg: linear-gradient(135deg, #f59e0b, #f43f5e);
    --avatar-border: 4px solid light-dark(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.12));
    --card-shadow: 0 14px 40px light-dark(rgba(234, 88, 12, 0.14), rgba(0, 0, 0, 0.35));
    --card2-shadow: 0 6px 20px light-dark(rgba(244, 63, 94, 0.12), rgba(0, 0, 0, 0.3));
    --card2-hover-shadow: 0 12px 30px light-dark(rgba(244, 63, 94, 0.22), rgba(0, 0, 0, 0.45));
    --shadow-1: 0 12px 34px rgba(244, 63, 94, 0.3);
    --glow: #fb923c;
    --radius: 22px;
    --chip-radius: 999px;
    --heading-weight: 700;
    --heading-tracking: -0.03em;
    --title-weight: 700;
}

html[data-theme="sunset"] .section { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
html[data-theme="sunset"] .btn--filled { background: linear-gradient(135deg, #f97316, #e11d48); color: #fff; }
html[data-theme="sunset"] .btn:hover { transform: translateY(-2px); }

/* ---------- Theme: Ocean ---------- */

html[data-theme="ocean"] {
    --bg: linear-gradient(180deg, #e0f2fe 0%, #ecfeff 60%, #f0fdfa 100%);
    --base: light-dark(#e0f2fe, #04131f);
    --text: light-dark(#082f49, #e0f2fe);
    --muted: light-dark(#155e75, #93c5d8);
    --surface: light-dark(#ffffff, #0a2233);
    --surface-2: light-dark(#f0f9ff, #0e2c40);
    --border: light-dark(#bae6fd, #164e63);
    --outline: light-dark(#7dd3fc, #2b7a9b);
    --accent: light-dark(#0284c7, #38bdf8);
    --on-accent: light-dark(#ffffff, #03243a);
    --tonal: light-dark(#cffafe, rgba(56, 189, 248, 0.16));
    --on-tonal: light-dark(#0e7490, #bae6fd);
    --icon-bg: light-dark(#ccfbf1, rgba(45, 212, 191, 0.16));
    --on-icon-bg: light-dark(#0f766e, #99f6e4);
    --avatar-bg: linear-gradient(135deg, #06b6d4, #2563eb);
    --card-shadow: 0 10px 30px light-dark(rgba(2, 132, 199, 0.1), rgba(0, 0, 0, 0.35));
    --card2-shadow: none;
    --card2-border: 1px solid var(--border);
    --card2-hover-shadow: 0 8px 24px light-dark(rgba(2, 132, 199, 0.16), rgba(0, 0, 0, 0.4));
    --shadow-1: 0 10px 30px rgba(2, 132, 199, 0.25);
    --glow: #38bdf8;
    --radius: 18px;
    --chip-radius: 999px;
    --heading-weight: 700;
    --heading-tracking: -0.03em;
    --title-weight: 700;
}

html[data-theme="ocean"] .project--link:hover { transform: translateY(-3px); }

/* ---------- Theme: Forest ---------- */

html[data-theme="forest"] {
    --bg: radial-gradient(circle at 0% 0%, #f5f9f0, transparent 55%) #e6efdf;
    --base: light-dark(#e6efdf, #0f1a10);
    --text: light-dark(#1c2b1a, #e3eedc);
    --muted: light-dark(#4b5e47, #a8bca0);
    --surface: light-dark(#f7faf3, #172517);
    --surface-2: light-dark(#eef5e8, #1d2e1d);
    --border: light-dark(#d3e2c9, #2c432b);
    --outline: light-dark(#9fbc91, #4d6e49);
    --accent: light-dark(#3f7d3a, #8fd18a);
    --on-accent: light-dark(#ffffff, #0c240b);
    --tonal: light-dark(#dcebd3, #284227);
    --on-tonal: light-dark(#234b20, #cdeac6);
    --icon-bg: light-dark(#f1e6cc, #3b3420);
    --on-icon-bg: light-dark(#6b4f12, #f0deb0);
    --avatar-bg: light-dark(#3f7d3a, #2f5c2b);
    --card-border: 1px solid var(--border);
    --card-shadow: 0 2px 0 light-dark(#d3e2c9, #0a120a);
    --card2-shadow: none;
    --card2-border: 1px solid var(--border);
    --card2-hover-shadow: 0 6px 18px rgba(30, 60, 25, 0.14);
    --shadow-1: 0 6px 20px rgba(30, 60, 25, 0.18);
    --radius: 14px;
    --chip-radius: 999px;
    --heading-weight: 600;
    --title-size: 24px;
    --title-weight: 600;
}

html[data-theme="forest"] .section__text p { line-height: 1.7; }

/* ---------- Theme: Mocha ---------- */

html[data-theme="mocha"] {
    --bg: light-dark(#efe6dc, #1a1410);
    --base: light-dark(#efe6dc, #1a1410);
    --text: light-dark(#2e1f14, #f1e4d6);
    --muted: light-dark(#6b5442, #c2ab96);
    --surface: light-dark(#f8f2ea, #241c16);
    --surface-2: light-dark(#fffaf4, #2c231c);
    --border: light-dark(#e0d2c2, #3b3027);
    --outline: light-dark(#c4ab92, #5b4a3c);
    --accent: light-dark(#8b5e3c, #d9a77a);
    --on-accent: light-dark(#fffaf4, #2a1a0d);
    --tonal: light-dark(#ead9c6, #3d2e22);
    --on-tonal: light-dark(#5a3a22, #f1dcc4);
    --icon-bg: light-dark(#ead9c6, #3d2e22);
    --on-icon-bg: light-dark(#6b4428, #f1dcc4);
    --avatar-bg: light-dark(#8b5e3c, #6b4428);
    --avatar-border: 4px solid light-dark(#f8f2ea, #241c16);
    --card-shadow: 0 1px 2px rgba(60, 35, 15, 0.06), 0 10px 26px rgba(60, 35, 15, 0.08);
    --card2-shadow: none;
    --card2-border: 1px solid var(--border);
    --card2-hover-shadow: 0 8px 22px rgba(60, 35, 15, 0.14);
    --shadow-1: 0 6px 20px rgba(60, 35, 15, 0.2);
    --radius: 18px;
    --chip-radius: 999px;
    --heading-weight: 600;
    --title-size: 24px;
    --title-weight: 600;
}

/* ---------- Theme: Lavender ---------- */

html[data-theme="lavender"] {
    --bg: radial-gradient(circle at 80% 0%, #ffe4f6, transparent 45%), radial-gradient(circle at 0% 60%, #e0e7ff, transparent 45%) #f3efff;
    --base: light-dark(#f3efff, #150f24);
    --text: light-dark(#2e1065, #ede9fe);
    --muted: light-dark(#5b4a8a, #b9aee0);
    --surface: light-dark(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.06));
    --surface-2: light-dark(#ffffff, rgba(255, 255, 255, 0.08));
    --border: light-dark(#e4dcff, rgba(196, 181, 253, 0.14));
    --outline: light-dark(#c4b5fd, rgba(196, 181, 253, 0.4));
    --accent: light-dark(#7c3aed, #c4b5fd);
    --on-accent: light-dark(#ffffff, #1e0b4b);
    --tonal: light-dark(#ede9fe, rgba(196, 181, 253, 0.16));
    --on-tonal: light-dark(#5b21b6, #ddd6fe);
    --icon-bg: light-dark(#fce7f3, rgba(244, 114, 182, 0.16));
    --on-icon-bg: light-dark(#be185d, #fbcfe8);
    --avatar-bg: linear-gradient(135deg, #a78bfa, #f472b6);
    --avatar-border: 4px solid light-dark(#ffffff, rgba(255, 255, 255, 0.12));
    --card-shadow: 0 12px 34px light-dark(rgba(124, 58, 237, 0.1), rgba(0, 0, 0, 0.35));
    --card2-shadow: 0 4px 14px light-dark(rgba(124, 58, 237, 0.08), rgba(0, 0, 0, 0.3));
    --card2-hover-shadow: 0 10px 26px light-dark(rgba(124, 58, 237, 0.18), rgba(0, 0, 0, 0.4));
    --shadow-1: 0 10px 30px rgba(124, 58, 237, 0.25);
    --glow: #a78bfa;
    --radius: 24px;
    --chip-radius: 999px;
    --heading-weight: 700;
    --title-weight: 700;
    --gap: 18px;
}

html[data-theme="lavender"] .section { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
html[data-theme="lavender"] .project--link:hover { transform: translateY(-3px); }

/* ---------- Theme: Arcade ---------- */

html[data-theme="arcade"] {
    --bg: linear-gradient(rgba(255, 42, 109, 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
          linear-gradient(90deg, rgba(5, 217, 232, 0.07) 1px, transparent 1px) 0 0 / 24px 24px, #0d0221;
    --base: #0d0221;
    --text: #ffffff;
    --muted: #b9a7e6;
    --surface: #1a0b3b;
    --surface-2: #241052;
    --border: #3d1f7a;
    --outline: #05d9e8;
    --accent: #fde047;
    --accent-text: #05d9e8;
    --on-accent: #0d0221;
    --tonal: #3d1f7a;
    --on-tonal: #ffffff;
    --icon-bg: #ff2a6d;
    --on-icon-bg: #ffffff;
    --soon-bg: #3d1f7a;
    --on-soon-bg: #fde047;
    --avatar-bg: #ff2a6d;
    --avatar-border: 4px solid #05d9e8;
    --avatar-shadow: 6px 6px 0 #ff2a6d;
    --card-border: 3px solid #05d9e8;
    --card2-border: 3px solid #ff2a6d;
    --card-shadow: 6px 6px 0 #05d9e8;
    --card2-shadow: 4px 4px 0 #ff2a6d;
    --card2-hover-shadow: 6px 6px 0 #fde047;
    --btn-border: 3px solid #0d0221;
    --btn-shadow: 4px 4px 0 #ff2a6d;
    --chip-bg: #241052;
    --glow: #fde047;
    --radius: 0;
    --btn-radius: 0;
    --chip-radius: 0;
    --heading-weight: 400;
    --heading-tracking: 0;
    --title-size: 14px;
    --title-weight: 400;
    --title-color: #fde047;
    --gap: 22px;
}

html[data-theme="arcade"] .display { font-size: clamp(22px, 7vw, 36px); line-height: 1.4; text-shadow: 3px 3px 0 #ff2a6d; }
html[data-theme="arcade"] .project__name { font-size: 14px; line-height: 1.6; }
html[data-theme="arcade"] .btn { font-weight: 700; text-transform: uppercase; }
html[data-theme="arcade"] .btn--outlined { border-color: #05d9e8; background: #0d0221; }
html[data-theme="arcade"] .btn:hover,
html[data-theme="arcade"] .project--link:hover { transform: translate(-2px, -2px); }
html[data-theme="arcade"] .btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #ff2a6d; }
html[data-theme="arcade"] .chip { border: 2px solid #05d9e8; color: #fff; }

/* ---------- Theme: Mono ---------- */

html[data-theme="mono"] {
    --bg: light-dark(#ffffff, #000000);
    --base: light-dark(#ffffff, #000000);
    --text: light-dark(#000000, #ffffff);
    --muted: light-dark(#404040, #bdbdbd);
    --surface: light-dark(#ffffff, #000000);
    --surface-2: light-dark(#ffffff, #000000);
    --border: light-dark(#000000, #ffffff);
    --outline: light-dark(#000000, #ffffff);
    --accent: light-dark(#000000, #ffffff);
    --on-accent: light-dark(#ffffff, #000000);
    --tonal: light-dark(#ebebeb, #1f1f1f);
    --on-tonal: var(--text);
    --icon-bg: light-dark(#000000, #ffffff);
    --on-icon-bg: light-dark(#ffffff, #000000);
    --avatar-bg: light-dark(#000000, #ffffff);
    --avatar-border: 2px solid var(--border);
    --card-border: 2px solid var(--border);
    --card2-border: 2px solid var(--border);
    --card2-shadow: none;
    --card2-hover-shadow: none;
    --shadow-1: none;
    --btn-border: 2px solid var(--border);
    --radius: 0;
    --btn-radius: 0;
    --chip-radius: 0;
    --heading-weight: 700;
    --heading-tracking: -0.05em;
    --title-size: 13px;
    --title-weight: 700;
    --title-tracking: 0.1em;
    --title-case: uppercase;
}

html[data-theme="mono"] .project--link:hover,
html[data-theme="mono"] .btn--outlined:hover { background: var(--text); color: var(--base); }
html[data-theme="mono"] .project--link:hover .project__label,
html[data-theme="mono"] .project--link:hover .project__desc,
html[data-theme="mono"] .project--link:hover .project__cta { color: inherit; }

/* ---------- Theme: Custom (colours come from --c-* set by the renderer) ---------- */

html[data-theme="custom"] {
    --bg: var(--c-bg);
    --base: var(--c-bg);
    --text: var(--c-text);
    --muted: var(--c-muted);
    --surface: var(--c-surface);
    --surface-2: color-mix(in srgb, var(--c-surface) 88%, var(--c-text));
    --border: var(--c-border);
    --outline: color-mix(in srgb, var(--c-border) 55%, var(--c-text));
    --accent: var(--c-accent);
    --on-accent: var(--c-on-accent);
    --tonal: color-mix(in srgb, var(--c-accent) 20%, var(--c-surface));
    --on-tonal: var(--c-text);
    --icon-bg: color-mix(in srgb, var(--c-accent) 26%, var(--c-surface));
    --on-icon-bg: var(--c-text);
    --avatar-bg: var(--c-accent);
    --glow: var(--c-accent);
    --card-border: 1px solid var(--c-border);
    --card2-border: 1px solid var(--c-border);
    --card-shadow: 0 10px 30px color-mix(in srgb, #000 18%, transparent);
    --card2-shadow: none;
    --card2-hover-shadow: 0 0 0 1px var(--c-accent);
    --shadow-1: 0 8px 26px color-mix(in srgb, var(--c-accent) 30%, transparent);
    --radius: 16px;
    --chip-radius: 999px;
    --heading-weight: 700;
    --heading-tracking: -0.03em;
    --title-weight: 600;
}

/* light-dark() only takes colours, so gradient backgrounds switch here. */
html[data-theme="paper"][data-mode="dark"] { --bg: radial-gradient(circle at 20% 10%, #24211d, transparent 50%) #1c1a17; }
html[data-theme="pastel"][data-mode="dark"] { --bg: linear-gradient(160deg, #1f1724 0%, #18172b 50%, #10212a 100%); }
html[data-theme="sunset"][data-mode="dark"] { --bg: radial-gradient(ellipse at 50% 0%, rgba(249, 115, 22, 0.28), transparent 55%), linear-gradient(180deg, #1f0f12, #160a14); }
html[data-theme="ocean"][data-mode="dark"] { --bg: linear-gradient(180deg, #04131f 0%, #031c26 60%, #04201f 100%); }
html[data-theme="forest"][data-mode="dark"] { --bg: radial-gradient(circle at 0% 0%, #182a18, transparent 55%) #0f1a10; }
html[data-theme="lavender"][data-mode="dark"] { --bg: radial-gradient(circle at 80% 0%, #2a1236, transparent 45%), radial-gradient(circle at 0% 60%, #161a3a, transparent 45%) #150f24; }

@media (prefers-color-scheme: dark) {
    html[data-theme="paper"][data-mode="auto"] { --bg: radial-gradient(circle at 20% 10%, #24211d, transparent 50%) #1c1a17; }
    html[data-theme="pastel"][data-mode="auto"] { --bg: linear-gradient(160deg, #1f1724 0%, #18172b 50%, #10212a 100%); }
    html[data-theme="sunset"][data-mode="auto"] { --bg: radial-gradient(ellipse at 50% 0%, rgba(249, 115, 22, 0.28), transparent 55%), linear-gradient(180deg, #1f0f12, #160a14); }
    html[data-theme="ocean"][data-mode="auto"] { --bg: linear-gradient(180deg, #04131f 0%, #031c26 60%, #04201f 100%); }
    html[data-theme="forest"][data-mode="auto"] { --bg: radial-gradient(circle at 0% 0%, #182a18, transparent 55%) #0f1a10; }
    html[data-theme="lavender"][data-mode="auto"] { --bg: radial-gradient(circle at 80% 0%, #2a1236, transparent 45%), radial-gradient(circle at 0% 60%, #161a3a, transparent 45%) #150f24; }
}

/* ---------- Options (after themes so they win) ---------- */

html[data-width="narrow"] { --width: 560px; }
html[data-width="wide"] { --width: 960px; }

html[data-align="left"] .profile { --justify: flex-start; align-items: flex-start; text-align: left; }
html[data-align="right"] .profile { --justify: flex-end; align-items: flex-end; text-align: right; }

html[data-avatar="rounded"] .avatar { border-radius: 28%; }
html[data-avatar="square"] .avatar { border-radius: min(var(--radius, 12px), 8px); }

html[data-radius="sharp"] { --radius: 0px; --btn-radius: 0px; --chip-radius: 0px; }
html[data-radius="soft"] { --radius: 12px; --btn-radius: 10px; --chip-radius: 8px; }
html[data-radius="round"] { --radius: 28px; --btn-radius: 999px; --chip-radius: 999px; }

html[data-cards="filled"] .section { border-color: transparent; }
html[data-cards="filled"][data-theme="minimal"] .section { padding: 20px; background: var(--surface-2); border-radius: var(--radius); }
html[data-cards="outlined"] .section {
    background: transparent;
    border: 1px solid var(--outline);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
html[data-cards="flat"] .section {
    padding: 8px 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* ---------- Positions ---------- */

/* Picture beside the name. The links run full width underneath. */
html[data-avatar-pos="left"] .profile,
html[data-avatar-pos="right"] .profile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 28px;
    --justify: flex-start;
    text-align: left;
}

html[data-avatar-pos="left"] .avatar,
html[data-avatar-pos="right"] .avatar { margin-bottom: 0; }

html[data-avatar-pos="left"] .profile__links,
html[data-avatar-pos="right"] .profile__links { grid-column: 1 / -1; }

html[data-avatar-pos="right"] .profile { grid-template-columns: minmax(0, 1fr) auto; --justify: flex-end; text-align: right; }
html[data-avatar-pos="right"] .avatar { grid-column: 2; grid-row: 1; }
html[data-avatar-pos="right"] .profile__body { grid-column: 1; grid-row: 1; }

html[data-avatar-pos="left"] .display,
html[data-avatar-pos="right"] .display { font-size: clamp(32px, 8vw, 48px); }

/* Link buttons */
html[data-links-layout="stack"] .profile__links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 460px;
    align-self: var(--justify, center);
}
html[data-avatar-pos="left"][data-links-layout="stack"] .profile__links,
html[data-avatar-pos="right"][data-links-layout="stack"] .profile__links { max-width: none; }
html[data-links-layout="stack"] .btn { height: 52px; font-size: 15px; }

html[data-links-layout="grid"] .profile__links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    width: 100%;
}
html[data-links-layout="grid"] .btn { height: 48px; }

/* Per-link colour, thumbnails, featured and copy buttons */
html .profile__links .btn--custom.btn--filled { background: var(--link); color: var(--on-link); }
html .profile__links .btn--custom.btn--tonal { background: color-mix(in srgb, var(--link) 24%, var(--base, transparent)); color: var(--text); }
html .profile__links .btn--custom.btn--outlined { border-color: var(--link); color: var(--link); background: transparent; }

.btn__thumb {
    flex: none;
    width: 24px;
    height: 24px;
    margin-left: -4px;
    border-radius: 6px;
    object-fit: cover;
}

.profile__links .btn--featured {
    flex: none;
    width: 100%;
    max-width: 460px;
    height: 60px;
    font-size: 16px;
    font-weight: 600;
    gap: 12px;
}
.profile__links .btn--featured .icon { font-size: 22px; }
.profile__links .btn--featured .btn__thumb { width: 40px; height: 40px; border-radius: 10px; margin-left: -8px; }
html[data-links-layout="grid"] .btn--featured { grid-column: 1 / -1; max-width: none; height: 60px; }
html[data-links-layout="stack"] .btn--featured { max-width: none; height: 64px; }
html[data-avatar-pos="left"] .btn--featured,
html[data-avatar-pos="right"] .btn--featured { max-width: none; }

button.btn { font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.profile__links .btn--featured { font-size: 16px; font-weight: 600; }
.btn--copied .icon { visibility: hidden; }
.btn--copied::before {
    content: "check";
    position: absolute;
    left: 16px;
    font-family: "Material Symbols Rounded";
    font-size: 18px;
}

/* Scheduled links that aren't live (editor preview only) */
.btn--scheduled { opacity: 0.45; outline: 2px dashed var(--outline, currentColor); outline-offset: 2px; }

/* Local time and birthday */
.clock__diff { opacity: 0.8; }
.profile__bday--today { color: var(--accent-text, var(--accent)); font-weight: 600; }

/* ---------- Media ---------- */

.embeds { display: flex; flex-direction: column; gap: 12px; }

.embed {
    width: 100%;
    overflow: hidden;
    border-radius: calc(var(--radius, 12px) * 0.75 + 2px);
    background: var(--surface-2, rgba(127, 127, 127, 0.12));
}
.embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.embed--video { aspect-ratio: 16 / 9; }

.embed--ph {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 80px;
    padding: 16px;
    border: 1px dashed var(--outline, var(--border));
    background: transparent;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}
.embed--ph .icon { font-size: 26px; }

/* Music player: a pill or a card pinned to a corner of the screen, or a card in with the sections. */
.music {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}
.music__row { display: flex; align-items: center; gap: 10px; min-width: 0; }

.music--float {
    position: fixed;
    z-index: 30;
    border: 1px solid var(--outline, var(--border));
    background: color-mix(in srgb, var(--surface, #222) 88%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.music--bottom-right { right: 16px; bottom: 16px; }
.music--bottom-left { left: 16px; bottom: 16px; }
.music--top-right { right: 16px; top: 16px; }
.music--top-left { left: 16px; top: 16px; }

.music--pill {
    max-width: min(280px, calc(100vw - 32px));
    padding: 6px 16px 6px 6px;
    border-radius: 999px;
}
.music--float.music--card {
    width: min(300px, calc(100vw - 32px));
    padding: 14px;
    border-radius: var(--radius, 12px);
}

/* Leave room so a corner player never covers the page. On wide screens the page sits clear of the corners. */
body:has(.music--pill.music--bottom-right, .music--pill.music--bottom-left) .page { padding-bottom: 88px; }
body:has(.music--card.music--bottom-right, .music--card.music--bottom-left) .page { padding-bottom: 150px; }
@media (max-width: 1100px) {
    body:has(.music--pill.music--top-right, .music--pill.music--top-left) .page { padding-top: 80px; }
    body:has(.music--card.music--top-right, .music--card.music--top-left) .page { padding-top: 146px; }
}

.music__btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    cursor: pointer;
}
.music__btn .icon { font-size: 22px; font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.music__pause,
.music--on .music__play { display: none; }
.music--on .music__pause { display: inline-block; }
.music--error { opacity: 0.6; }

.music__text { display: flex; align-items: center; gap: 8px; min-width: 0; }
.music__title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Card extras: what's happening, and a seek bar with the time. */
.music--card .music__btn { width: 44px; height: 44px; }
.music--card .music__text { flex-direction: column; align-items: flex-start; gap: 3px; }
.music--card .music__title { max-width: 100%; font-size: 15px; font-weight: 600; }
.music__sub { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.music__seek { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.music__time, .music__dur { flex: none; min-width: 32px; }
.music__dur { text-align: right; }
.music__bar {
    flex: 1;
    min-width: 0;
    height: 4px;
    margin: 0;
    border-radius: 999px;
    background: linear-gradient(var(--accent), var(--accent)) 0 / var(--p, 0%) 100% no-repeat, color-mix(in srgb, var(--text) 16%, transparent);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.music__bar:disabled { cursor: default; }
.music__bar::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }
.music__bar::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }
.music__bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.music__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
.music__bars i { width: 3px; height: 4px; border-radius: 2px; background: var(--accent-text, var(--accent)); }
@media (prefers-reduced-motion: no-preference) {
    .music--on .music__bars i { animation: music-bar 0.9s ease-in-out infinite alternate; }
    .music--on .music__bars i:nth-child(2) { animation-delay: -0.3s; }
    .music--on .music__bars i:nth-child(3) { animation-delay: -0.6s; }
    .music--on .music__bars i:nth-child(4) { animation-delay: -0.15s; }
    @keyframes music-bar { from { height: 3px; } to { height: 14px; } }
}

/* ---------- Guestbook ---------- */

.gb__form fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}
.gb__form fieldset > input[name="author"] { grid-column: 1 / -1; }

.gb__input {
    width: 100%;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--outline, var(--border));
    border-radius: calc(var(--radius, 12px) * 0.6 + 2px);
    background: var(--surface-2, transparent);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    resize: vertical;
}
.gb__input::placeholder { color: var(--muted); opacity: 0.8; }
.gb__form .btn { align-self: end; height: 40px; }
.gb__form fieldset:disabled { opacity: 0.7; }

/* The honeypot field: hidden from people, filled in by spam bots. */
.gb__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.gb__status {
    margin: 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--tonal);
    color: var(--on-tonal);
    font-size: 14px;
}
.gb__status--warn { background: color-mix(in srgb, #f59e0b 22%, transparent); color: var(--text); }

.gb__list { list-style: none; margin: 4px 0 0; padding: 0; }
.gb__entry { padding: 12px 0; }
.gb__entry + .gb__entry { border-top: 1px solid var(--border); }
.gb__meta { display: flex; align-items: baseline; gap: 10px; font-size: 14px; }
.gb__meta time { font-size: 12px; color: var(--muted); }
.gb__text { margin: 4px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.gb__empty { margin: 0; font-size: 14px; color: var(--muted); }

.links-block { display: flex; flex-direction: column; align-items: var(--justify, center); }
html[data-align="left"] .links-block { --justify: flex-start; }
html[data-align="right"] .links-block { --justify: flex-end; }

/* ---------- Custom layout (Style → Layout) ---------- */

/* Profile pieces placed in a sidebar or the main column, away from the top. */
.profile--block { padding: 8px 0; }
html[data-avatar-pos] .profile.profile--block { display: flex; flex-direction: column; }
html[data-avatar-pos] .profile--block .avatar { width: 112px; height: 112px; margin-bottom: 20px; }

/* Several runs of text, links and the picture in one header, in the owner's order. */
.profile > .profile__links + .profile__body,
.profile > .profile__links + .profile__links:not(.profile__links--featured) { margin-top: 12px; }
.profile > .profile__body + .avatar,
.profile > .profile__links + .avatar { margin-top: 20px; }
html[data-avatar-pos="left"] .profile > .profile__body ~ .profile__body,
html[data-avatar-pos="right"] .profile > .profile__body ~ .profile__body,
html[data-avatar-pos="left"] .profile > .profile__links ~ .profile__body,
html[data-avatar-pos="right"] .profile > .profile__links ~ .profile__body { grid-column: 1 / -1; }
.page--arranged .profile__links:first-child { margin-top: 0; }
.page--arranged .profile__body > .badges:not(:first-child) { margin-top: 10px; }

/* Sidebar */
html[data-cols="left"],
html[data-cols="right"] { --width: 1040px; --side: 300px; }
html[data-cols="left"][data-width="narrow"],
html[data-cols="right"][data-width="narrow"] { --width: 880px; }
html[data-cols="left"][data-width="wide"],
html[data-cols="right"][data-width="wide"] { --width: 1240px; }
html[data-side-w="narrow"] { --side: 240px; }
html[data-side-w="wide"] { --side: 380px; }

.cols { display: grid; gap: var(--gap, 16px) 28px; align-items: start; }
.cols--left { grid-template-columns: var(--side) minmax(0, 1fr); }
.cols--right { grid-template-columns: minmax(0, 1fr) var(--side); }
.side,
.main { display: flex; flex-direction: column; gap: var(--gap, 16px); min-width: 0; }
html[data-sticky="on"] .side { position: sticky; top: 24px; }
.side .display { font-size: clamp(30px, 3.4vw, 42px); }
.side .profile__tag { font-size: 18px; line-height: 24px; }
.side .profile__links .btn--featured,
.side .profile__links { max-width: none; }
.side .sections { display: flex; flex-direction: column; }

@media (max-width: 820px) {
    .cols--left,
    .cols--right { grid-template-columns: minmax(0, 1fr); }
    html[data-sticky="on"] .side { position: static; }
}

/* Sections side by side on wider screens */
html[data-sections="columns"] .sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    align-items: start;
}

html[data-text="center"] .section { text-align: center; }
html[data-text="center"] .chips { justify-content: center; }
html[data-text="center"] .list__item { justify-content: center; text-align: left; }

/* ---------- Motion ---------- */

html { --speed: 1; }
html[data-speed="slow"] { --speed: 1.7; }
html[data-speed="fast"] { --speed: 0.55; }

.fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }

@media (prefers-reduced-motion: no-preference) {

    /* Entrances */
    html:not([data-enter="none"]) .profile,
    html:not([data-enter="none"]) .section,
    html:not([data-enter="none"]) .links-block {
        animation: var(--enter-name, enter-rise) calc(650ms * var(--speed)) cubic-bezier(0.05, 0.7, 0.1, 1) both;
        animation-delay: calc((var(--i, -1) + 1) * 70ms * var(--speed));
    }
    html:not([data-enter="none"]) .links-block { animation-delay: calc(300ms * var(--speed)); }

    html[data-enter="fade"] { --enter-name: enter-fade; }
    html[data-enter="zoom"] { --enter-name: enter-zoom; }
    html[data-enter="slide"] { --enter-name: enter-slide; }
    html[data-enter="blur"] { --enter-name: enter-blur; }

    @keyframes enter-rise { from { opacity: 0; transform: translateY(18px); } }
    @keyframes enter-fade { from { opacity: 0; } }
    @keyframes enter-zoom { from { opacity: 0; transform: scale(0.92); } }
    @keyframes enter-slide { from { opacity: 0; transform: translateX(-28px); } }
    @keyframes enter-blur { from { opacity: 0; filter: blur(12px); transform: scale(1.02); } }

    /* Profile picture */
    html[data-avatar-anim="float"] .avatar { animation: av-float calc(4s * var(--speed)) ease-in-out infinite; }
    html[data-avatar-anim="pulse"] .avatar { animation: av-pulse calc(2.4s * var(--speed)) ease-in-out infinite; }
    html[data-avatar-anim="glow"] .avatar { animation: av-glow calc(2.8s * var(--speed)) ease-in-out infinite; }
    html[data-avatar-anim="bounce"] .avatar { animation: av-bounce calc(2.2s * var(--speed)) cubic-bezier(0.3, 0, 0.3, 1) infinite; }
    html[data-avatar-anim="spin"] .avatar { transition: transform calc(900ms * var(--speed)) cubic-bezier(0.3, 0.7, 0.2, 1); }
    html[data-avatar-anim="spin"] .avatar:hover { transform: rotate(360deg); }

    @keyframes av-float { 50% { transform: translateY(-8px); } }
    @keyframes av-pulse { 50% { transform: scale(1.06); } }
    @keyframes av-glow {
        0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--glow, var(--accent)) 50%, transparent), var(--avatar-shadow, var(--shadow-1)); }
        50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--glow, var(--accent)) 0%, transparent), 0 0 46px color-mix(in srgb, var(--glow, var(--accent)) 55%, transparent); }
    }
    @keyframes av-bounce {
        0%, 60%, 100% { transform: translateY(0); }
        30% { transform: translateY(-14px); }
        45% { transform: translateY(0) scale(1.04, 0.96); }
    }

    /* Name */
    html[data-name-anim="shimmer"] .display {
        background: linear-gradient(100deg, var(--text) 35%, var(--accent) 50%, var(--text) 65%) 0 0 / 250% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: name-shimmer calc(3.2s * var(--speed)) linear infinite;
    }
    html[data-name-anim="rainbow"] .display {
        background: linear-gradient(90deg, #ff5f6d, #ffc371, #f9f871, #5efc8d, #4facfe, #b16cea, #ff5f6d) 0 0 / 300% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: name-shimmer calc(6s * var(--speed)) linear infinite;
    }
    html[data-name-anim="glow"] .display { animation: name-glow calc(2.6s * var(--speed)) ease-in-out infinite; }
    html[data-name-anim="wave"] .wave {
        display: inline-block;
        animation: name-wave calc(1.8s * var(--speed)) ease-in-out infinite;
        animation-delay: calc(var(--i) * 70ms);
    }

    @keyframes name-shimmer { to { background-position: -250% 0; } }
    @keyframes name-glow {
        50% { text-shadow: 0 0 18px color-mix(in srgb, var(--glow, var(--accent)) 70%, transparent), 0 0 40px color-mix(in srgb, var(--glow, var(--accent)) 35%, transparent); }
    }
    @keyframes name-wave { 0%, 40%, 100% { transform: translateY(0); } 20% { transform: translateY(-0.18em); } }

    /* Background */
    html[data-bg-anim="aurora"] .fx::before,
    html[data-bg-anim="aurora"] .fx::after {
        content: "";
        position: absolute;
        width: 70vmax;
        height: 70vmax;
        border-radius: 50%;
        filter: blur(70px);
        opacity: 0.35;
        background: radial-gradient(circle, var(--glow, var(--accent)), transparent 65%);
        animation: fx-drift calc(18s * var(--speed)) ease-in-out infinite alternate;
    }
    html[data-bg-anim="aurora"] .fx::before { top: -30vmax; left: -20vmax; }
    html[data-bg-anim="aurora"] .fx::after {
        bottom: -35vmax;
        right: -25vmax;
        background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--accent)) 50%, #38bdf8), transparent 65%);
        animation-duration: calc(24s * var(--speed));
        animation-direction: alternate-reverse;
    }

    html[data-bg-anim="stars"] .fx::before,
    html[data-bg-anim="stars"] .fx::after {
        content: "";
        position: absolute;
        inset: -50%;
        background-image:
            radial-gradient(1.5px 1.5px at 20px 30px, var(--text), transparent),
            radial-gradient(1px 1px at 90px 120px, var(--text), transparent),
            radial-gradient(1.5px 1.5px at 160px 60px, var(--text), transparent),
            radial-gradient(1px 1px at 230px 190px, var(--text), transparent),
            radial-gradient(1px 1px at 300px 90px, var(--text), transparent);
        background-size: 320px 240px;
        opacity: 0.4;
        animation: fx-twinkle calc(4s * var(--speed)) ease-in-out infinite, fx-rise calc(90s * var(--speed)) linear infinite;
    }
    html[data-bg-anim="stars"] .fx::after {
        background-size: 210px 170px;
        opacity: 0.25;
        animation-delay: calc(-2s * var(--speed)), 0s;
        animation-duration: calc(5s * var(--speed)), calc(140s * var(--speed));
    }

    html[data-bg-anim="pulse"] .fx {
        background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--glow, var(--accent)) 30%, transparent), transparent 65%);
        animation: fx-breathe calc(6s * var(--speed)) ease-in-out infinite;
    }

    html[data-bg-anim="drift"] .fx {
        inset: -20%;
        background:
            radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 35%),
            radial-gradient(circle at 70% 60%, color-mix(in srgb, var(--glow, var(--accent)) 18%, transparent), transparent 35%),
            radial-gradient(circle at 40% 80%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 30%);
        animation: fx-spin calc(60s * var(--speed)) linear infinite;
    }

    @keyframes fx-drift { to { transform: translate(25vmax, 15vmax) scale(1.2); } }
    @keyframes fx-twinkle { 50% { opacity: 0.12; } }
    @keyframes fx-rise { to { transform: translateY(-240px); } }
    @keyframes fx-breathe { 50% { opacity: 0.35; } }
    @keyframes fx-spin { to { transform: rotate(360deg); } }

    /* Hover on buttons and cards */
    html[data-hover="lift"] .btn:hover,
    html[data-hover="lift"] .project--link:hover { transform: translateY(-3px); }
    html[data-hover="grow"] .btn:hover,
    html[data-hover="grow"] .project--link:hover { transform: scale(1.045); }
    html[data-hover="glow"] .btn:hover,
    html[data-hover="glow"] .project--link:hover { box-shadow: 0 0 0 1px var(--glow, var(--accent)), 0 0 28px color-mix(in srgb, var(--glow, var(--accent)) 55%, transparent); }
    html[data-hover="tilt"] .btn:hover { transform: rotate(-2deg) scale(1.03); }
    html[data-hover="tilt"] .project--link:hover { transform: perspective(600px) rotateX(4deg) rotateY(-4deg) translateY(-2px); }
    html[data-hover="none"] .btn:hover,
    html[data-hover="none"] .project--link:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    html[data-theme="terminal"] .display::after { animation: none; }
}

html[data-motion="off"][data-theme="terminal"] .display::after { animation: none; }

/* ---------- Badge tooltips (icon-only badges) ---------- */

.pbadge[data-tip] { position: relative; outline: none; }

.pbadge[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 10;
    padding: 5px 10px;
    border-radius: 8px;
    background: #111;
    color: #fff;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.pbadge[data-tip]::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    z-index: 10;
    border: 5px solid transparent;
    border-top-color: #111;
    border-bottom: 0;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.pbadge[data-tip]:hover::after,
.pbadge[data-tip]:focus-visible::after,
.pbadge[data-tip]:hover::before,
.pbadge[data-tip]:focus-visible::before { opacity: 1; transform: translate(-50%, 0); }

.pbadge[data-tip]:focus-visible { box-shadow: 0 0 0 2px var(--badge); }

/* ---------- Perks (exclusive effects, unlocked by admins) ---------- */

html[data-perks~="gold"] .display {
    background: linear-gradient(100deg, #b8860b 0%, #ffd700 25%, #fff6c8 40%, #ffd700 55%, #b8860b 80%) 0 0 / 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 10px rgba(255, 200, 0, 0.35));
}

/* A rainbow ring drawn with a mask, so it follows any shape; the colours turn via --perk-a. */
@property --perk-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

html[data-perks~="halo"] .avatar { position: relative; overflow: visible; }
html[data-perks~="halo"] .avatar img { border-radius: inherit; }
html[data-perks~="rainbow"] .section { position: relative; }

html[data-perks~="halo"] .avatar::before,
html[data-perks~="rainbow"] .section::before {
    content: "";
    position: absolute;
    inset: -7px;
    padding: 4px;
    border-radius: inherit;
    background: conic-gradient(from var(--perk-a), #ff5f6d, #ffc371, #f9f871, #5efc8d, #4facfe, #b16cea, #ff5f6d);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
}

html[data-perks~="halo"][data-avatar="rounded"] .avatar::before { border-radius: 32%; }
html[data-perks~="rainbow"] .section::before { inset: -1px; padding: 2px; }

html[data-perks~="sparkles"] .profile__name { position: relative; }
html[data-perks~="sparkles"] .profile__name::before,
html[data-perks~="sparkles"] .profile__name::after {
    content: "✦";
    position: absolute;
    font-size: 18px;
    line-height: 1;
    color: #ffe27a;
    text-shadow: 0 0 10px rgba(255, 226, 122, 0.9);
    pointer-events: none;
}
html[data-perks~="sparkles"] .profile__name::before { top: -6px; left: -18px; }
html[data-perks~="sparkles"] .profile__name::after { bottom: -2px; right: -16px; font-size: 13px; }

.snow { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.snow i {
    position: absolute;
    inset: -100% 0 0;
    background-image:
        radial-gradient(3px 3px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 120px 80px, #fff, transparent),
        radial-gradient(3px 3px at 200px 160px, #fff, transparent),
        radial-gradient(2px 2px at 60px 200px, #fff, transparent),
        radial-gradient(2.5px 2.5px at 260px 240px, #fff, transparent);
    background-size: 300px 300px;
    opacity: 0.55;
}
.snow i:nth-child(2) { background-size: 220px 220px; opacity: 0.4; }
.snow i:nth-child(3) { background-size: 380px 380px; opacity: 0.3; }

.cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 0;
    width: 340px;
    height: 340px;
    margin: -170px 0 0 -170px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--accent)) 30%, transparent), transparent 65%);
    pointer-events: none;
    transition: opacity 300ms ease;
}

@media (prefers-reduced-motion: no-preference) {
    html[data-perks~="gold"] .display { animation: name-shimmer 4s linear infinite; }
    html[data-perks~="halo"] .avatar::before { animation: perk-turn 4s linear infinite; }
    html[data-perks~="rainbow"] .section::before { animation: perk-turn 8s linear infinite; }
    html[data-perks~="sparkles"] .profile__name::before { animation: perk-twinkle 1.8s ease-in-out infinite; }
    html[data-perks~="sparkles"] .profile__name::after { animation: perk-twinkle 1.8s ease-in-out 0.9s infinite; }
    .snow i { animation: perk-snow 14s linear infinite; }
    .snow i:nth-child(2) { animation-duration: 20s; }
    .snow i:nth-child(3) { animation-duration: 28s; }

    @keyframes perk-turn { to { --perk-a: 360deg; } }
    @keyframes perk-twinkle { 0%, 100% { opacity: 0.2; transform: scale(0.6) rotate(0deg); } 50% { opacity: 1; transform: scale(1.1) rotate(90deg); } }
    @keyframes perk-snow { to { transform: translateY(50%); } }
}

/* ---------- More effects: confetti, neon (unlockable); crown, glitch, aura, spotlight (admins) ---------- */

html[data-perks~="neon"] .display {
    color: #fff;
    text-shadow: 0 0 4px #fff, 0 0 12px var(--glow, var(--accent)), 0 0 28px var(--glow, var(--accent)), 0 0 52px var(--glow, var(--accent));
}

.crown {
    position: absolute;
    top: -0.55em;
    left: -0.2em;
    font-size: 30px;
    line-height: 1;
    transform: rotate(-22deg);
    background: linear-gradient(180deg, #fff6c8, #ffd700 45%, #b8860b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 3px 6px rgba(184, 134, 11, 0.55));
    pointer-events: none;
}
html[data-perks~="crown"] .profile__name { position: relative; }

html[data-perks~="glitch"] .display { position: relative; }
html[data-perks~="glitch"] .display::before,
html[data-perks~="glitch"] .display::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}
html[data-perks~="glitch"] .display::before { color: #ff2a6d; transform: translate(-3px, 0); }
html[data-perks~="glitch"] .display::after { color: #05d9e8; transform: translate(3px, 0); }

html[data-perks~="aura"] .profile { position: relative; }
html[data-perks~="aura"] .profile::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 40%;
    z-index: -1;
    width: min(560px, 120%);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--glow, var(--accent)) 45%, transparent), transparent 62%);
    transform: translate(-50%, -50%);
    filter: blur(10px);
    pointer-events: none;
}
html[data-avatar-pos="left"][data-perks~="aura"] .profile::before { left: 20%; }
html[data-avatar-pos="right"][data-perks~="aura"] .profile::before { left: 80%; }

.spotlight { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.spotlight i {
    position: absolute;
    top: -20%;
    left: 15%;
    width: 38vmax;
    height: 140vh;
    background: linear-gradient(180deg, color-mix(in srgb, var(--glow, var(--accent)) 30%, transparent), transparent 85%);
    clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
    transform-origin: 50% 0;
    transform: rotate(-18deg);
    filter: blur(6px);
}
.spotlight i:nth-child(2) { left: auto; right: 15%; transform: rotate(18deg); }

.confetti { position: fixed; inset: 0; z-index: 20; overflow: hidden; pointer-events: none; }
.confetti i {
    position: absolute;
    top: -20px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    background: #ff5f6d;
}
.confetti i:nth-child(4n + 1) { background: #ffc371; }
.confetti i:nth-child(4n + 2) { background: #5efc8d; width: 7px; height: 7px; border-radius: 50%; }
.confetti i:nth-child(4n + 3) { background: #4facfe; }
.confetti i:nth-child(5n) { background: #b16cea; }
.confetti i:nth-child(1) { left: 4%; --d: 0.0s; --x: 30px; }
.confetti i:nth-child(2) { left: 9%; --d: 0.2s; --x: -40px; }
.confetti i:nth-child(3) { left: 14%; --d: 0.1s; --x: 60px; }
.confetti i:nth-child(4) { left: 19%; --d: 0.35s; --x: -20px; }
.confetti i:nth-child(5) { left: 24%; --d: 0.05s; --x: 45px; }
.confetti i:nth-child(6) { left: 29%; --d: 0.25s; --x: -55px; }
.confetti i:nth-child(7) { left: 34%; --d: 0.15s; --x: 25px; }
.confetti i:nth-child(8) { left: 39%; --d: 0.4s; --x: -35px; }
.confetti i:nth-child(9) { left: 44%; --d: 0.0s; --x: 50px; }
.confetti i:nth-child(10) { left: 49%; --d: 0.3s; --x: -45px; }
.confetti i:nth-child(11) { left: 54%; --d: 0.12s; --x: 35px; }
.confetti i:nth-child(12) { left: 59%; --d: 0.22s; --x: -25px; }
.confetti i:nth-child(13) { left: 64%; --d: 0.05s; --x: 55px; }
.confetti i:nth-child(14) { left: 69%; --d: 0.32s; --x: -50px; }
.confetti i:nth-child(15) { left: 74%; --d: 0.18s; --x: 20px; }
.confetti i:nth-child(16) { left: 79%; --d: 0.08s; --x: -30px; }
.confetti i:nth-child(17) { left: 84%; --d: 0.28s; --x: 40px; }
.confetti i:nth-child(18) { left: 89%; --d: 0.14s; --x: -60px; }
.confetti i:nth-child(19) { left: 94%; --d: 0.36s; --x: 30px; }
.confetti i:nth-child(20) { left: 7%; --d: 0.5s; --x: 20px; }
.confetti i:nth-child(21) { left: 31%; --d: 0.55s; --x: -20px; }
.confetti i:nth-child(22) { left: 52%; --d: 0.45s; --x: 25px; }
.confetti i:nth-child(23) { left: 71%; --d: 0.6s; --x: -15px; }
.confetti i:nth-child(24) { left: 92%; --d: 0.52s; --x: 10px; }

@media (prefers-reduced-motion: no-preference) {
    html[data-perks~="neon"] .display { animation: perk-flicker 5s linear infinite; }
    html[data-perks~="glitch"] .display::before { animation: perk-glitch 4s steps(1) infinite; }
    html[data-perks~="glitch"] .display::after { animation: perk-glitch 4s steps(1) 0.06s infinite reverse; }
    html[data-perks~="aura"] .profile::before { animation: perk-aura 4s ease-in-out infinite; }
    .spotlight i { animation: perk-sweep 7s ease-in-out infinite alternate; }
    .spotlight i:nth-child(2) { animation-name: perk-sweep2; animation-duration: 8s; }
    .crown { animation: perk-crown 3s ease-in-out infinite; }
    .confetti i { animation: perk-confetti 2.6s cubic-bezier(0.25, 0.6, 0.4, 1) var(--d) 1 forwards; }

    @keyframes perk-flicker { 0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; } 20%, 24%, 55% { opacity: 0.55; } }
    @keyframes perk-glitch {
        0%, 86%, 100% { opacity: 0; clip-path: inset(0 0 0 0); }
        88% { opacity: 0.85; clip-path: inset(10% 0 55% 0); }
        91% { opacity: 0.85; clip-path: inset(60% 0 8% 0); }
        94% { opacity: 0.85; clip-path: inset(30% 0 40% 0); }
    }
    @keyframes perk-aura { 50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.65; } }
    @keyframes perk-sweep { from { transform: rotate(-30deg); } to { transform: rotate(12deg); } }
    @keyframes perk-sweep2 { from { transform: rotate(30deg); } to { transform: rotate(-12deg); } }
    @keyframes perk-crown { 50% { transform: rotate(-16deg) translateY(-3px); } }
    @keyframes perk-confetti {
        0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
        100% { opacity: 0; transform: translate(var(--x), 105vh) rotate(720deg); }
    }
}

@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

@media (max-width: 480px) {
    .section,
    html[data-theme="glass"] .section,
    html[data-theme="paper"] .section,
    html[data-theme="pastel"] .section { padding: 18px; }

    html[data-theme="minimal"] .section,
    html[data-cards="flat"] .section { padding-left: 0; padding-right: 0; }

    .profile__tag { font-size: 19px; line-height: 26px; }

    html[data-avatar-pos="left"] .profile,
    html[data-avatar-pos="right"] .profile { column-gap: 16px; }
    html[data-avatar-pos="left"] .avatar,
    html[data-avatar-pos="right"] .avatar { width: 80px; height: 80px; }
    html[data-avatar-pos="left"] .avatar--letter,
    html[data-avatar-pos="right"] .avatar--letter { font-size: 34px; }
}

/* ---------- Background video ---------- */

.bg-video {
    position: fixed;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* ---------- Enter screen ---------- */
/* Covers the page until the visitor clicks. page.js fades it away and starts the opening animations.
   The owner's choices arrive as --gate-* variables and data-* attributes from lib/render.js. */

.gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    justify-items: center;
    align-items: center;
    padding: 12vh 24px;
    background: var(--gate-bg, rgba(0, 0, 0, 0.55));
    -webkit-backdrop-filter: blur(var(--gate-blur, 22px)) saturate(140%);
    backdrop-filter: blur(var(--gate-blur, 22px)) saturate(140%);
    color: var(--gate-color, #fff);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition-property: opacity, transform, filter, -webkit-backdrop-filter, backdrop-filter, background;
    transition-duration: var(--gate-dur, 900ms);
    transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gate[data-image] {
    background: linear-gradient(var(--gate-bg), var(--gate-bg)), var(--gate-image) center / cover no-repeat;
}

.gate[data-pos="top"] { align-items: start; }
.gate[data-pos="bottom"] { align-items: end; }
.gate:focus-visible { outline: none; }

.gate__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    transition: inherit;
}

.gate__pic {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.gate__pic--letter {
    display: grid;
    place-items: center;
    background: var(--accent, #fff);
    color: var(--on-accent, #000);
    font-family: var(--heading-font, var(--font));
    font-size: 2.2rem;
    font-weight: 700;
}

.gate__text {
    font-family: var(--gate-font, var(--heading-font, var(--font)));
    font-size: var(--gate-size, 1.5rem);
    font-weight: var(--gate-weight, 500);
    letter-spacing: var(--gate-spacing, 0.32em);
    line-height: 1.2;
    text-shadow: 0 0 24px color-mix(in srgb, var(--gate-color, #fff) 35%, transparent);
}

.gate[data-case="lower"] .gate__text { text-transform: lowercase; }
.gate[data-case="upper"] .gate__text { text-transform: uppercase; }

.gate__sub {
    font-family: var(--gate-font, var(--font));
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* Leaving */
.gate--out { opacity: 0; pointer-events: none; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
.gate--out[data-exit="zoom"] .gate__inner { transform: scale(1.35); }
.gate--out[data-exit="zoom"] { transform: scale(1.06); }
.gate--out[data-exit="blur"] { filter: blur(18px); }
.gate--out[data-exit="up"] { transform: translateY(-100%); opacity: 1; }
.gate--out[data-exit="down"] { transform: translateY(100%); opacity: 1; }

html[data-gate="on"] body { overflow: hidden; }
html[data-gate="on"].entered body { overflow: visible; }

@media (prefers-reduced-motion: no-preference) {
    .gate[data-anim="breathe"] .gate__text { animation: gate-breathe 2.6s ease-in-out infinite; }
    .gate[data-anim="pulse"] .gate__text { animation: gate-pulse 1.8s ease-in-out infinite; }
    .gate[data-anim="glow"] .gate__text { animation: gate-glow 2.2s ease-in-out infinite; }
    .gate[data-anim="flicker"] .gate__text { animation: gate-flicker 3.2s linear infinite; }
    .gate[data-anim="float"] .gate__inner { animation: gate-float 3.4s ease-in-out infinite; }
    .gate--out .gate__text, .gate--out .gate__inner { animation: none !important; }

    @keyframes gate-breathe { 50% { opacity: 0.5; } }
    @keyframes gate-pulse { 50% { transform: scale(1.07); } }
    @keyframes gate-glow { 50% { text-shadow: 0 0 6px var(--gate-color, #fff), 0 0 26px var(--gate-color, #fff), 0 0 52px var(--gate-color, #fff); } }
    @keyframes gate-flicker { 0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; } 20%, 24%, 55% { opacity: 0.25; } }
    @keyframes gate-float { 50% { transform: translateY(-10px); } }

    /* Hold the opening animations until the visitor goes in. */
    html[data-gate="on"]:not(.entered) .profile,
    html[data-gate="on"]:not(.entered) .section,
    html[data-gate="on"]:not(.entered) .links-block {
        animation-play-state: paused;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gate { transition-duration: 200ms; }
    .gate--out { transform: none !important; opacity: 0 !important; }
}
