/* ==========================================================
   IN THE MAKING. — Aanshi Dangi

   01 Tokens            09 Skills
   02 Base              10 Projects (orbit)
   03 Typography        11 Journey
   04 Layout            12 Beyond work
   05 Motion primitives 13 Contact
   06 Header & nav      14 Footer
   07 Hero              15 Cursor
   08 About             16 Accessibility & reduced motion

   Motion states are only hidden when <html> has the .motion
   class, which the inline script in index.html sets (and
   removes again if script.js fails to load).
   ========================================================== */


/* ==========================================================
   01 TOKENS
   ========================================================== */

:root {
    /* Brand palette */
    --ivory: #F2EEE7;
    --soft-black: #282522;
    --dusty-plum: #78677F;
    --champagne: #B7A58B;

    /* Semantic tokens (light) */
    --bg: var(--ivory);
    --text: var(--soft-black);
    --label: #66566D;               /* darker plum: passes AA for small text */
    --accent: var(--dusty-plum);
    --accent-soft: var(--champagne);
    --line: rgba(40, 37, 34, 0.16);
    --surface: rgba(255, 255, 255, 0.38);
    --header-bg: rgba(242, 238, 231, 0.92);

    /* Closing contact panel */
    --panel-bg: var(--soft-black);
    --panel-text: var(--ivory);
    --panel-label: var(--champagne);
    --panel-line: rgba(242, 238, 231, 0.26);

    /* Orbit */
    --center-bg: var(--dusty-plum);
    --center-fg: var(--ivory);
    --planet-3-bg: #DED5CC;
    --planet-3-fg: var(--soft-black);

    /* Type */
    --font: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;

    /* Motion */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    /* Layout */
    --header-h: 72px;
    --pad-x: clamp(1.25rem, 6vw, 5rem);
    --gutter: max(var(--pad-x), calc((100% - 1320px) / 2));
    --section-y: clamp(5rem, 11vw, 9.5rem);

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: var(--soft-black);
    --text: var(--ivory);
    --label: var(--champagne);
    --accent: var(--champagne);
    --accent-soft: var(--dusty-plum);
    --line: rgba(242, 238, 231, 0.16);
    --surface: rgba(242, 238, 231, 0.04);
    --header-bg: rgba(40, 37, 34, 0.92);

    --panel-bg: #40393E;            /* soft black pulled toward plum */
    --planet-3-bg: #4B443C;
    --planet-3-fg: var(--ivory);

    color-scheme: dark;
}


/* ==========================================================
   02 BASE
   ========================================================== */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h);
    -webkit-text-size-adjust: 100%;
}

html.menu-open {
    overflow: hidden;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.4s ease, color 0.4s ease;
}

@supports not (overflow: clip) {
    body { overflow-x: hidden; }
}

h1, h2, h3, p, ul, ol {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
}

main:focus {
    outline: none;
}


/* ==========================================================
   03 TYPOGRAPHY
   ========================================================== */

.eyebrow {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--label);
}

/* Section headlines */
.display {
    font-size: clamp(2.75rem, 7.4vw, 6.25rem);
    font-weight: 600;
    font-stretch: 84%;
    line-height: 0.98;
    letter-spacing: -0.035em;
}

.section-intro {
    max-width: 34rem;
}


/* ==========================================================
   04 LAYOUT
   ========================================================== */

.section {
    padding: var(--section-y) var(--gutter);
}

.section-head {
    display: grid;
    gap: 1.25rem;
    max-width: 52rem;
    margin-bottom: clamp(2.5rem, 6vw, 5rem);
}


/* ==========================================================
   05 MOTION PRIMITIVES
   Two systems:
   [data-scrub]  scroll-linked. script.js writes three numbers on
                 each element: --e (entering, 0-1), --o (leaving,
                 0-1) and --sp (progress through the viewport).
   [data-reveal] time-based; used only by the contact scene.
   ========================================================== */

.motion [data-scrub] {
    --e: 0;
    --o: 0;
    --sp: 0;
}

/* Small items and labels */
.motion [data-scrub="rise"] {
    opacity: calc(var(--e) * (1 - var(--o) * 0.8));
    transform: translate3d(0, calc((1 - var(--e)) * 44px - var(--o) * 30px), 0);
}

/* Paragraphs: rise and pull into focus */
.motion [data-scrub="focus"] {
    opacity: calc(var(--e) * (1 - var(--o) * 0.8));
    transform: translate3d(0, calc((1 - var(--e)) * 40px - var(--o) * 28px), 0);
    filter: blur(calc((1 - var(--e)) * 7px));
}

/* Headlines: slide up out of a mask, and back out through the top */
.motion [data-scrub="mask"],
.motion [data-reveal="mask"] {
    overflow: clip;
    padding-bottom: 0.14em;
    margin-bottom: -0.14em;
}

.motion [data-scrub="mask"] > span {
    display: block;
    transform: translate3d(0, calc((1 - var(--e)) * 112% - var(--o) * 30%), 0);
}

/* Skill cards: fly in from alternating sides with a turn */
.motion [data-scrub="card"] {
    opacity: calc(var(--e) * (1 - var(--o) * 0.7));
    transform:
        translate3d(calc((1 - var(--e)) * var(--cx, -60px)), calc((1 - var(--e)) * 110px - var(--o) * 36px), 0)
        rotate(calc((1 - var(--e)) * var(--cr, -5deg)))
        scale(calc(0.88 + var(--e) * 0.12));
}

/* List rows: slide in from the left while their rule draws */
.motion [data-scrub="row"] {
    opacity: calc(var(--e) * (1 - var(--o) * 0.7));
    transform: translate3d(calc((1 - var(--e)) * -56px), calc(var(--o) * -24px), 0);
}

/* Orbit diagram: grows into place */
.motion [data-scrub="orbit"] {
    opacity: calc(var(--e) * (1 - var(--o) * 0.6));
    transform: scale(calc(0.8 + var(--e) * 0.2 - var(--o) * 0.06));
}

/* Decorative rings: turn with scroll position */
.motion [data-scrub="ring"] {
    opacity: calc(var(--e) * (1 - var(--o) * 0.6));
    transform: rotate(calc(var(--sp) * 160deg)) scale(calc(0.6 + var(--e) * 0.4));
}

/* Circular badges: scale up (no rotation, they hold text) */
.motion [data-scrub="pop"] {
    opacity: var(--e);
    transform: scale(calc(0.6 + var(--e) * 0.4));
}

/* Gentle depth: columns drift at different speeds */
.motion [data-parallax] {
    translate: 0 var(--py, 0px);
}

/* Contact scene (time-based, triggered by script.js) */
.motion [data-reveal] {
    --d: 0ms;
    transition-property: opacity, transform;
    transition-duration: 1s, 1.2s;
    transition-timing-function: var(--ease);
    transition-delay: var(--d), var(--d);
}

.motion [data-reveal="rise"] {
    opacity: 0;
    transform: translate3d(0, 26px, 0);
}

.motion [data-reveal="mask"] > span {
    display: block;
    transform: translate3d(0, 112%, 0);
    transition: transform 1.2s var(--ease) var(--d);
}

.motion [data-reveal].is-in {
    opacity: 1;
    transform: none;
}

.motion [data-reveal="mask"].is-in > span {
    transform: none;
}


/* ==========================================================
   06 HEADER & NAVIGATION
   ========================================================== */

.skip-link {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 10000;
    padding: 0.6rem 1rem;
    background: var(--text);
    color: var(--bg);
    font-size: 0.875rem;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    padding-inline: var(--gutter);
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.site-header.is-scrolled {
    background-color: var(--header-bg);
    box-shadow: 0 1px 0 var(--line);
}

.scroll-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    pointer-events: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
}

/* Brand + monogram */
.brand {
    order: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    font-size: 1.0625rem;
    font-weight: 600;
    font-stretch: 90%;
    letter-spacing: -0.02em;
}

.monogram {
    width: 34px;
    height: 34px;
    overflow: visible;
}

.monogram-ring {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.2;
}

.monogram-a {
    fill: none;
    stroke: var(--text);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.monogram-dot {
    fill: var(--accent);
}

.monogram-orbit {
    transform-origin: 16px 16px;
    animation: monogram-orbit 18s linear infinite;
}

@keyframes monogram-orbit {
    to { transform: rotate(360deg); }
}

/* Desktop links */
.nav-links {
    order: 2;
    display: flex;
    gap: clamp(0.875rem, 2vw, 1.75rem);
    margin-left: auto;
}

.nav-links a {
    position: relative;
    display: inline-block;
    padding: 0.4rem 0;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.nav-links a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0.15rem;
    left: 0;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s var(--ease);
}

.nav-links a:hover::after,
.nav-links a[aria-current="true"]::after {
    transform: scaleX(1);
}

/* Actions */
.nav-actions {
    order: 3;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.theme-toggle {
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-soft);
    border-radius: 999px;
    background: transparent;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
    border-color: var(--accent);
    background-color: var(--accent);
    color: var(--bg);
}

/* Mobile menu button: the orbit icon from the original build */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.orbit-icon {
    position: relative;
    width: 24px;
    height: 24px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    transform: rotate(-35deg);
    transition: transform 0.5s var(--ease);
}

.orbit-icon::before {
    content: "";
    position: absolute;
    top: 6px;
    left: -4px;
    width: 30px;
    height: 10px;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
}

.orbit-icon span {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

.orbit-icon span:nth-child(1) { top: 2px; left: 8px; }
.orbit-icon span:nth-child(2) { top: 8px; right: 2px; }
.orbit-icon span:nth-child(3) { bottom: 2px; left: 8px; }
.orbit-icon span:nth-child(4) { top: 8px; left: 2px; }

.menu-toggle.active .orbit-icon {
    transform: rotate(55deg);
}

/* Tablet and mobile: links become a full-screen orbital overlay */
@media (max-width: 900px) {
    :root {
        --header-h: 64px;
    }

    .brand,
    .nav-actions {
        position: relative;
        z-index: 3;
    }

    .nav-actions {
        margin-left: auto;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .nav-links {
        position: fixed;
        inset: 0;
        z-index: 2;
        flex-direction: column;
        justify-content: center;
        gap: 0.15rem;
        margin: 0;
        padding: calc(var(--header-h) + 1rem) var(--gutter) 3rem;
        overflow: hidden;
        background: var(--bg);
        visibility: hidden;
        clip-path: circle(0 at calc(100% - var(--gutter) - 22px) calc(var(--header-h) / 2));
        transition: clip-path 0.7s var(--ease-in-out), visibility 0s linear 0.7s;
    }

    .nav-links.is-open {
        visibility: visible;
        clip-path: circle(150% at calc(100% - var(--gutter) - 22px) calc(var(--header-h) / 2));
        transition: clip-path 0.85s var(--ease-in-out), visibility 0s;
    }

    /* Decorative orbit rings behind the links */
    .nav-links::before,
    .nav-links::after {
        content: "";
        position: absolute;
        border: 1px solid var(--accent-soft);
        border-radius: 50%;
        pointer-events: none;
    }

    .nav-links::before {
        right: -70vw;
        bottom: -48vw;
        width: 130vw;
        aspect-ratio: 1;
    }

    .nav-links::after {
        right: -20vw;
        bottom: 6vh;
        width: 90vw;
        height: 34vw;
        transform: rotate(-35deg);
    }

    .nav-links li {
        position: relative;
        z-index: 1;
        overflow: hidden;
    }

    .nav-links a {
        padding: 0.1rem 0;
        font-size: clamp(2.2rem, 10vw, 3.6rem);
        font-weight: 600;
        font-stretch: 82%;
        line-height: 1.15;
        letter-spacing: -0.03em;
        transform: translate3d(0, 115%, 0);
        transition: transform 0.5s var(--ease), color 0.3s ease;
    }

    .nav-links.is-open a {
        transform: none;
        transition: transform 0.9s var(--ease) calc(0.2s + var(--i) * 0.055s), color 0.3s ease;
    }

    .nav-links a::after {
        display: none;
    }

    .nav-links a[aria-current="true"] {
        color: var(--accent);
    }
}


/* ==========================================================
   07 HERO
   ========================================================== */

.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - var(--header-h));
    padding: 1.5rem var(--gutter) clamp(2.5rem, 6vw, 4.5rem);
    overflow-x: clip;
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
}

.hero-main {
    margin-top: auto;
}

.hero-title {
    font-size: clamp(3.6rem, 17vw, 16rem);
    font-weight: 600;
    font-stretch: 78%;
    line-height: 0.88;
    letter-spacing: -0.045em;
}

.hero-title .line {
    display: block;
}

.hero-title .word {
    display: inline-block;
    overflow: clip;
    padding: 0.06em 0.04em 0.1em 0;
    margin: -0.06em -0.04em -0.1em 0;
    vertical-align: top;
}

.hero-title .word > span {
    display: inline-block;
}

.hero-foot {
    position: relative;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: end;
    margin-top: clamp(1.5rem, 4vw, 3rem);
    padding-top: 1.5rem;
}

.hero-foot::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 1px;
    background: var(--line);
    transform-origin: left;
}

.hero-name {
    display: block;
    overflow: clip;
    padding-bottom: 0.14em;
    margin-bottom: -0.14em;
    font-size: clamp(1.9rem, 4.4vw, 3.75rem);
    font-weight: 600;
    font-stretch: 88%;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.hero-name .chars {
    display: inline-block;
}

.hero-name .char {
    display: inline-block;
}

.hero-role {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--label);
}

.hero-tagline {
    max-width: 24rem;
    font-size: 1.0625rem;
}

/* Background orbit */
.hero-orbit {
    position: absolute;
    top: 6%;
    right: -14vw;
    width: min(72vw, 920px);
    aspect-ratio: 1;
    pointer-events: none;
    transform: translate3d(0, calc(var(--hp, 0) * 90px), 0) rotate(calc(var(--hp, 0) * 28deg));
    will-change: transform;
}

.hero-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
}

.hero-ring-circle {
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
}

.hero-ring-ellipse {
    width: 118%;
    height: 40%;
    border-color: var(--accent);
    opacity: 0.55;
    transform: translate(-50%, -50%) rotate(-24deg);
}

.hero-dot {
    position: absolute;
    top: -6px;
    left: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
}

/* Intro sequence (starts when html gets .is-ready) */
.motion .hero-title .word > span {
    transform: translate3d(0, 110%, 0);
}

.motion.is-ready .hero-title .word > span {
    transform: none;
    transition: transform 1.35s var(--ease) calc(0.2s + var(--w, 0) * 0.13s);
}

.motion .hero-name .char {
    transform: translate3d(0, 120%, 0);
}

.motion.is-ready .hero-name .char {
    transform: none;
    transition: transform 1.1s var(--ease) calc(0.85s + var(--i, 0) * 0.045s);
}

.motion [data-hero]:not([data-hero="ring"]) {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
}

.motion.is-ready [data-hero]:not([data-hero="ring"]) {
    opacity: 1;
    transform: none;
    transition: opacity 1.1s var(--ease) var(--hd, 0s), transform 1.1s var(--ease) var(--hd, 0s);
}

.motion [data-hero="ring"] {
    opacity: 0;
}

.motion.is-ready [data-hero="ring"] {
    opacity: 1;
    transition: opacity 2.2s ease 0.3s;
}

.motion .hero-foot::before {
    transform: scaleX(0);
}

.motion.is-ready .hero-foot::before {
    transform: none;
    transition: transform 1.8s var(--ease-in-out) 0.8s;
}

@media (max-width: 700px) {
    .hero-title {
        font-size: clamp(3.4rem, 19vw, 9rem);
    }

    .hero-foot {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .hero-orbit {
        top: 14%;
        right: -45vw;
        width: 130vw;
    }
}


/* ==========================================================
   08 ABOUT
   ========================================================== */

.about {
    position: relative;
    overflow-x: clip;
}

.about-ring {
    position: absolute;
    top: 6%;
    right: -16vw;
    width: min(52vw, 680px);
    aspect-ratio: 1;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
    pointer-events: none;
}

.about-ring::after {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: var(--accent);
}

.about-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(2rem, 6vw, 7rem);
    align-items: start;
}

.about .section-head {
    margin-bottom: 0;
}

.about-body {
    display: grid;
    gap: 1.5rem;
    max-width: 36rem;
    padding-top: clamp(0rem, 6vw, 5.5rem);
}

.about-lead {
    font-size: clamp(1.35rem, 2.3vw, 2rem);
    font-weight: 500;
    line-height: 1.38;
    letter-spacing: -0.02em;
}

.about-note {
    color: var(--label);
}

@media (max-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr;
    }

    .about-body {
        padding-top: 0;
    }
}


/* ==========================================================
   09 SKILLS
   ========================================================== */

.skill-deck {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
    align-items: start;
}

.skill-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2.5rem;
    min-height: 13rem;
    padding: clamp(1.25rem, 2.4vw, 1.75rem);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    transition: border-color 0.35s ease, background-color 0.35s ease;
}

.skill-card:hover {
    border-color: var(--accent);
}

/* Accent rule draws across the top as the card arrives */
.skill-card::before {
    content: "";
    position: absolute;
    top: -1px;
    right: 10px;
    left: 10px;
    height: 2px;
    background: var(--accent);
    transform: scaleX(var(--e, 0));
    transform-origin: left;
}

.motion .skill-card h3 {
    opacity: clamp(0, calc(var(--e) * 2.2 - 0.6), 1);
    transform: translate3d(0, calc((1 - var(--e)) * 26px), 0);
}

.motion .skill-card p {
    opacity: clamp(0, calc(var(--e) * 2.2 - 1.2), 1);
}

.skill-card h3 {
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    font-weight: 600;
    font-stretch: 88%;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.skill-card p {
    font-size: 0.9375rem;
    color: var(--label);
}

.skill-card:nth-child(odd) {
    --cx: -60px;
    --cr: -5deg;
}

.skill-card:nth-child(even) {
    --cx: 60px;
    --cr: 5deg;
    margin-top: clamp(2rem, 5vw, 3.5rem);
}

/* Wide screens: a staircase of four */
@media (min-width: 1101px) {
    .skill-deck {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .skill-card:nth-child(1) { margin-top: 0; }
    .skill-card:nth-child(2) { margin-top: 2.5rem; }
    .skill-card:nth-child(3) { margin-top: 5rem; }
    .skill-card:nth-child(4) { margin-top: 7.5rem; }
}

@media (max-width: 560px) {
    .skill-deck {
        grid-template-columns: 1fr;
    }

    .skill-card,
    .skill-card:nth-child(even) {
        min-height: 9.5rem;
        margin-top: 0;
    }
}


/* ==========================================================
   10 PROJECTS — IDEAS IN ORBIT
   ========================================================== */

.projects-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
}

.project-list {
    border-top: 1px solid var(--line);
}

.project-item {
    position: relative;
    display: grid;
    grid-template-columns: 2.75rem 1fr;
    gap: 1rem;
    padding: 1.5rem 0;
}

.project-item::after,
.beyond-item::before,
.beyond-item:last-child::after {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    height: 1px;
    background: var(--line);
    transform: scaleX(var(--e, 1));
    transform-origin: left;
}

.project-item::after,
.beyond-item:last-child::after {
    bottom: 0;
}

.beyond-item::before {
    top: 0;
}

/* Row contents arrive one after another */
.motion .project-index,
.motion .project-item p {
    opacity: clamp(0, calc(var(--e) * 2.2 - 1.1), 1);
}

.motion .project-item h3 {
    opacity: clamp(0, calc(var(--e) * 2.2 - 0.5), 1);
    transform: translate3d(calc((1 - var(--e)) * 36px), 0, 0);
}

/* Orbit text and rings fade in after the diagram has grown */
.motion .orbit-ring {
    opacity: clamp(0, calc(var(--e) * 2.2 - 0.2), 1);
}

.motion .orbit-center > *,
.motion .orbit-planet > * {
    opacity: clamp(0, calc(var(--e) * 2.4 - 1.2), 1);
}

.project-index {
    padding-top: 0.45rem;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    color: var(--label);
}

.project-item h3 {
    margin-bottom: 0.4rem;
    font-size: 1.5rem;
    font-weight: 600;
    font-stretch: 90%;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.project-item p {
    max-width: 38ch;
    font-size: 0.9375rem;
    color: var(--label);
}

.orbit-stage {
    position: relative;
}

.orbit-system {
    --p: 0.45;
    --tilt: -35deg;
    position: relative;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 1;
    margin-inline: auto;
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.ring-one {
    width: 84%;
    height: 84%;
}

.ring-two {
    width: 94%;
    height: 42%;
    transform: translate(-50%, -50%) rotate(var(--tilt));
}

.ring-three {
    width: 62%;
    height: 62%;
    border-style: dashed;
    border-color: var(--accent);
    transform: translate(-50%, -50%) rotate(calc(var(--p) * 140deg));
}

.orbit-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    transform: translate3d(calc(var(--p) * var(--dx)), calc(var(--p) * var(--dy)), 0);
}

.dot-one   { top: 10%; right: 13%; --dx: -26px; --dy: 34px; }
.dot-two   { top: 55%; left: 2%; background: var(--accent-soft); --dx: 30px; --dy: -24px; }
.dot-three { right: 24%; bottom: 15%; width: 8px; height: 8px; --dx: -18px; --dy: -40px; }

.orbit-center {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: grid;
    place-content: center;
    width: clamp(96px, 22%, 136px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--center-bg);
    color: var(--center-fg);
    text-align: center;
    translate: -50% -50%;
}

.orbit-center span {
    font-size: 0.625rem;
    letter-spacing: 0.2em;
}

.orbit-center strong {
    font-size: clamp(0.9rem, 2.4vw, 1.15rem);
    font-weight: 600;
    font-stretch: 90%;
    letter-spacing: -0.01em;
}

/* Planet position is written by script.js (transform); translate centres it */
.orbit-planet {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: clamp(68px, 17%, 100px);
    aspect-ratio: 1;
    border-radius: 50%;
    text-align: center;
    translate: -50% -50%;
    outline: 1px solid transparent;
    outline-offset: 6px;
    transition: outline-color 0.35s ease, outline-offset 0.35s var(--ease);
}

.orbit-planet.is-highlight {
    outline-color: var(--accent);
    outline-offset: 9px;
}

.orbit-planet span {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.2;
}

.orbit-planet p {
    max-width: 85%;
    font-size: 0.625rem;
    line-height: 1.25;
}

.planet-one   { background: var(--champagne); color: var(--soft-black); }
.planet-two   { background: var(--text); color: var(--bg); }
.planet-three { background: var(--planet-3-bg); color: var(--planet-3-fg); }

@media (max-width: 900px) {
    .projects-layout {
        grid-template-columns: 1fr;
    }

    .orbit-stage {
        order: -1;
    }
}


/* ==========================================================
   11 JOURNEY
   ========================================================== */

.journey-timeline {
    --tl: 1;
    position: relative;
    display: grid;
    gap: clamp(2.5rem, 6vw, 4.5rem);
    max-width: 56rem;
}

.journey-timeline::before,
.journey-line {
    position: absolute;
    top: var(--line-top, 1.5rem);
    left: 1.5rem;
    width: 1px;
    height: var(--line-h, calc(100% - 3rem));
}

.journey-timeline::before {
    content: "";
    background: var(--line);
}

.journey-line {
    background: var(--accent);
    transform: scaleY(var(--tl));
    transform-origin: top;
}

.journey-item {
    position: relative;
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: clamp(1.25rem, 3vw, 2.25rem);
    align-items: start;
}

.journey-number {
    z-index: 1;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
    background: var(--bg);
    font-size: 0.8125rem;
    color: var(--label);
    transition: background-color 0.6s ease, border-color 0.6s ease, color 0.6s ease;
}

.journey-item.is-lit .journey-number {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--bg);
}

.journey-content h3 {
    margin-bottom: 0.75rem;
    padding-top: 0.2rem;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 600;
    font-stretch: 88%;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.journey-content p {
    max-width: 46ch;
}

.journey-content p + p {
    margin-top: 0.25rem;
}

.motion .journey-content {
    opacity: 0;
    clip-path: inset(-10% 100% -10% 0);
    transform: translate3d(-18px, 0, 0);
    transition: opacity 0.9s var(--ease), clip-path 1.2s var(--ease), transform 1.2s var(--ease);
}

.motion .journey-item.is-lit .journey-content {
    opacity: 1;
    clip-path: inset(-10% -4% -10% 0);
    transform: none;
}

@media (max-width: 560px) {
    .journey-item {
        grid-template-columns: 2.5rem 1fr;
        gap: 1rem;
    }

    .journey-number {
        width: 2.5rem;
        height: 2.5rem;
    }

    .journey-timeline::before,
    .journey-line {
        left: 1.25rem;
    }
}


/* ==========================================================
   12 BEYOND WORK
   ========================================================== */

.beyond {
    --p: 0.5;
    position: relative;
    display: flex;
    align-items: center;
    min-height: 100svh;
    overflow-x: clip;
}

.beyond-ring {
    position: absolute;
    top: 50%;
    left: 28%;
    width: min(72vw, 74svh);
    aspect-ratio: 1;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
    pointer-events: none;
    translate: -50% -50%;
    transform: scale(calc(0.5 + var(--p) * 0.65)) rotate(calc(var(--p) * 80deg));
}

.beyond-ring::after {
    content: "";
    position: absolute;
    top: -5px;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    border-radius: 50%;
    background: var(--accent);
}

.beyond-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: clamp(2.5rem, 6vw, 6rem);
    align-items: center;
    width: 100%;
}

.beyond-statement {
    display: flex;
    flex-direction: column;
}

.beyond-title {
    display: flex;
    flex-direction: column;
}

.beyond-word {
    display: block;
    font-size: clamp(5rem, 11.5vw, 10.5rem);
    font-weight: 500;
    font-stretch: 80%;
    line-height: 0.95;
    letter-spacing: -0.045em;
    transform-origin: left center;
    transform: translate3d(calc((0.5 - var(--p)) * 6vw), 0, 0) scale(calc(0.88 + var(--p) * 0.18));
}

.beyond-lede {
    max-width: 17.5rem;
    margin-top: 0.75rem;
    font-size: 1.0625rem;
}

.curiosity-orbit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 9.5rem;
    height: 9.5rem;
    margin-top: 2.25rem;
    border: 1px solid var(--accent-soft);
    border-radius: 50%;
    color: var(--accent);
}

.curiosity-orbit span {
    font-size: 3rem;
    line-height: 1;
}

.curiosity-orbit p {
    margin-top: 0.25rem;
    padding: 0 0.5rem;
    font-size: 0.5rem;
    letter-spacing: 0.18em;
    text-align: center;
}

.beyond-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(7rem, 0.55fr) 1fr;
    gap: 1.5rem;
    padding: 1.75rem 0;
}

.motion .beyond-item > * {
    opacity: clamp(0, calc(var(--e) * 2.2 - 0.6), 1);
    transform: translate3d(0, calc((1 - var(--e)) * 20px), 0);
}

.beyond-item .eyebrow {
    padding-top: 0.45rem;
    font-size: 0.6875rem;
}

.beyond-item h3 {
    margin-bottom: 0.4rem;
    font-size: clamp(1.3rem, 2.2vw, 1.75rem);
    font-weight: 600;
    font-stretch: 90%;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.beyond-item p:not(.eyebrow) {
    font-size: 0.9375rem;
    color: var(--label);
}

@media (max-width: 900px) {
    .beyond {
        min-height: auto;
    }

    .beyond-layout {
        grid-template-columns: 1fr;
    }

    .beyond-ring {
        left: 50%;
        top: 30%;
        width: min(84vw, 520px);
    }

    .beyond-word {
        font-size: clamp(5rem, 26vw, 9rem);
    }
}

@media (max-width: 560px) {
    .beyond-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .beyond-item .eyebrow {
        padding-top: 0;
    }
}


/* ==========================================================
   13 CONTACT
   The dark panel opens as a circle from the top edge as the
   section scrolls in, so the page feels like it is closing.
   ========================================================== */

.contact {
    --p: 1;
    position: relative;
    isolation: isolate;
    color: var(--panel-text);
}

.contact::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--panel-bg);
}

.motion .contact::before {
    clip-path: circle(calc(var(--p) * 160%) at 50% 0);
}

.contact-inner {
    max-width: 62rem;
}

.contact-title,
.contact-highlight {
    font-size: clamp(2.75rem, 9vw, 7.5rem);
    font-weight: 600;
    font-stretch: 84%;
    line-height: 1;
    letter-spacing: -0.04em;
}

.contact-highlight {
    margin-top: 0.1em;
    font-weight: 500;
    color: var(--panel-label);
}

.contact-copy {
    max-width: 34rem;
    margin-top: 2.25rem;
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--panel-text);
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
    margin-top: 2.5rem;
}

.contact-links a {
    padding: 0.85rem 1.6rem;
    border: 1px solid var(--panel-line);
    border-radius: 999px;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.contact-links a:hover {
    border-color: var(--panel-label);
    background-color: var(--panel-label);
    color: var(--panel-bg);
}



.contact-sign {
    margin-top: clamp(3.5rem, 8vw, 6rem);
    padding-top: 1.25rem;
    border-top: 1px solid var(--panel-line);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    color: var(--panel-label);
}

.contact :focus-visible {
    outline-color: var(--panel-label);
}

.email-copy {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: fit-content;

    /* LEFT ALIGNMENT */
    margin: 24px 0 0 0 !important;
    width: fit-content;
    align-self: flex-start;

    padding: 13px 22px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50px;

    color: #fff;
    background: rgba(255,255,255,0.04);
    font-size: 14px;

    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.email-copy:hover {
    border-color: #d9c5a5;
    box-shadow: 0 0 18px rgba(217,197,165,0.25);
    transform: translateY(-3px);
}

.copy-icon {
    color: #d9c5a5;
    font-size: 18px;
}

#copyStatus {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #d9c5a5;
}




/* ==========================================================
   14 FOOTER
   ========================================================== */

.site-footer {
    padding: 2.25rem var(--gutter) 1.75rem;
    background: var(--bg);
}

.footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--line);
}

.footer-brand {
    font-size: 1.25rem;
    font-weight: 600;
    font-stretch: 90%;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.back-to-top {
    font-size: 0.6875rem;
    letter-spacing: 0.2em;
    text-decoration: none;
    color: var(--label);
    transition: color 0.3s ease;
}

.back-to-top:hover {
    color: var(--text);
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-top: 1.25rem;
}

.footer-bottom p {
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
}

@media (max-width: 560px) {
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* ==========================================================
   14b TOAST (email copied)
   ========================================================== */

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: calc(100vw - 2rem);
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.875rem;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 16px);
    transition: opacity 0.4s ease, transform 0.6s var(--ease), visibility 0s linear 0.4s;
}

.toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition: opacity 0.4s ease, transform 0.6s var(--ease), visibility 0s;
}

.toast a {
    flex: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.toast :focus-visible {
    outline-color: var(--bg);
}


/* ==========================================================
   15 CURSOR — mouse devices only (enabled by script.js)
   ========================================================== */

.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    display: none;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    background: rgba(120, 103, 127, 0.1);
    box-shadow: 0 0 8px var(--accent), 0 0 18px -2px var(--accent);
    opacity: 0;
    pointer-events: none;
    transition: width 0.25s var(--ease), height 0.25s var(--ease), margin 0.25s var(--ease), opacity 0.3s ease, background-color 0.25s ease;
}

html.has-cursor .custom-cursor {
    display: block;
}

.custom-cursor.is-visible {
    opacity: 1;
}

.custom-cursor.hover {
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    background: rgba(120, 103, 127, 0.18);
}

html.cursor-active,
html.cursor-active * {
    cursor: none !important;
}

@media (hover: none), (pointer: coarse) {
    .custom-cursor {
        display: none !important;
    }
}


/* ==========================================================
   16 ACCESSIBILITY & REDUCED MOTION
   ========================================================== */

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

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

    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
}


/* ==========================================================
   CERTIFICATES & ACHIEVEMENTS
   Cards inherit the existing scroll-scrub row animation.
   ========================================================== */

.certificate-intro {
    margin-bottom: 1.25rem;
    color: var(--label);
}

.certificate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.certificate-card {
    position: relative;
    display: flex;
    min-height: 12.5rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color 0.35s ease, background-color 0.35s ease, transform 0.35s ease;
}

.certificate-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.certificate-index {
    font-size: 0.625rem;
    letter-spacing: 0.16em;
    color: var(--label);
}

.certificate-card h4 {
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.certificate-card p {
    font-size: 0.85rem;
    color: var(--label);
}

.certificate-status {
    width: 100%;
    padding-top: 0.65rem;
    border-top: 1px solid var(--line);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: var(--accent);
}

@media (max-width: 560px) {
    .certificate-grid {
        grid-template-columns: 1fr;
    }

    .certificate-card {
        min-height: 10rem;
    }
}


/* Certificate card details and document links */
.certificate-card .certificate-date {
    margin-top: -0.55rem;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

.certificate-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
    width: 100%;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: gap 0.3s ease, color 0.3s ease;
}

.certificate-link:hover {
    gap: 0.65rem;
    color: var(--text);
}

.certificate-card h4 {
    overflow-wrap: anywhere;
}
