/* =====================================================================
   GADTAN — DESIGN SYSTEM
   Shared tokens, primitives and layout used by every public page.
   ===================================================================== */

:root {
    /* --- Surfaces --------------------------------------------------- */
    --bg:            #07070C;
    --bg-elevated:   #0C0C14;
    --surface:       rgba(255, 255, 255, 0.035);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --border:        rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);

    /* --- Text ------------------------------------------------------- */
    --text:          #F5F7FA;
    --text-muted:    #98A2B3;
    --text-faint:    #667085;

    /* --- Accents ---------------------------------------------------- */
    --indigo:        #6366F1;
    --violet:        #8B5CF6;
    --blue:          #3B82F6;
    --teal:          #14B8A6;
    --amber:         #F59E0B;
    --rose:          #F43F5E;
    --emerald:       #10B981;

    --accent:        var(--indigo);
    --accent-soft:   rgba(99, 102, 241, 0.14);
    --gradient:      linear-gradient(135deg, var(--indigo), var(--violet));
    --gradient-text: linear-gradient(120deg, #FFFFFF 10%, #A5B4FC 55%, #C4B5FD 100%);

    /* --- Elevation -------------------------------------------------- */
    --shadow-sm:  0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-md:  0 16px 40px rgba(0, 0, 0, 0.45);
    --shadow-lg:  0 32px 80px rgba(0, 0, 0, 0.55);
    --glow:       0 0 40px rgba(99, 102, 241, 0.28);

    /* --- Shape ------------------------------------------------------ */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;
    --r-xl: 32px;
    --r-pill: 999px;

    /* --- Motion ----------------------------------------------------- */
    --ease:        cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --t-fast: 0.18s var(--ease);
    --t-base: 0.32s var(--ease);
    --t-slow: 0.6s var(--ease);

    /* --- Type ------------------------------------------------------- */
    --font-display: 'Outfit', 'Space Grotesk', system-ui, sans-serif;
    --font-body:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

    /* --- Layout ----------------------------------------------------- */
    --container: 1240px;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
    --header-h: 76px;
}

/* Accent variants used by category theming */
.accent-blue   { --accent: var(--blue);   --accent-soft: rgba(59, 130, 246, 0.14); }
.accent-violet { --accent: var(--violet); --accent-soft: rgba(139, 92, 246, 0.14); }
.accent-teal   { --accent: var(--teal);   --accent-soft: rgba(20, 184, 166, 0.14); }
.accent-amber  { --accent: var(--amber);  --accent-soft: rgba(245, 158, 11, 0.14); }
.accent-rose   { --accent: var(--rose);   --accent-soft: rgba(244, 63, 94, 0.14); }

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 24px);
    -webkit-text-size-adjust: 100%;
    /* Contain sideways overflow on the root: setting it on <body> would turn
       the body into the scroll container and break window scrolling. */
    overflow-x: hidden;
}

/* "clip" contains overflow without creating a scroll container, which keeps
   position: sticky and smooth scrolling intact. */
@supports (overflow: clip) {
    html { overflow-x: clip; }
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

::selection { background: rgba(99, 102, 241, 0.35); color: #fff; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #23233a; border-radius: var(--r-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--indigo); }

/* =====================================================================
   LAYOUT
   ===================================================================== */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.container--narrow { max-width: 900px; }

.section { padding-block: clamp(4rem, 9vw, 7.5rem); }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }

.stack   { display: flex; flex-direction: column; }
.grid    { display: grid; gap: clamp(1rem, 2vw, 1.75rem); }
.grid-2  { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3  { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4  { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

.skip-link {
    position: absolute;
    left: 50%;
    top: -100px;
    transform: translateX(-50%);
    background: var(--indigo);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 var(--r-md) var(--r-md);
    font-weight: 600;
    z-index: 3000;
    transition: top var(--t-fast);
}
.skip-link:focus { top: 0; }

/* =====================================================================
   AMBIENT SPACE FIELD

   A fixed backdrop behind every page: a drifting coordinate grid, three
   parallaxed star layers, soft nebulae and the occasional shooting star.
   Star layers are repeating radial-gradients rather than hundreds of
   box-shadows, so the whole field is a handful of composited layers.
   ===================================================================== */
.space {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse 120% 80% at 50% -10%, rgba(99, 102, 241, 0.13), transparent 60%),
        radial-gradient(ellipse 90% 60% at 85% 110%, rgba(139, 92, 246, 0.10), transparent 62%);
}

/* --- Coordinate grid ------------------------------------------------ */
.space__grid {
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 25%, transparent 76%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 25%, transparent 76%);
    animation: space-grid 42s linear infinite;
}

/* --- Star layers ---------------------------------------------------- */
.space__stars {
    position: absolute;
    inset: -20%;
    background-repeat: repeat;
}
.space__stars--far {
    background-image:
        radial-gradient(1px 1px at 18% 24%, rgba(255, 255, 255, 0.55), transparent 100%),
        radial-gradient(1px 1px at 62% 12%, rgba(255, 255, 255, 0.42), transparent 100%),
        radial-gradient(1px 1px at 82% 58%, rgba(255, 255, 255, 0.50), transparent 100%),
        radial-gradient(1px 1px at 34% 76%, rgba(255, 255, 255, 0.38), transparent 100%),
        radial-gradient(1px 1px at 7%  62%, rgba(255, 255, 255, 0.45), transparent 100%),
        radial-gradient(1px 1px at 92% 31%, rgba(255, 255, 255, 0.35), transparent 100%);
    background-size: 260px 260px;
    opacity: 0.55;
    animation: space-twinkle 7s ease-in-out infinite;
}
.space__stars--mid {
    background-image:
        radial-gradient(1.4px 1.4px at 26% 44%, rgba(199, 210, 254, 0.85), transparent 100%),
        radial-gradient(1.4px 1.4px at 71% 18%, rgba(255, 255, 255, 0.75), transparent 100%),
        radial-gradient(1.4px 1.4px at 48% 82%, rgba(196, 181, 253, 0.70), transparent 100%),
        radial-gradient(1.4px 1.4px at 12% 8%,  rgba(255, 255, 255, 0.62), transparent 100%);
    background-size: 420px 420px;
    opacity: 0.6;
    animation: space-twinkle 11s ease-in-out infinite reverse;
}
.space__stars--near {
    background-image:
        radial-gradient(2px 2px at 55% 32%, rgba(255, 255, 255, 0.95), transparent 100%),
        radial-gradient(2px 2px at 15% 70%, rgba(165, 180, 252, 0.85), transparent 100%),
        radial-gradient(2.2px 2.2px at 88% 86%, rgba(255, 255, 255, 0.80), transparent 100%);
    background-size: 700px 700px;
    opacity: 0.7;
    animation: space-twinkle 5s ease-in-out infinite;
}

/* --- Nebulae -------------------------------------------------------- */
/* The wash is drawn entirely by the gradient's own falloff. An extra
   filter: blur() here would cost a full-size offscreen buffer per nebula,
   re-rendered every time the layer moves, for no visible gain. */
.space__nebula {
    position: absolute;
    border-radius: 50%;
    opacity: 0.5;
}
.space__nebula--1 { width: 860px; height: 860px; top: -340px; right: -280px; background: radial-gradient(circle closest-side, rgba(99, 102, 241, 0.26), rgba(99, 102, 241, 0.11) 45%, transparent 78%); }
.space__nebula--2 { width: 760px; height: 760px; top: 36%;    left: -330px;  background: radial-gradient(circle closest-side, rgba(139, 92, 246, 0.21), rgba(139, 92, 246, 0.09) 45%, transparent 78%); }
.space__nebula--3 { width: 660px; height: 660px; bottom: -280px; right: 6%;  background: radial-gradient(circle closest-side, rgba(20, 184, 166, 0.16), rgba(20, 184, 166, 0.07) 45%, transparent 78%); }

/* --- Shooting stars -------------------------------------------------
   A 2px streak with a tapered tail, fired across the field on a long
   loop. The tail is drawn as a gradient on ::before so the head stays a
   crisp point. ------------------------------------------------------- */
.space__shooter {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.7);
    opacity: 0;
    animation: space-shoot 9s linear infinite;
}
.space__shooter::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 130px;
    height: 1px;
    transform: translateY(-50%);
    background: linear-gradient(to left, rgba(255, 255, 255, 0.85), transparent);
}
.space__shooter--1 { top: 12%; left: 78%; animation-delay: 1s;  }
.space__shooter--2 { top: 38%; left: 92%; animation-delay: 6s;  animation-duration: 12s; }
.space__shooter--3 { top: 66%; left: 60%; animation-delay: 14s; animation-duration: 15s; }

/* --- Horizon glow ---------------------------------------------------- */
.space__horizon {
    position: absolute;
    inset-inline: -20%;
    bottom: -30%;
    height: 60%;
    border-radius: 50% 50% 0 0;
    background: radial-gradient(ellipse at 50% 100%, rgba(99, 102, 241, 0.16), rgba(99, 102, 241, 0.06) 38%, transparent 70%);
}

@keyframes space-grid {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-64px, -64px, 0); }
}
@keyframes space-twinkle {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 0.85; }
}
@keyframes space-shoot {
    0%      { opacity: 0; transform: translate3d(0, 0, 0) rotate(18deg); }
    2%      { opacity: 1; }
    14%     { opacity: 1; }
    18%     { opacity: 0; transform: translate3d(-620px, 210px, 0) rotate(18deg); }
    100%    { opacity: 0; transform: translate3d(-620px, 210px, 0) rotate(18deg); }
}

@media (prefers-reduced-motion: reduce) {
    .space__grid,
    .space__stars { animation: none; }
    .space__shooter { display: none; }
}

/* The star layers are the least useful part of the effect on a small
   screen and the most expensive to composite, so the densest one goes. */
@media (max-width: 640px) {
    .space__stars--near { display: none; }
    .space__nebula--3 { display: none; }
}

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

   Three zones: brand, centred primary navigation, tools. Every link is
   visible at every width — no drawer. Below 900px the bar stacks into two
   rows and the navigation becomes a centred scrollable strip.
   ===================================================================== */
.site-header {
    position: fixed;
    inset-inline: 0;
    top: 0;
    z-index: 1000;
    transition: background var(--t-base), border-color var(--t-base);
    border-bottom: 1px solid transparent;
}
.site-header.is-stuck {
    background: rgba(7, 7, 12, 0.82);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-bottom-color: var(--border);
}

/* A three-column grid with equal outer tracks: the navigation is centred on
   the header itself, not on whatever space the brand happens to leave. */
.nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    height: var(--header-h);
}

.brand { display: inline-flex; align-items: center; gap: 0.65rem; min-width: 0; }
.brand img {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    object-fit: cover;
    border: 1px solid var(--border-strong);
}
.brand__name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Used by the footer brand block, which has room for the second line. */
.brand__role {
    display: block;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.nav__tools { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

/* --- Primary navigation --------------------------------------------- */
.nav__primary { min-width: 0; }
.nav__list {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding: 4px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}
.nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border-radius: var(--r-pill);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color var(--t-fast), background var(--t-fast);
}
.nav__link i { font-size: 0.85em; opacity: 0.7; transition: opacity var(--t-fast); }
.nav__link:hover { color: var(--text); background: var(--surface-hover); }
.nav__link:hover i { opacity: 1; }
.nav__link.is-active {
    color: #fff;
    background: var(--gradient);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.32);
}
.nav__link.is-active i { opacity: 1; }

/* --- Compact action buttons (sign in, dashboard, sign out) ----------- */
.nav__action {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.nav__action:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-strong); }
.nav__action--danger { color: #FDA4AF; }
.nav__action--danger:hover { color: #fff; background: rgba(244, 63, 94, 0.22); border-color: rgba(244, 63, 94, 0.4); }

/* --- Language switcher --------------------------------------------- */
.lang { position: relative; }
.lang__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    height: 44px;
    padding-inline: 0.8rem;
    border-radius: 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.lang__toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }
.lang.is-open .lang__toggle { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }

.lang__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 200px;
    padding: 0.4rem;
    background: #101019;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
    z-index: 1300;
}
.lang.is-open .lang__menu { opacity: 1; visibility: visible; transform: translateY(0); }

.lang__option {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all var(--t-fast);
}
.lang__option:hover { background: var(--surface-hover); color: var(--text); }
.lang__option.is-current { color: var(--text); background: var(--accent-soft); }
.lang__option .badge-key {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 24px;
    padding-inline: 6px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.7rem;
    font-weight: 700;
}
.lang__option.is-current .badge-key { background: var(--accent); color: #fff; }
.lang__hint {
    padding: 0.5rem 0.75rem 0.35rem;
    font-size: 0.68rem;
    color: var(--text-faint);
    line-height: 1.4;
    border-top: 1px solid var(--border);
    margin-top: 0.3rem;
}

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1.6rem;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn i { font-size: 0.9em; }

.btn--primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.32);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(99, 102, 241, 0.42); }

.btn--ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-2px); }

.btn--quiet { background: transparent; color: var(--text-muted); padding-inline: 1rem; }
.btn--quiet:hover { color: var(--text); background: var(--surface); }

.btn--danger { background: rgba(244, 63, 94, 0.14); border-color: rgba(244, 63, 94, 0.28); color: #FDA4AF; }
.btn--danger:hover { background: rgba(244, 63, 94, 0.22); }

.btn--sm { padding: 0.55rem 1.1rem; font-size: 0.82rem; }
.btn--block { width: 100%; }

/* =====================================================================
   TYPE & SECTION HEADERS
   ===================================================================== */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.95rem;
    border-radius: var(--r-pill);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.eyebrow i { font-size: 0.85em; }

.section-head { max-width: 680px; margin-inline: auto; text-align: center; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head--left { margin-inline: 0; text-align: left; }
.section-title {
    font-size: clamp(1.9rem, 4vw, 3rem);
    margin-block: 1rem 0.85rem;
}
.section-lead { color: var(--text-muted); font-size: 1.02rem; line-height: 1.75; }

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

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: clamp(1.5rem, 3vw, 2.25rem);
    transition: transform var(--t-base), border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
}
.card--hover:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--accent) 38%, transparent);
    box-shadow: var(--shadow-md);
}
.card--flush { padding: 0; overflow: hidden; }

.icon-badge {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.15rem;
    flex-shrink: 0;
}
.icon-badge--sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
}

/* --- Statistics ----------------------------------------------------- */
.stat { display: flex; align-items: flex-start; gap: 1rem; }
.stat__value {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}
.stat__label { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.35rem; }

/* --- Skill meters --------------------------------------------------- */
.meter { margin-bottom: 1.35rem; }
.meter__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.meter__value { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.meter__track {
    height: 6px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}
.meter__fill {
    height: 100%;
    width: 0;
    border-radius: var(--r-pill);
    background: var(--gradient);
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
    transition: width 1.1s var(--ease);
}
.meter__note { font-size: 0.78rem; color: var(--text-faint); margin-top: 0.45rem; line-height: 1.55; }

/* --- Project cards --------------------------------------------------- */
.project-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: transform var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
}
.project-card:hover {
    transform: translateY(-6px);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: var(--shadow-md);
}
.project-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #0B0B13;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.project-card__media[data-fit="wide"] { aspect-ratio: 16 / 10; }
.project-card__media img,
.project-card__media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--t-slow), filter var(--t-slow);
}
.project-card__media[data-fit="contain"] img { object-fit: contain; padding: 14px; }

/* --- Live prototype thumbnail ----------------------------------------
   The iframe is laid out four times the card's width and scaled back to a
   quarter, so the page inside sees a ~1280px desktop viewport instead of a
   phone-sized one and renders its real desktop design. --------------- */
.project-card__frame {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #fff;
    transition: transform var(--t-slow);
}
.project-card__frame iframe {
    width: 400%;
    height: 400%;
    border: 0;
    transform: scale(0.25);
    transform-origin: 0 0;
    /* The card is the link; the preview must never swallow the click. */
    pointer-events: none;
}
.project-card:hover .project-card__frame { transform: scale(1.04); }

.project-card__live {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--r-pill);
    background: rgba(7, 7, 12, 0.86);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--emerald);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.project-card:hover .project-card__media img,
.project-card:hover .project-card__media video { transform: scale(1.06); }

.project-card__index {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 0.25rem 0.6rem;
    border-radius: var(--r-pill);
    background: rgba(7, 7, 12, 0.8);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.project-card__lock {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 0.25rem 0.65rem;
    border-radius: var(--r-pill);
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.32);
    color: var(--amber);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.project-card__body { padding: 1.15rem 1.3rem 1.35rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.project-card__tag { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.project-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.project-card__desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.project-card__cta {
    margin-top: auto;
    padding-top: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    transition: gap var(--t-fast);
}
.project-card:hover .project-card__cta { gap: 0.8rem; }

/* --- Empty state ----------------------------------------------------- */
.empty {
    text-align: center;
    padding: clamp(3rem, 8vw, 5.5rem) 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
    background: rgba(255, 255, 255, 0.015);
}
.empty i { font-size: 2.6rem; color: var(--text-faint); margin-bottom: 1.1rem; }
.empty h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.empty p { color: var(--text-muted); font-size: 0.92rem; max-width: 420px; margin-inline: auto; }

/* =====================================================================
   FORMS
   ===================================================================== */
.field { margin-bottom: 1.15rem; }
.field > label {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 0.85rem 1.05rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 0.93rem;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 140px; line-height: 1.65; }
.field.has-error input, .field.has-error textarea { border-color: var(--rose); }
.field__error { display: block; margin-top: 0.4rem; font-size: 0.78rem; color: #FDA4AF; }
.field--honeypot { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.95rem 1.15rem;
    border-radius: var(--r-md);
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 1.5rem;
}
.alert i { margin-top: 0.15rem; }
.alert--success { background: rgba(16, 185, 129, 0.1);  border: 1px solid rgba(16, 185, 129, 0.28);  color: #6EE7B7; }
.alert--error   { background: rgba(244, 63, 94, 0.1);   border: 1px solid rgba(244, 63, 94, 0.28);   color: #FDA4AF; }
.alert--info    { background: rgba(59, 130, 246, 0.1);  border: 1px solid rgba(59, 130, 246, 0.28);  color: #93C5FD; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.site-footer {
    position: relative;
    margin-top: clamp(4rem, 8vw, 7rem);
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, transparent, rgba(99, 102, 241, 0.045));
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(3, 1fr);
    gap: clamp(2rem, 4vw, 3.5rem);
    padding-block: clamp(3rem, 6vw, 4.5rem) 2.5rem;
}
.footer-brand p { color: var(--text-muted); font-size: 0.9rem; max-width: 320px; margin-top: 1.1rem; line-height: 1.75; }
.footer-col h4 {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 1.1rem;
}
.footer-col li { margin-bottom: 0.65rem; }
.footer-col a, .footer-col span {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color var(--t-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.footer-col a:hover { color: var(--text); }

.socials { display: flex; gap: 0.6rem; margin-top: 1.5rem; }
.socials a {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all var(--t-fast);
}
.socials a:hover { color: #fff; background: var(--gradient); border-color: transparent; transform: translateY(-3px); }

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-block: 1.6rem;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 0.82rem;
}

/* =====================================================================
   UTILITY WIDGETS
   ===================================================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: var(--gradient);
    z-index: 1200;
    transform: scaleX(0);
    transform-origin: 0 50%;
}

.to-top {
    position: fixed;
    right: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--gradient);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    transition: all var(--t-base);
    z-index: 900;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translateY(-3px); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.8rem;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
}
.chip--live { color: var(--emerald); border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.1); }
.chip--live::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    50%      { opacity: 0.6; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

@keyframes float-y {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

/* =====================================================================
   PARALLAX & SCROLLYTELLING

   Elements carrying data-parallax are moved by app.js on scroll. The
   transform is written to a custom property so a decorative layer can keep
   its own static transform (centring, rotation) in the same declaration.
   ===================================================================== */
[data-parallax] {
    --px: 0px;
    --py: 0px;
    --pr: 0deg;
    transform: translate3d(var(--px), var(--py), 0) rotate(var(--pr));
    will-change: transform;
}
[data-parallax-scene] { position: relative; overflow: hidden; }

/* A soft wash that drifts behind a page header. */
.page-hero__wash,
.section__wash {
    position: absolute;
    z-index: -1;
    pointer-events: none;
    inset-inline: 50%;
    top: -18%;
    width: min(880px, 120%);
    height: 420px;
    translate: -50% 0;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, var(--accent-soft), transparent 82%);
    opacity: 0.85;
}

html.scroll-lock,
html.scroll-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    /* Parallax and the scrollytelling stage collapse to a plain document. */
    [data-parallax] { --px: 0px !important; --py: 0px !important; --pr: 0deg !important; }
}

/* =====================================================================
   SCROLL REVEAL
   ===================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
/* Between 1180px and 900px the three-column bar still fits, but only once
   the nav pills give up their icons and some padding. */
@media (max-width: 1180px) {
    .nav__link { padding-inline: 0.72rem; font-size: 0.82rem; }
    .nav__link i { display: none; }
}

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

/* Two rows: brand and tools on top, the navigation centred underneath as a
   scrollable strip. `width: max-content` plus `margin-inline: auto` centres
   the pills when they fit and lets them scroll when they do not — which
   `justify-content: center` cannot do inside a scroll container. */
@media (max-width: 900px) {
    :root { --header-h: 124px; }

    .nav {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand tools"
            "primary primary";
        height: auto;
        row-gap: 0.6rem;
        padding-block: 0.7rem 0.75rem;
    }
    .brand       { grid-area: brand; }
    .nav__tools  { grid-area: tools; }
    .nav__primary {
        grid-area: primary;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        margin-inline: calc(var(--gutter) * -1);
        padding-inline: var(--gutter);
    }
    .nav__primary::-webkit-scrollbar { display: none; }
    .nav__list { width: max-content; margin-inline: auto; }
    .nav__link i { display: inline; }

    /* The bar is now tall enough to sit over content, so it always needs a
       surface behind it rather than only once the page has scrolled. */
    .site-header {
        background: rgba(7, 7, 12, 0.78);
        backdrop-filter: blur(18px) saturate(150%);
        -webkit-backdrop-filter: blur(18px) saturate(150%);
        border-bottom-color: var(--border);
    }
}

@media (max-width: 480px) {
    :root { --header-h: 118px; }
    .nav__action { width: 40px; height: 40px; }
    .lang__toggle { height: 40px; padding-inline: 0.62rem; }
    .nav__link { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
}

@media (max-width: 640px) {
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { justify-content: center; text-align: center; }
    .brand__role { display: none; }
}

/* =====================================================================
   POWER BUDGET

   The ambient field and the orbit are decorative loops that otherwise run
   for as long as the page is open. Two switches turn them off:

   .is-idle    set by app.js while the tab is hidden, so a backgrounded tab
               stops asking the compositor for frames.
   .perf-lite  set by the inline probe in layout.php on machines that report
               few cores / little memory, or by ?lite=1. Everything that
               costs a frame or an offscreen buffer collapses to a static
               equivalent, which is what keeps a low-end laptop cool.
   ===================================================================== */
html.is-idle *,
html.is-idle *::before,
html.is-idle *::after {
    animation-play-state: paused !important;
}

/* --- Low-power mode ------------------------------------------------- */
html.perf-lite .space__grid,
html.perf-lite .space__stars,
html.perf-lite .orbit__ring,
html.perf-lite .orbit__pulse,
html.perf-lite .orbit__node-inner,
html.perf-lite .music__eq i,
html.perf-lite .chip--live::before {
    animation: none !important;
}
html.perf-lite .space__shooter,
html.perf-lite .space__stars--near,
html.perf-lite .space__nebula--3 {
    display: none;
}

/* Live blur is the single most expensive thing on the page; an opaque plate
   reads the same at these opacities. */
html.perf-lite .site-header.is-stuck,
html.perf-lite .auth-card,
html.perf-lite .viewer__arrow {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
html.perf-lite .site-header.is-stuck { background: rgba(7, 7, 12, 0.97); }
html.perf-lite .hero__glow { filter: none; opacity: 0.3; }

/* Parallax writes a custom property per element on every scroll frame. */
html.perf-lite [data-parallax] {
    --px: 0px !important;
    --py: 0px !important;
    --pr: 0deg !important;
}
