/* Shared site stylesheet extracted from inline styles */
:root {
    /* Dark foundation with a deep purple brand and rich dark yellow accent */
    --bg: #08050a;
    /* very dark background with purple undertone */
    --surface: #0f0914;
    /* surface slightly lighter with warm purple hint */
    --text: #efe9f8;
    /* soft, slightly warm off-white */
    --muted: #bfb3d0;
    /* muted pale lilac for secondary text */
    --line: #24182b;
    /* subtle dark divider with purple tinge */
    --brand: #5a2d8f;
    /* deep purple — primary visual identity */
    --accent: #d9b300;
    /* rich, dark yellow for CTAs and highlights */
    --accent-ink: #231700;
    /* ink color to sit on top of accent for readability */
    --shadow: 0 10px 36px rgba(17, 6, 40, 0.6);
    --radius: 10px;
    --maxw: 1120px;
}

/* Subtle film grain texture overlay for depth (very low opacity) */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px), radial-gradient(rgba(0, 0, 0, 0.01) 1px, transparent 1px);
    background-size: 3px 3px, 6px 6px;
    mix-blend-mode: overlay;
    opacity: 0.6;
    z-index: 0;
}

/* Decorative layered background: subtle color washes using brand and accent */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(800px 400px at 10% 20%, color-mix(in oklab, var(--brand) 30%, transparent) 0%, transparent 40%),
        radial-gradient(600px 360px at 85% 70%, color-mix(in oklab, var(--accent) 20%, transparent) 0%, transparent 45%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.65));
    background-blend-mode: screen, screen, normal;
    filter: blur(24px) saturate(120%);
    opacity: 0.85;
    transform: translate3d(0, 0, 0);
    transition: opacity 360ms ease;
}

@keyframes bg-wander {
    0% {
        transform: translate3d(-2%, -1%, 0) scale(1);
    }

    50% {
        transform: translate3d(2%, 1.5%, 0) scale(1.02);
    }

    100% {
        transform: translate3d(-2%, -1%, 0) scale(1);
    }
}

/* Gentle drifting for depth; reduce motion for accessibility */
@media (prefers-reduced-motion: no-preference) {
    body::before {
        animation: bg-wander 40s ease-in-out infinite alternate;
    }
}

/* High contrast / reduced background for accessibility */
@media (prefers-contrast: more) {
    body::before {
        opacity: 0.35;
        filter: none;
    }
}

/* Glass-like card surface variant — useful for highlighted panels */
.card--glass {
    background: linear-gradient(180deg, color-mix(in oklab, rgba(255, 255, 255, 0.02) 8%, transparent) 0%, color-mix(in oklab, var(--surface) 76%, rgba(0, 0, 0, 0.12) 20%) 100%);
    backdrop-filter: blur(6px) saturate(120%);
    border: 1px solid color-mix(in oklab, var(--line) 60%, var(--brand) 6%);
}

/* Animated CTA gradient for primary button (subtle) */
.btn.primary {
    background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 60%, var(--brand) 10%), color-mix(in oklab, var(--accent) 40%, #000000 10%));
    background-size: 200% 100%;
}

.btn.primary:hover {
    background-position: 100% 0;
}

/* Section accent bar */
.section-accent {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-accent::before {
    content: '';
    width: 6px;
    height: 28px;
    background: linear-gradient(180deg, var(--brand), var(--accent));
    border-radius: 4px;
    display: inline-block;
}

/* Card overlay on hover for subtle depth */
.card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    transition: opacity 260ms ease;
    opacity: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.06));
}

.card:hover::after {
    opacity: 0.7;
}

/* Scroll progress indicators */
/* Top progress bar */
.scroll-progress-top {
    position: fixed;
    left: 0;
    top: 0;
    height: 3px;
    width: 100%;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
}

.scroll-progress-top .bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    transition: width 120ms linear;
}

/* Side progress for project article reading */
.project-progress-side {
    position: fixed;
    right: 28px;
    top: 120px;
    width: 8px;
    height: calc(100vh - 240px);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    overflow: hidden;
    z-index: 9998;
    display: none;
    /* enabled only on project pages (hidden by default) */
}

.project-progress-side .fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, var(--brand), var(--accent));
    transition: height 120ms linear;
}

@media (min-width: 900px) {
    .project-progress-side {
        /* intentionally disabled — top progress bar is sufficient */
        display: none !important;
    }
}

/* Extra override: hide RHS progress on project pages to avoid duplicate indicators */
.project .project-progress-side,
.project-progress-side {
    display: none !important;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 240ms ease, color 240ms ease;
}

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero */
#hero {
    padding-top: clamp(60px, 10vh, 140px);
    padding-bottom: clamp(48px, 8vw, 84px);
}

#hero h1 {
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.02em;
}

#hero .lead {
    max-width: 760px;
    opacity: 0.95;
}

#hero .actions {
    margin-top: 20px;
}

/* Decorative hero ornament and animated underline (subtle) */
#hero h1 {
    position: relative;
    z-index: 1;
}

#hero h1::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 6px;
    width: 64px;
    height: 42px;
    background: linear-gradient(135deg, color-mix(in oklab, var(--brand) 70%, transparent), color-mix(in oklab, var(--accent) 60%, transparent));
    opacity: 0.06;
    transform: rotate(-8deg);
    border-radius: 8px;
    pointer-events: none;
}

#hero h1::after {
    content: '';
    display: block;
    width: 64px;
    height: 6px;
    margin-top: 18px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    border-radius: 6px;
    transform-origin: left;
    transform: scaleX(0);
    opacity: 0.95;
    transition: transform 600ms cubic-bezier(.2, .9, .2, 1) 160ms;
}

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

    /* add a helper class `.in-view` on the hero (via JS) to reveal the underline */
    #hero.in-view h1::after {
        transform: scaleX(1);
    }
}

/* Navigation */
nav a {
    position: relative;
    padding: 8px 6px;
}

nav a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: transparent;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 240ms cubic-bezier(.2, .9, .2, 1), background 240ms ease;
}

nav a:hover::after,
nav a:focus::after {
    transform: scaleX(1);
    background: color-mix(in oklab, var(--accent) 70%, var(--brand) 10%);
}

/* Cards: refined elevation and subtle sheen on hover */
.card {
    transition: transform 260ms cubic-bezier(.2, .9, .2, 1), box-shadow 260ms ease, border-color 260ms ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 46px rgba(6, 3, 20, 0.6);
    border-color: color-mix(in oklab, var(--brand) 40%, var(--line) 40%);
}

.card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 40%;
    pointer-events: none;
    background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 6%, transparent) 0%, transparent 100%);
    opacity: 0.03;
    border-radius: inherit;
}

/* Card link / cta styling */
.card-link h3 {
    color: var(--text);
    margin-bottom: 6px;
}

.cta {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.cta:hover {
    text-decoration: underline;
}

/* Buttons subtle glow */
.btn {
    transition: box-shadow 220ms ease, transform 180ms ease, background 200ms ease, color 200ms ease;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px color-mix(in oklab, var(--brand) 25%, rgba(0, 0, 0, 0.55));
}

/* Typographic refinements */
h1,
h2,
h3 {
    text-rendering: optimizeLegibility;
}

h3 {
    font-size: 16px;
}

/* Utility: subtle dividers for sections */
section {
    padding-top: clamp(36px, 6vw, 84px);
    padding-bottom: clamp(36px, 6vw, 84px);
}

header.site {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(6px);
    background: color-mix(in oklab, var(--bg) 88%, transparent);
    border-bottom: 1px solid var(--line);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 0;
}

.brand {
    letter-spacing: .02em;
    font-weight: 600;
    color: var(--brand);
}

nav a {
    color: var(--text);
    text-decoration: none;
    padding: 6px 0;
    position: relative;
    color: var(--text);
}

nav a:focus,
nav a:hover {
    color: var(--accent);
    outline: none;
}

main {
    position: relative;
    z-index: 1;
}

section {
    padding: clamp(48px, 7vw, 96px) 0;
    border-bottom: 1px solid var(--line);
}

h1 {
    font-size: clamp(40px, 7.2vw, 92px);
    line-height: .95;
    letter-spacing: -0.01em;
    margin: 0 0 20px;
    font-weight: 700;
}

h2 {
    font-size: clamp(18px, 2.2vw, 22px);
    text-transform: uppercase;
    letter-spacing: .16em;
    color: var(--muted);
    margin: 0 0 28px;
}

p.lead {
    font-size: clamp(18px, 2.4vw, 22px);
    color: var(--text);
    max-width: 820px;
    margin: 0 0 28px;
}

.actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 600;
    border: 1.5px solid var(--brand);
    color: var(--brand);
    background: transparent;
}

.btn.primary {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: color-mix(in oklab, var(--accent) 60%, var(--brand) 20%);
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.two {
    grid-template-columns: 1fr;
}

@media (min-width: 720px) {
    .grid.two {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    position: relative;
    border: 1px solid color-mix(in oklab, var(--line) 60%, var(--brand) 10%);
    border-radius: var(--radius);
    background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 70%, var(--brand) 6%) 0%, color-mix(in oklab, var(--surface) 60%, #000000 20%) 100%);
    padding: 18px;
}

.card h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.card p {
    margin: 0 0 10px;
    color: var(--muted);
}

.meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 0;
}

.tag,
.badge {
    font-size: 12px;
    border: 1px solid color-mix(in oklab, var(--brand) 30%, var(--line) 70%);
    color: var(--text);
    border-radius: 999px;
    padding: 4px 8px;
    opacity: .85;
}

/* Layout helpers for project pages */
.two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 720px) {
    .two-col {
        grid-template-columns: 1fr 320px;
    }
}

.card-surface {
    background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 78%, var(--brand) 6%) 0%, color-mix(in oklab, var(--surface) 66%, #000000 20%) 100%);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

footer {
    padding: 28px 0;
    color: var(--muted);
    font-size: 13px;
}

/* Utility */
.back {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--accent);
    text-decoration: none
}

.lede {
    color: var(--muted);
    margin: 0 0 18px
}

/* Reusable lightbox component (used by project pages) */
.lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.lightbox.open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-inner {
    max-width: 94vw;
    max-height: 94vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox img {
    max-width: 94vw;
    max-height: 94vh;
    width: auto;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
    touch-action: none;
    transform-origin: center center;
    transition: transform 120ms ease;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: none;
    padding: 8px 12px;
    font-size: 20px;
    border-radius: 6px;
    cursor: pointer;
}

.lightbox-close:focus {
    outline: 2px solid color-mix(in oklab, var(--accent) 60%, var(--brand) 20%);
}

/* Hint text inside figcaption for lightbox-enabled images */
.lightbox-hint {
    font-size: 0.95rem;
    color: var(--muted);
}

/* Small decorative badge on cards to add a subtle hook */
.card .card-badge {
    position: absolute;
    right: 12px;
    top: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    background: linear-gradient(90deg, color-mix(in oklab, var(--brand) 48%, transparent), color-mix(in oklab, var(--accent) 24%, transparent));
    color: var(--text);
    font-size: 12px;
    opacity: 0.9;
    pointer-events: none;
}

/* Gentle background motion for decorative layers (very subtle) */
@keyframes bg-drift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(-6px, -4px, 0) scale(1.01);
    }

    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
}

.bg-layer {
    will-change: transform;
    animation: bg-drift 28s ease-in-out infinite alternate;
    opacity: 0.9;
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .bg-layer {
        animation: none;
    }

    #hero h1::after {
        transition: none;
        transform: scaleX(1);
    }
}

/* Better focus-visible styles for keyboard users */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.card:focus-within {
    outline: 3px solid color-mix(in oklab, var(--accent) 60%, var(--brand) 10%);
    outline-offset: 3px;
    border-radius: 8px;
}

/* Reveal-on-scroll: subtle fade-up used on section headings and cards */
.reveal {
    opacity: 0;
    transform: translateY(8px) scale(0.998);
    transition: opacity 420ms cubic-bezier(.2, .9, .2, 1), transform 420ms cubic-bezier(.2, .9, .2, 1);
    will-change: opacity, transform;
}

.reveal.in-view {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Subtle cursor focal ring (decorative, non-intrusive) */
.cursor-ring {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.6);
    transition: transform 260ms cubic-bezier(.2, .9, .2, 1), opacity 260ms ease, background 220ms ease;
    z-index: 99999;
    mix-blend-mode: screen;
    opacity: 0.7;
    display: none;
    /* enabled by JS on pointer devices */
}

/* Nav active state (scrollspy) */
nav a.active {
    color: var(--accent);
}

nav a.active::after {
    transform: scaleX(1);
    background: color-mix(in oklab, var(--accent) 70%, var(--brand) 10%);
}

/* section heading accent (small vertical bar) */
.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 22px;
    background: var(--brand);
    border-radius: 2px;
    display: inline-block;
    opacity: 0.9;
}