/* ==========================================================================
   Omar Farooq · Portfolio
   Dark glass interface layered over a fixed WebGL scene.

   Layers (back to front):
     .backdrop     CSS gradient: the fallback when WebGL is unavailable
     .scene        Three.js canvas, fades in once the first frame is drawn
     .scene-veil   vignette that keeps text readable over the 3D
     content       header, sections, footer, toasts
   ========================================================================== */

/* ---------- Design tokens ---------- */

:root {
    color-scheme: dark;

    --bg: #06080d;
    --bg-raise: #0b1019;
    --glass: rgba(12, 18, 31, 0.52);
    --glass-strong: rgba(13, 19, 33, 0.82);
    --glass-hover: rgba(17, 26, 44, 0.6);
    --line: rgba(148, 190, 255, 0.12);
    --line-strong: rgba(103, 232, 249, 0.3);

    --text: #e8eef8;
    --text-soft: #b3bfd3;
    --text-muted: #8a97ae;

    --cyan: #22d3ee;
    --cyan-bright: #67e8f9;
    --indigo: #6366f1;
    --indigo-bright: #818cf8;
    --violet: #8b5cf6;
    --green: #34d399;
    --danger: #fb7185;

    --grad-accent: linear-gradient(120deg, var(--cyan) 0%, var(--indigo) 60%, var(--violet) 100%);
    --grad-text: linear-gradient(100deg, #ffffff 15%, var(--cyan-bright) 55%, var(--indigo-bright) 100%);

    --blur: 14px;
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius: 16px;
    --radius-sm: 10px;
    --pill: 999px;

    --font-display: "Space Grotesk", "Plus Jakarta Sans", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

    --container: 1200px;
    --gutter: clamp(16px, 4vw, 40px);
    --header-h: 68px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
    scrollbar-color: rgba(103, 232, 249, 0.28) transparent;
    overflow-x: clip;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font: 400 1rem/1.65 var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

h1, h2, h3 {
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

a {
    color: inherit;
}

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

::selection {
    background: rgba(34, 211, 238, 0.32);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--cyan-bright);
    outline-offset: 3px;
    border-radius: 6px;
}

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

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--cyan-bright);
    color: #031018;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 0.2s;
}

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

.container {
    width: min(100% - 2 * var(--gutter), var(--container));
    margin-inline: auto;
}

.icon {
    width: 1.25em;
    height: 1.25em;
    flex: none;
}

/* ---------- Background layers ---------- */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(60vmax 45vmax at 80% 25%, rgba(34, 211, 238, 0.14), transparent 60%),
        radial-gradient(50vmax 40vmax at 10% 85%, rgba(99, 102, 241, 0.16), transparent 60%),
        radial-gradient(35vmax 30vmax at 55% 105%, rgba(139, 92, 246, 0.1), transparent 60%),
        var(--bg);
}

.backdrop::after {
    /* faint grid, only noticeable without WebGL */
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 190, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 190, 255, 0.05) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse at 50% 35%, #000 20%, transparent 75%);
}

.scene {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -2;
    display: block;
    width: 100%;
    height: 100vh;
    height: 100lvh; /* stays put when mobile toolbars slide in and out */
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.8s ease;
}

.scene.is-ready {
    opacity: 1;
}

.no-webgl .scene {
    display: none;
}

.scene-veil {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(130% 95% at 50% 40%, transparent 50%, rgba(6, 8, 13, 0.7) 100%),
        linear-gradient(180deg, rgba(6, 8, 13, 0.35) 0%, transparent 18%, transparent 75%, rgba(6, 8, 13, 0.55) 100%);
}

@media (max-width: 860px) {
    /* text covers the whole width on small screens: keep the scene a step further back */
    .scene-veil {
        background-color: rgba(6, 8, 13, 0.3);
    }
}

/* ---------- Glass surfaces ---------- */

.glass,
.card {
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(135%);
    backdrop-filter: blur(var(--blur)) saturate(135%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.045),
        0 24px 60px -32px rgba(0, 0, 0, 0.85);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass,
    .card {
        background: var(--glass-strong);
    }
}

/* Cards: cursor spotlight + glowing edge. --mx/--my are set by cards.js. */
.card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition:
        border-color 0.35s,
        background-color 0.35s,
        transform 0.6s var(--ease-out);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(480px circle at var(--mx, 50%) var(--my, 0%), rgba(103, 232, 249, 0.1), transparent 42%);
    opacity: 0;
    transition: opacity 0.4s;
}

.card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 0%), rgba(103, 232, 249, 0.75), rgba(129, 140, 248, 0.35) 40%, transparent 70%);
    -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);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.card:hover {
    background-color: var(--glass-hover);
}

.card:hover::before,
.card:hover::after,
.card:focus-within::after {
    opacity: 1;
}

.tilt {
    transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}

.tilt.is-tilting {
    transition:
        border-color 0.35s,
        background-color 0.35s,
        transform 0.12s linear;
}

.icon-tile {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: none;
    border-radius: 14px;
    color: var(--cyan-bright);
    background: linear-gradient(145deg, rgba(34, 211, 238, 0.16), rgba(99, 102, 241, 0.12));
    border: 1px solid rgba(103, 232, 249, 0.22);
    box-shadow: 0 0 26px -8px rgba(34, 211, 238, 0.55);
}

.icon-tile .icon {
    width: 22px;
    height: 22px;
}

.icon-tile--sm {
    width: 36px;
    height: 36px;
    border-radius: 11px;
}

.icon-tile--sm .icon {
    width: 17px;
    height: 17px;
}

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

.btn {
    --pad-y: 13px;
    --pad-x: 20px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--pad-y) var(--pad-x);
    border: 1px solid transparent;
    border-radius: var(--pill);
    font: 600 0.94rem/1 var(--font-body);
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition:
        box-shadow 0.3s,
        background-color 0.3s,
        border-color 0.3s,
        color 0.3s;
}

.btn .icon {
    width: 18px;
    height: 18px;
}

.btn-lg {
    --pad-y: 16px;
    --pad-x: 26px;
    font-size: 1rem;
}

.btn-sm {
    --pad-y: 10px;
    --pad-x: 16px;
    font-size: 0.85rem;
}

.btn-sm .icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    color: #031018;
    background: linear-gradient(120deg, var(--cyan-bright) 0%, var(--cyan) 45%, var(--indigo-bright) 100%);
    box-shadow:
        0 10px 32px -10px rgba(34, 211, 238, 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:hover {
    box-shadow:
        0 12px 44px -8px rgba(34, 211, 238, 0.85),
        0 0 0 1px rgba(103, 232, 249, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn-ghost {
    color: var(--text);
    background: var(--glass);
    border-color: var(--line-strong);
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
}

.btn-ghost:hover {
    background: var(--glass-hover);
    border-color: rgba(103, 232, 249, 0.6);
    box-shadow: 0 0 28px -6px rgba(34, 211, 238, 0.4);
}

.btn:focus-visible {
    outline-offset: 4px;
    border-radius: var(--pill);
}

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

.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    height: var(--header-h);
    display: flex;
    align-items: center;
    border-bottom: 1px solid transparent;
    transition:
        background-color 0.4s,
        border-color 0.4s;
}

.site-header.is-scrolled,
.site-header.is-open {
    background: rgba(6, 8, 13, 0.66);
    border-bottom-color: var(--line);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
    backdrop-filter: blur(var(--blur)) saturate(140%);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    margin-right: auto;
    text-decoration: none;
    font: 600 1.02rem/1 var(--font-display);
    letter-spacing: -0.01em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: #031018;
    background: var(--grad-accent);
    font: 600 0.8rem/1 var(--font-mono);
    box-shadow: 0 0 22px rgba(34, 211, 238, 0.35);
}

.nav ul {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav a {
    display: block;
    padding: 8px 14px;
    border-radius: var(--pill);
    color: var(--text-soft);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition:
        color 0.2s,
        background-color 0.2s,
        box-shadow 0.2s;
}

.nav a:hover {
    color: var(--text);
    background: rgba(148, 190, 255, 0.06);
}

.nav a.is-active {
    color: var(--text);
    background: rgba(103, 232, 249, 0.08);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

.nav-toggle {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: var(--glass);
    cursor: pointer;
}

.nav-toggle .icon {
    width: 22px;
    height: 22px;
}

.nav-toggle-close,
.nav-toggle[aria-expanded="true"] .nav-toggle-open {
    display: none;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-close {
    display: block;
}

.progress {
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: var(--grad-accent);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.7);
}

@media (max-width: 860px) {
    .nav-toggle {
        display: grid;
    }

    .nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        padding: 10px var(--gutter) 22px;
        background: rgba(6, 8, 13, 0.94);
        border-bottom: 1px solid var(--line);
        -webkit-backdrop-filter: blur(var(--blur));
        backdrop-filter: blur(var(--blur));
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition:
            opacity 0.3s var(--ease-out),
            transform 0.3s var(--ease-out),
            visibility 0.3s;
    }

    .nav.is-open {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .nav ul {
        flex-direction: column;
    }

    .nav a {
        padding: 14px 12px;
        border-radius: 12px;
        font-size: 1.05rem;
    }
}

@media (max-width: 380px) {
    .brand-name {
        display: none;
    }
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(var(--header-h) + 48px) 0 110px;
}

.hero::before {
    /* soft dark wash behind the copy, so text stays crisp over bright parts of the scene */
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(70% 75% at 22% 52%, rgba(6, 8, 13, 0.55), transparent 70%);
    pointer-events: none;
}

.hero-inner {
    display: grid;
    gap: 52px;
}

.hero-copy {
    max-width: 760px;
}

.availability-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 30px;
    padding: 8px 14px 8px 12px;
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: var(--pill);
    background: rgba(52, 211, 153, 0.07);
    color: #b9f6de;
    font: 500 0.76rem/1.2 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2.2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: -0.04em;
}

.hero-prefix {
    display: block;
    margin-bottom: 18px;
    color: var(--cyan-bright);
    font: 500 clamp(0.78rem, 1.3vw, 0.92rem)/1 var(--font-mono);
    letter-spacing: 0.34em;
    text-transform: uppercase;
}

.hero-name {
    display: block;
    padding-bottom: 0.08em;
    font-size: clamp(2.5rem, 12vw, 7rem);
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 42px rgba(34, 211, 238, 0.2));
}

.hero-role {
    margin: 22px 0 0;
    font: 500 clamp(1.12rem, 2.3vw, 1.55rem)/1.35 var(--font-display);
    letter-spacing: -0.01em;
}

.hero-lead {
    max-width: 60ch;
    margin: 16px 0 0;
    color: var(--text-soft);
    font-size: clamp(1rem, 1.25vw, 1.1rem);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 36px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 780px;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius);
}

.stat {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 8px;
    padding: 18px 20px;
    border-left: 1px solid var(--line);
}

.stat:first-child {
    border-left: 0;
}

.stat dd {
    margin: 0;
    font: 600 clamp(1.35rem, 2.5vw, 1.9rem)/1 var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat dt {
    color: var(--text-muted);
    font: 500 0.7rem/1.35 var(--font-mono);
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font: 500 0.66rem/1 var(--font-mono);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    text-decoration: none;
    transform: translateX(-50%);
}

.scroll-cue-line {
    position: relative;
    width: 1px;
    height: 44px;
    overflow: hidden;
    background: linear-gradient(var(--line-strong), transparent);
}

.scroll-cue-line::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent, var(--cyan-bright), transparent);
    animation: scroll-line 2.2s var(--ease-out) infinite;
}

@keyframes scroll-line {
    from { transform: translateY(-100%); }
    to { transform: translateY(100%); }
}

@media (max-width: 640px) {
    .hero {
        padding-bottom: 72px;
    }

    .hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat:nth-child(3) {
        border-left: 0;
    }

    .stat:nth-child(n + 3) {
        border-top: 1px solid var(--line);
    }

    .scroll-cue {
        display: none;
    }
}

@media (max-height: 700px) and (min-width: 641px) {
    .scroll-cue {
        display: none;
    }
}

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

.section {
    position: relative;
    padding: clamp(88px, 13vh, 150px) 0;
}

.section-head {
    position: relative;
    max-width: 780px;
    margin-bottom: clamp(40px, 6vw, 64px);
}

.section-head::before {
    /* faint wash so headings stay crisp whatever the scene is doing behind them */
    content: "";
    position: absolute;
    inset: -48px -96px;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(6, 8, 13, 0.5), transparent);
    pointer-events: none;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    color: var(--cyan-bright);
    font: 500 0.76rem/1 var(--font-mono);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.eyebrow::after {
    content: "";
    width: 44px;
    height: 1px;
    background: linear-gradient(90deg, var(--cyan), transparent);
}

.section-title {
    margin: 0;
    font: 700 clamp(2rem, 4.8vw, 3.5rem)/1.05 var(--font-display);
    letter-spacing: -0.035em;
}

.grad {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section-lead {
    max-width: 62ch;
    margin: 20px 0 0;
    color: var(--text-soft);
    font-size: 1.07rem;
}

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

.tags li {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(148, 190, 255, 0.045);
    color: var(--text-soft);
    font: 500 0.72rem/1.2 var(--font-mono);
    transition:
        color 0.2s,
        border-color 0.2s,
        background-color 0.2s;
}

.card:hover .tags li {
    border-color: rgba(103, 232, 249, 0.2);
}

.tags li:hover {
    color: var(--cyan-bright);
    background: rgba(34, 211, 238, 0.08);
}

/* ---------- Expertise (bento) ---------- */

.bento {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.skill-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 280px;
    padding: 28px;
}

.skill-card.is-featured {
    grid-column: span 2;
}

.skill-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.skill-card h3 {
    margin: 8px 0 0;
    font: 600 1.3rem/1.25 var(--font-display);
    letter-spacing: -0.015em;
}

.skill-card.is-featured h3 {
    font-size: clamp(1.4rem, 2.4vw, 1.75rem);
}

.skill-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.96rem;
}

/* The wide card reads as a short intro paragraph. */
.skill-card.is-featured p {
    max-width: 54ch;
    color: var(--text);
    font-size: clamp(1rem, 1.35vw, 1.18rem);
    line-height: 1.7;
}

.skill-card .tags {
    margin-top: auto;
    padding-top: 10px;
}

/* Prompt → Deploy flow: each step lights up in turn. */
.pipeline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 26px;
    margin: 6px 0 2px;
    padding: 0;
    list-style: none;
}

.pipeline li {
    position: relative;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(6, 8, 13, 0.45);
    color: var(--text-soft);
    font: 500 0.78rem/1 var(--font-mono);
    animation: step-glow 5s infinite;
}

.pipeline li + li::before {
    content: "";
    position: absolute;
    top: 50%;
    right: calc(100% + 1px);
    width: 26px;
    height: 1px;
    background: linear-gradient(90deg, rgba(103, 232, 249, 0.08), rgba(103, 232, 249, 0.55));
}

.pipeline li:nth-child(2) { animation-delay: 1s; }
.pipeline li:nth-child(3) { animation-delay: 2s; }
.pipeline li:nth-child(4) { animation-delay: 3s; }
.pipeline li:nth-child(5) { animation-delay: 4s; }

@keyframes step-glow {
    0%, 22%, 100% {
        color: var(--text-soft);
        background: rgba(6, 8, 13, 0.45);
        border-color: var(--line);
        box-shadow: none;
    }
    6%, 15% {
        color: #031018;
        background: var(--cyan-bright);
        border-color: var(--cyan-bright);
        box-shadow: 0 0 22px rgba(34, 211, 238, 0.65);
    }
}

@media (max-width: 980px) {
    .bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skill-card.is-featured {
        grid-column: 1 / -1;
    }
}

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

    .skill-card {
        min-height: 0;
        padding: 24px;
    }

    .pipeline {
        gap: 8px;
    }

    .pipeline li + li::before {
        display: none;
    }
}

/* ---------- Projects ---------- */

.projects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.project-card {
    display: flex;
    flex-direction: column;
    padding: 28px;
}

.project-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
}

.project-card.is-featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
    align-items: center;
    gap: 44px;
    padding: clamp(28px, 4vw, 44px);
}

.project-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.project-kicker {
    margin: 0;
    color: var(--cyan-bright);
    font: 500 0.72rem/1.3 var(--font-mono);
    letter-spacing: 0.13em;
    text-transform: uppercase;
}


.project-name {
    margin: 4px 0 0;
    font: 700 1.5rem/1.15 var(--font-display);
    letter-spacing: -0.025em;
}

.is-featured .project-name {
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
}

.project-desc {
    margin: 0;
    color: var(--text-soft);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 10px;
    margin: 0;
}

.metric {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 7px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(6, 8, 13, 0.42);
}

.metric dd {
    margin: 0;
    color: var(--text);
    font: 600 1.12rem/1 var(--font-mono);
    letter-spacing: -0.02em;
}

.is-featured .metric dd {
    font-size: clamp(1.25rem, 2.2vw, 1.65rem);
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.metric dt {
    color: var(--text-muted);
    font: 500 0.66rem/1.35 var(--font-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.project-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 6px;
}

.private-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px dashed rgba(148, 190, 255, 0.24);
    border-radius: var(--pill);
    color: var(--text-muted);
    font: 500 0.74rem/1.2 var(--font-mono);
}

.private-note .icon {
    width: 15px;
    height: 15px;
    color: var(--indigo-bright);
}

/* Featured project chart */
.project-visual {
    position: relative;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(120% 90% at 80% 10%, rgba(34, 211, 238, 0.1), transparent 60%),
        rgba(6, 8, 13, 0.5);
}

.price-chart {
    width: 100%;
    height: auto;
}

.pc-grid path {
    fill: none;
    stroke: rgba(148, 190, 255, 0.08);
    stroke-width: 1;
}

.pc-line {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
}

.pc-line--a {
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.7));
}

.pc-line--b {
    stroke: rgba(129, 140, 248, 0.55);
}

.pc-line--c {
    stroke: rgba(139, 92, 246, 0.45);
}

.pc-area {
    opacity: 1;
}

.pc-dot {
    fill: var(--cyan-bright);
    filter: drop-shadow(0 0 8px var(--cyan));
}

.pc-dot--ring {
    fill: none;
    stroke: rgba(103, 232, 249, 0.5);
    stroke-width: 1.5;
    transform-box: fill-box;
    transform-origin: center;
    animation: ring 2.4s var(--ease-out) infinite;
}

@keyframes ring {
    from { transform: scale(0.5); opacity: 1; }
    to { transform: scale(1.8); opacity: 0; }
}

/* Lines draw in when the card is revealed (JS adds .is-inview). */
.js .project-visual .pc-line {
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 2.2s var(--ease-out);
}

.js .project-visual .pc-line--b { transition-delay: 0.25s; }
.js .project-visual .pc-line--c { transition-delay: 0.45s; }

.js .project-visual .pc-area,
.js .project-visual .pc-dot {
    opacity: 0;
    transition: opacity 1s ease 1.4s;
}

.is-inview .project-visual .pc-line,
.reveal-off .project-visual .pc-line {
    stroke-dashoffset: 0;
}

.is-inview .project-visual .pc-area,
.is-inview .project-visual .pc-dot,
.reveal-off .project-visual .pc-area,
.reveal-off .project-visual .pc-dot {
    opacity: 1;
}

@media (max-width: 980px) {
    .projects {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-card.is-featured {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    /* Featured + three others: let the last card fill the row. */
    .project-card:last-child:nth-child(even) {
        grid-column: 1 / -1;
    }
}

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

    .project-card {
        padding: 24px;
    }
}

/* ---------- Timeline ---------- */

.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

.timeline-line {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 50%;
    width: 2px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(148, 190, 255, 0.1);
    transform: translateX(-50%);
}

.timeline-fill {
    position: absolute;
    inset: 0;
    transform-origin: top;
    background: linear-gradient(var(--cyan), var(--indigo) 60%, var(--violet));
    box-shadow: 0 0 16px var(--cyan);
}

.timeline-list {
    display: grid;
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tl-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 72px;
}

.tl-item:nth-child(odd) .tl-card { grid-column: 1; }
.tl-item:nth-child(even) .tl-card { grid-column: 2; }

.tl-node {
    position: absolute;
    top: 26px;
    left: 50%;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--bg-raise);
    color: var(--cyan-bright);
    transform: translateX(-50%);
    transition:
        box-shadow 0.5s,
        background-color 0.5s,
        border-color 0.5s;
}

.tl-node .icon {
    width: 18px;
    height: 18px;
}

.tl-item.is-active .tl-node {
    border-color: rgba(103, 232, 249, 0.7);
    background: #0b1a24;
    box-shadow:
        0 0 0 6px rgba(34, 211, 238, 0.08),
        0 0 26px rgba(34, 211, 238, 0.55);
}

.tl-card {
    padding: 24px 26px;
}

.tl-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 14px;
}

.tl-kind {
    padding: 6px 9px;
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 6px;
    background: rgba(34, 211, 238, 0.08);
    color: var(--cyan-bright);
    font: 500 0.66rem/1 var(--font-mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.tl-education .tl-kind {
    border-color: rgba(129, 140, 248, 0.28);
    background: rgba(99, 102, 241, 0.1);
    color: var(--indigo-bright);
}

.tl-milestone .tl-kind,
.tl-next .tl-kind {
    border-color: rgba(167, 139, 250, 0.3);
    background: rgba(139, 92, 246, 0.1);
    color: #c4b5fd;
}

.tl-period {
    color: var(--text-soft);
    font: 500 0.82rem/1 var(--font-mono);
}

.tl-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    color: #a7f3d0;
    font: 500 0.72rem/1 var(--font-mono);
}

.tl-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.tl-card h3 {
    margin: 0;
    font: 600 1.28rem/1.25 var(--font-display);
    letter-spacing: -0.015em;
}

.tl-org {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.93rem;
}

.tl-points {
    display: grid;
    gap: 9px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.tl-points li {
    position: relative;
    padding-left: 20px;
}

.tl-points li::before {
    content: "";
    position: absolute;
    top: 0.68em;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 1.5px;
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
    transform: rotate(45deg);
}

.tl-next .tl-card {
    border-style: dashed;
    border-color: rgba(103, 232, 249, 0.32);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(99, 102, 241, 0.08));
}

.tl-cta {
    margin-top: 18px;
}

@media (max-width: 820px) {
    .timeline-line {
        left: 21px;
    }

    .tl-item {
        grid-template-columns: minmax(0, 1fr);
        padding-left: 60px;
    }

    .tl-item:nth-child(n) .tl-card {
        grid-column: 1;
    }

    .tl-node {
        top: 22px;
        left: 21px;
    }

    .tl-card {
        padding: 22px;
    }
}

/* ---------- Contact ---------- */

.contact-panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(32px, 5vw, 64px);
    padding: clamp(24px, 5vw, 56px);
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-xl);
    background: linear-gradient(160deg, rgba(14, 21, 37, 0.72), rgba(8, 12, 21, 0.58));
    -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
    backdrop-filter: blur(var(--blur)) saturate(140%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 40px 100px -40px rgba(34, 211, 238, 0.25);
}

.contact-panel::before {
    content: "";
    position: absolute;
    top: -30%;
    right: -20%;
    z-index: -1;
    width: 70%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.16), transparent 65%);
    pointer-events: none;
}

.hire-badge {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 10px;
    margin: 0 0 26px;
    padding: 9px 15px 9px 13px;
    border: 1px solid rgba(52, 211, 153, 0.32);
    border-radius: var(--pill);
    background: rgba(52, 211, 153, 0.08);
    color: #b9f6de;
    font: 600 0.76rem/1 var(--font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow: 0 0 34px -10px rgba(52, 211, 153, 0.55);
}

.contact-title {
    margin: 0;
    font: 700 clamp(2.2rem, 5vw, 3.7rem)/1.02 var(--font-display);
    letter-spacing: -0.04em;
}

.email-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 10px 20px;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: rgba(6, 8, 13, 0.55);
}

.email-link {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text);
    font: 500 clamp(0.95rem, 1.6vw, 1.1rem)/1.3 var(--font-mono);
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: color 0.2s;
}

.email-link[href]:hover {
    color: var(--cyan-bright);
}

/* Until a visitor interacts, CSS draws the "@" and "." between the pieces of
   the address, so the page source never contains it (see ui/email.js). */
.email-at::before {
    content: "\40";
}

.email-dot::before {
    content: ".";
}

.contact-reach {
    display: grid;
    gap: 26px;
}

/* Copying needs JavaScript; without it the address is still shown. */
.no-js .copy-btn {
    display: none;
}

.copy-btn .copied-icon,
.copy-btn.is-copied .copy-icon {
    display: none;
}

.copy-btn.is-copied .copied-icon {
    display: inline-flex;
}

.copy-icon,
.copied-icon {
    display: inline-flex;
}

.contact-links {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.contact-links a,
.contact-links li > span {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text-soft);
    font-size: 0.97rem;
    text-decoration: none;
    transition: color 0.2s;
}

.contact-links a:hover {
    color: var(--text);
}

@media (max-width: 900px) {
    .contact-panel {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .email-row {
        padding: 14px;
    }

    .copy-btn {
        width: 100%;
    }
}

/* ---------- Footer ---------- */

.site-footer {
    padding: 30px 0 40px;
    border-top: 1px solid var(--line);
    background: linear-gradient(transparent, rgba(6, 8, 13, 0.85));
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 28px;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.footer-inner p {
    margin: 0;
}

.footer-tech {
    font: 500 0.74rem/1.4 var(--font-mono);
    letter-spacing: 0.04em;
}

.to-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
    text-decoration: none;
}

.to-top .icon {
    width: 15px;
    height: 15px;
    transform: rotate(-45deg);
}

.to-top:hover {
    color: var(--cyan-bright);
}

/* ---------- Toasts ---------- */

.toasts {
    position: fixed;
    left: 50%;
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 100;
    display: grid;
    gap: 10px;
    width: min(100% - 32px, 420px);
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: rgba(11, 17, 29, 0.9);
    color: var(--text);
    font-size: 0.93rem;
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
    box-shadow:
        0 22px 50px -20px rgba(0, 0, 0, 0.9),
        0 0 32px -12px rgba(34, 211, 238, 0.45);
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition:
        opacity 0.35s var(--ease-out),
        transform 0.35s var(--ease-out);
}

.toast.is-visible {
    opacity: 1;
    transform: none;
}

.toast::before {
    content: "";
    width: 9px;
    height: 9px;
    flex: none;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
}

.toast--success::before {
    background: var(--green);
    box-shadow: 0 0 10px var(--green);
}

.toast--error::before {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

/* ---------- Reveal states ----------
   Hero items start hidden only when JS runs. GSAP fades them in; if it never
   loads, the failsafe animation shows them after 3 s anyway. */

.js .hero-reveal {
    opacity: 0;
    animation: reveal-failsafe 0.6s ease 3s forwards;
}

.reveal-off .hero-reveal,
.motion-off .hero-reveal {
    opacity: 1;
    animation: none;
}

@keyframes reveal-failsafe {
    to { opacity: 1; }
}

/* ---------- Motion switch ----------
   Animations are on by default. html.motion-off is set before first paint
   only if the visitor paused them earlier, and the floating toggle flips it. */

.motion-toggle {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--pill);
    background: rgba(8, 12, 20, 0.72);
    color: var(--text-muted);
    font: 500 0.7rem/1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
    transition:
        color 0.2s,
        border-color 0.2s;
}

.motion-toggle[hidden] {
    display: none;
}

.motion-toggle:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.motion-icon {
    display: inline-flex;
    color: var(--cyan-bright);
}

.motion-icon .icon {
    width: 14px;
    height: 14px;
}

.motion-icon--play,
.motion-toggle.is-off .motion-icon--pause {
    display: none;
}

.motion-toggle.is-off .motion-icon--play {
    display: inline-flex;
}

.motion-off {
    scroll-behavior: auto;
}

.motion-off *,
.motion-off *::before,
.motion-off *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

.motion-off .tilt {
    transform: none;
}

/* Without JavaScript there is no toggle, so the OS setting decides. */
@media (prefers-reduced-motion: reduce) {
    .no-js {
        scroll-behavior: auto;
    }

    .no-js *,
    .no-js *::before,
    .no-js *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 640px) {
    /* icon-only toggle on phones; the label stays available to screen readers */
    .motion-toggle {
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
    }

    .motion-toggle [data-motion-label] {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* keep toasts clear of the motion toggle */
    .toasts {
        bottom: max(68px, calc(env(safe-area-inset-bottom) + 52px));
    }
}
