/* =============================================
   SAHAN VISHWA - PORTFOLIO
   Near-black canvas, geometric display type,
   hairline rules, restrained violet accent.
   ============================================= */

/* =============================================
   DESIGN TOKENS
   ============================================= */
:root {
    --bg: #0a0a12;
    --bg-soft: #0d0d16;
    --surface: #12121c;
    --surface-hi: #171722;

    --line: #24242f;
    --line-soft: #1a1a24;

    --ink: #f3f3f6;
    --ink-2: #a3a3b1;
    --ink-3: #6c6c7a;

    --accent: #7b6cff;
    --accent-hi: #9a8dff;
    --accent-soft: rgba(123, 108, 255, 0.14);

    --font-display: 'Poppins', 'Inter', system-ui, sans-serif;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --nav-h: 72px;
    --container: 1180px;
    --gutter: 28px;

    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;
    --r-pill: 999px;

    --dur: 200ms;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Light theme — same tokens, paper canvas */
html[data-theme="light"] {
    --bg: #f5f6fa;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --surface-hi: #ebedf4;

    --line: #dde1ec;
    --line-soft: #e9edf6;

    --ink: #15151d;
    --ink-2: #43475a;
    --ink-3: #6f7488;

    --accent: #5f4df0;
    --accent-hi: #4c3ae3;
    --accent-soft: rgba(95, 77, 240, 0.12);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 16px);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink-2);
    line-height: 1.7;
    font-size: 0.95rem;
    overflow-x: hidden;
    transition: background-color 300ms var(--ease), color 300ms var(--ease);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

img {
    max-width: 100%;
    display: block;
    outline: 1px solid rgba(255, 255, 255, 0.08);
    outline-offset: -1px;
}
html[data-theme="light"] img { outline-color: rgba(20, 20, 40, 0.1); }

::selection { background: var(--accent); color: #fff; }

/* =============================================
   NAVBAR
   ============================================= */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 18, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition-property: background-color, border-color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}

#navbar.scrolled {
    background: rgba(10, 10, 18, 0.92);
    border-bottom-color: var(--line-soft);
}
html[data-theme="light"] #navbar { background: rgba(255, 255, 255, 0.72); }
html[data-theme="light"] #navbar.scrolled { background: rgba(255, 255, 255, 0.92); }

.nav-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    white-space: nowrap;
    transition-property: color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.nav-logo:hover { color: var(--accent-hi); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-links a {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-3);
    position: relative;
    padding: 4px 0;
    transition-property: color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 1px;
    width: 0;
    background: var(--accent);
    transition-property: width;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 10px;
    background: none;
    border: 0;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 1.5px;
    width: 100%;
    background: var(--ink);
    border-radius: 2px;
    transition-property: transform, opacity;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile drawer */
.nav-drawer {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    z-index: 99;
    display: flex;
    flex-direction: column;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition-property: opacity, transform, visibility;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.nav-drawer.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
/* Instant close when jumping via a drawer link */
.nav-drawer.no-anim { transition: none; }
.nav-drawer a {
    padding: 13px 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line-soft);
    transition-property: color, padding-left;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.nav-drawer a:last-child { border-bottom: 0; }
.nav-drawer a:hover { color: var(--ink); padding-left: 6px; }

.nav-links a.active { color: var(--ink); }
.nav-links a.active::after { width: 100%; }

/* Micro tap pulse after clicking a nav item */
@keyframes nav-tap {
    0% { transform: scale(1); }
    35% { transform: scale(0.9); }
    100% { transform: scale(1); }
}
.nav-links a.tapped,
.nav-logo.tapped,
.nav-drawer a.tapped {
    animation: nav-tap 380ms var(--ease);
    color: var(--accent-hi);
}

.nav-social {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--ink-2);
    transition-property: color, background-color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.nav-social:hover { color: var(--ink); background: var(--surface); }
.nav-social svg { width: 19px; height: 19px; }

/* Right-side action cluster: theme toggle + social + hamburger */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: -8px;
}

/* Theme toggle — same footprint as .nav-social */
.theme-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--ink-2);
    transition-property: color, background-color, transform;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.theme-toggle:hover { color: var(--ink); background: var(--surface); }
.theme-toggle:active { transform: scale(0.9); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }


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

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* =============================================
   SECTION SHELL
   ============================================= */
section { padding: 72px 0; }

#hero {
    padding: calc(var(--nav-h) + 56px) 0 64px;
}

/* Section heading: word + trailing hairline rule */
.section-title {
    display: flex;
    align-items: center;
    gap: 26px;
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 3.4vw, 2.3rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--ink);
    text-transform: lowercase;
    text-wrap: balance;
    margin-bottom: 26px;
}
.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* Section intro paragraph */
.lead {
    max-width: 68ch;
    font-size: 0.925rem;
    color: var(--ink-2);
    text-wrap: pretty;
}
.lead + .lead { margin-top: 14px; }
.lead strong { color: var(--ink); font-weight: 600; }

/* Underlined text link */
.link-underline {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.32);
    transition-property: color, border-color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.link-underline:hover { color: var(--accent-hi); border-color: var(--accent); }
.link-underline.is-mute { color: var(--ink-3); border-color: var(--line); }
html[data-theme="light"] .link-underline { border-bottom-color: rgba(20, 20, 40, 0.3); }

/* =============================================
   HERO
   ============================================= */
.hero-grid {
    display: grid;
    grid-template-columns: 1.02fr 0.98fr;
    align-items: center;
    gap: 56px;
}

.eyebrow {
    font-size: 0.95rem;
    color: var(--ink-2);
    margin-bottom: 16px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 6vw, 3.9rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 0.98;
    color: var(--ink);
    text-wrap: balance;
}

.hero-role {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    font-size: 0.85rem;
    color: var(--ink-3);
}
.hero-role i { font-style: normal; color: var(--line); }

.hero-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 26px;
    margin-top: 30px;
}

.hero-portrait {
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: linear-gradient(160deg, #1b1b28, #0f0f18);
    aspect-ratio: 3 / 4;
    max-height: 500px;
    max-width: 88%;
    justify-self: end;
    width: 100%;
}
html[data-theme="light"] .hero-portrait {
    background: linear-gradient(160deg, #e4e6f1, #d3d8ea);
}
.hero-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    outline: none;
}


/* =============================================
   ABOUT - focus columns
   ============================================= */
.focus-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 46px;
}
.focus {
    border-top: 1px solid var(--line);
    padding-top: 20px;
    text-align: center;
}
.focus h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-wrap: balance;
}
.focus p {
    margin-top: 5px;
    font-size: 0.775rem;
    color: var(--ink-3);
    text-wrap: pretty;
}

/* =============================================
   HAIRLINE ROW LIST - shared by skills,
   experience, education
   ============================================= */
.row-list { border-top: 1px solid var(--line); }
.row-list--spaced { margin-top: 40px; }
.row-item {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 8px 30px;
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
    transition-property: background-color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.row-item:hover { background-color: rgba(255, 255, 255, 0.015); }
html[data-theme="light"] .row-item:hover { background-color: rgba(20, 20, 60, 0.03); }

.row-label {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-wrap: balance;
}

/* Tag chips */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.tag {
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    padding: 4px 11px;
    white-space: nowrap;
}


/* =============================================
   EXPERIENCE & EDUCATION - row content
   ============================================= */
.row-date {
    font-size: 0.775rem;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    padding-top: 3px;
}
.row-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-wrap: balance;
}
.row-sub {
    font-size: 0.8rem;
    color: var(--ink-3);
    margin-top: 2px;
}
.bullets {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bullets li {
    position: relative;
    padding-left: 18px;
    font-size: 0.85rem;
    color: var(--ink-2);
    text-wrap: pretty;
}
.bullets li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 11px;
    width: 8px;
    height: 1px;
    background: var(--ink-3);
}

/* =============================================
   GLOWING TIMELINE — experience & education
   ============================================= */
.row-list.timeline {
    border-top: 0;
    position: relative;
    margin-left: 6px;
    padding-left: 36px;
}
/* Vertical glowing rail */
.row-list.timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent-hi), var(--accent) 35%, rgba(123, 108, 255, 0.12));
    box-shadow: 0 0 12px rgba(123, 108, 255, 0.55), 0 0 34px rgba(123, 108, 255, 0.22);
}
.row-list.timeline .row-item {
    position: relative;
    border-bottom: 1px solid var(--line);
}
/* Glowing node dot — centred on the rail */
.row-list.timeline .row-item::before {
    content: "";
    position: absolute;
    left: -34px;
    top: 30px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px rgba(123, 108, 255, 0.12), 0 0 12px rgba(123, 108, 255, 0.8);
    transition-property: background-color, box-shadow, transform;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
/* Node lights up once the item reveals / on hover */
.js .row-list.timeline .row-item::before {
    background: var(--bg);
}
.js .row-list.timeline .row-item.visible::before,
.row-list.timeline .row-item:hover::before {
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(123, 108, 255, 0.16), 0 0 16px rgba(123, 108, 255, 1), 0 0 42px rgba(123, 108, 255, 0.5);
}
/* Latest entry gets a soft ping */
.row-list.timeline .row-item:first-child::after {
    content: "";
    position: absolute;
    left: -34px;
    top: 30px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--accent-hi);
    opacity: 0;
    pointer-events: none;
    animation: timeline-ping 2.6s var(--ease) infinite;
}
@keyframes timeline-ping {
    0% { transform: scale(1); opacity: 0.7; }
    70%, 100% { transform: scale(2.4); opacity: 0; }
}
/* Date gets a subtle pill to sit on the timeline */
.row-list.timeline .row-date {
    color: var(--ink-2);
}
.js .row-list.timeline .row-item.visible .row-date {
    color: var(--accent-hi);
}

/* =============================================
   WORK / PROJECTS
   ============================================= */
.work-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 44px 32px;
    margin-top: 46px;
}
/* Glass detail cards — no imagery, everything inside */
.work-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 26px;
    border-radius: var(--r-lg);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    transition-property: transform, border-color, box-shadow;
    transition-duration: 280ms;
    transition-timing-function: var(--ease);
}
/* Top sheen */
.work-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 70% at 20% 0%, rgba(123, 108, 255, 0.16), transparent 60%);
    opacity: 0.9;
    pointer-events: none;
    transition-property: opacity;
    transition-duration: 280ms;
    transition-timing-function: var(--ease);
}
.work-card:hover {
    transform: translateY(-4px);
    border-color: rgba(154, 141, 255, 0.5);
    box-shadow: 0 28px 60px -28px rgba(123, 108, 255, 0.35);
}
.work-card:hover::after { opacity: 1; }
html[data-theme="light"] .work-card {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.55));
    border-color: rgba(20, 20, 40, 0.1);
    box-shadow: 0 20px 45px -30px rgba(60, 60, 120, 0.25);
}
html[data-theme="light"] .work-card::after {
    background: radial-gradient(120% 70% at 20% 0%, rgba(95, 77, 240, 0.12), transparent 60%);
}

.work-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.work-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: var(--r-sm);
    background: var(--accent-soft);
    border: 1px solid rgba(154, 141, 255, 0.3);
    color: var(--accent-hi);
}
.work-icon svg { width: 22px; height: 22px; }

.work-tag {
    font-size: 0.68rem;
    white-space: nowrap;
    color: var(--ink);
    background: rgba(123, 108, 255, 0.12);
    border: 1px solid rgba(154, 141, 255, 0.3);
    border-radius: var(--r-pill);
    padding: 3px 10px;
}

.work-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.work-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-wrap: balance;
}
.work-desc {
    margin-top: 7px;
    font-size: 0.845rem;
    color: var(--ink-2);
    text-wrap: pretty;
}
.work-meta {
    margin-top: 12px;
    font-size: 0.755rem;
    color: var(--ink-3);
}
.work-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: auto;
    padding-top: 16px;
}
.work-links a {
    font-size: 0.775rem;
    font-weight: 500;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
    transition-property: color, border-color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.work-links a:hover { color: var(--accent-hi); border-color: var(--accent); }


/* =============================================
   CONTACT
   ============================================= */
/* Social link cards */
.social-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 40px;
}
.social-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    transition-property: transform, border-color, background-color;
    transition-duration: 280ms;
    transition-timing-function: var(--ease);
}
.social-card:hover {
    transform: translateY(-4px);
    border-color: rgba(154, 141, 255, 0.5);
}
.social-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-hi);
}
.social-icon svg { width: 20px; height: 20px; }
.social-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.social-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.social-handle {
    font-size: 0.75rem;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.social-arrow {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 1rem;
    color: var(--ink-3);
    transition-property: color, transform;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.social-card:hover .social-arrow { color: var(--accent-hi); transform: translate(2px, -2px); }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 32px 0 44px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.footer-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.footer-social { display: flex; gap: 4px; }
.footer-social a {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--ink-3);
    transition-property: color, background-color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.footer-social a:hover { color: var(--ink); background: var(--surface); }
.footer-social svg { width: 17px; height: 17px; }


/* =============================================
   SCROLL PROGRESS + MOTION SYSTEM
   ============================================= */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 120;
    height: 2px;
    background: transparent;
    pointer-events: none;
}
.scroll-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hi));
    transform-origin: 0 50%;
    transform: scaleX(0);
}

/* Navbar hide-on-scroll-down (JS toggles .is-hidden) */
#navbar { transition-property: background-color, border-color, transform; }
#navbar.is-hidden { transform: translateY(-100%); }

/* =============================================
   SCROLL REVEAL — variants via data-reveal
   ============================================= */
.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition-property: opacity, transform;
    transition-duration: 550ms;
    transition-timing-function: var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
}
.js .reveal[data-reveal="left"] { transform: translateX(-32px); }
.js .reveal[data-reveal="right"] { transform: translateX(32px); }
.js .reveal[data-reveal="scale"] { transform: translateY(18px) scale(0.96); }
.js .reveal[data-reveal="fade"] { transform: none; }
.js .reveal.visible {
    opacity: 1;
    transform: none;
}
.js .reveal-delay-1 { --reveal-delay: 60ms; }
.js .reveal-delay-2 { --reveal-delay: 120ms; }
.js .reveal-delay-3 { --reveal-delay: 180ms; }

/* Section rule draws itself once the heading reveals */
.js .section-title::after {
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 900ms var(--ease) 120ms;
}
.js .section-title.visible::after { transform: scaleX(1); }

/* Glow sweep on the title you just landed on */
@keyframes title-ping {
    0%, 100% { background: var(--line); box-shadow: none; }
    30% { background: var(--accent-hi); box-shadow: 0 0 14px rgba(123, 108, 255, 0.9); }
}
.section-title.arrived::after { animation: title-ping 900ms var(--ease); }

/* =============================================
   HERO ENTRANCE — line-mask title + ambient glow
   ============================================= */
#hero { position: relative; overflow: clip; }
#hero::before {
    content: "";
    position: absolute;
    top: -180px;
    right: -140px;
    width: 560px;
    height: 560px;
    background: radial-gradient(closest-side, rgba(123, 108, 255, 0.16), transparent 70%);
    pointer-events: none;
    animation: hero-glow-drift 14s ease-in-out infinite alternate;
}
html[data-theme="light"] #hero::before {
    background: radial-gradient(closest-side, rgba(95, 77, 240, 0.12), transparent 70%);
}
@keyframes hero-glow-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(-60px, 50px, 0) scale(1.12); }
}

.hero-title .line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.08em;
    margin-bottom: -0.08em;
}
.hero-title .line > span {
    display: block;
    transform: translateY(110%);
}
.js body.body-loaded .hero-title .line > span {
    animation: hero-line-up 900ms var(--ease) forwards;
}
.js body.body-loaded .hero-title .line:nth-child(2) > span { animation-delay: 120ms; }
@keyframes hero-line-up {
    to { transform: translateY(0); }
}
/* If JS never runs, keep title readable */
.hero-title .line > span { animation: none; }
html:not(.js) .hero-title .line > span { transform: none; }

/* Portrait entrance + parallax-ready */
.hero-portrait {
    will-change: transform;
    box-shadow: 0 24px 70px -28px rgba(123, 108, 255, 0.45);
}
.hero-portrait img {
    transform: scale(1.06);
    opacity: 0;
    transition: transform 1200ms var(--ease), opacity 700ms ease;
}
.hero-portrait img.is-loaded {
    transform: scale(1);
    opacity: 1;
}

/* =============================================
   INTERACTIONS — tilt glare, chips, rows, CTA
   ============================================= */
.work-card { perspective: 900px; }
/* Cursor-following glare while tilting (position set from JS) */
.work-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.12), transparent 55%);
    opacity: 0;
    transition: opacity 280ms var(--ease);
    pointer-events: none;
}
.work-card.is-tilting::before { opacity: 1; }
.work-card.is-tilting { transition-duration: 60ms; }

.tag {
    transition-property: color, background-color, border-color, transform;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
.tag:hover {
    color: var(--ink);
    border-color: rgba(154, 141, 255, 0.55);
    background: var(--accent-soft);
    transform: translateY(-2px);
}

.row-item { transition-property: background-color, transform; }
.row-item:hover { transform: translateX(3px); }

/* Shine sweep on social cards */
.social-card { position: relative; overflow: hidden; }
.social-card::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60%;
    left: -80%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.16), transparent);
    transform: skewX(-18deg);
    transition: left 600ms var(--ease);
    pointer-events: none;
}
.social-card:hover::after { left: 130%; }

/* Back-to-top */
#toTop {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 110;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(18, 18, 28, 0.85);
    color: var(--ink);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition-property: opacity, transform, visibility, border-color, background-color;
    transition-duration: var(--dur);
    transition-timing-function: var(--ease);
}
#toTop svg { width: 18px; height: 18px; }
#toTop:hover { border-color: var(--accent); background: var(--accent-soft); }
#toTop.show { opacity: 1; visibility: visible; transform: translateY(0); }
html[data-theme="light"] #toTop { background: rgba(255, 255, 255, 0.9); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 980px) {
    .nav-links { display: none; }
    .nav-toggle { display: flex; }
}

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; gap: 38px; }
    .hero-portrait { width: 100%; max-width: 440px; max-height: none; justify-self: center; margin-inline: auto; }
    .work-grid { grid-template-columns: 1fr; gap: 38px; }
    .focus-grid { grid-template-columns: 1fr; gap: 26px; margin-top: 36px; }
    .focus { text-align: left; }
}

@media (max-width: 700px) {
    section { padding: 56px 0; }
    #hero { padding: calc(var(--nav-h) + 36px) 0 48px; }
    .row-item { grid-template-columns: 1fr; gap: 12px; }
    .row-date { padding-top: 0; }
    .row-list.timeline { padding-left: 30px; margin-left: 2px; }
    .row-list.timeline .row-item::before,
    .row-list.timeline .row-item:first-child::after { left: -29px; top: 28px; }
    .social-grid { grid-template-columns: 1fr; }
    .section-title { gap: 16px; }
}

@media (max-width: 460px) {
    :root { --gutter: 20px; }
    .nav-social { display: none; }
    .footer-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
    .js .section-title::after { transform: none; transition: none; }
    .hero-title .line > span { transform: none !important; animation: none !important; }
    .hero-portrait img { transform: none; opacity: 1; transition: none; }
    #hero::before { animation: none; }
    .row-list.timeline .row-item:first-child::after { animation: none; display: none; }
    .scroll-progress { display: none; }
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

