/* ============================================================
   FOLIO — STYLES
   Sources: portfolio_terrain_fixed.html + modal-v2.html
   ============================================================ */

/* ===== FROM portfolio_terrain_fixed.html ===== */

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: 'Inter', sans-serif;
            background: #050505;
            color: #e5e5e5;
            overflow: hidden;

            scrollbar-gutter: stable;
        }

        .font-mono { font-family: 'Space Mono', monospace; }

        .scanlines {
            position: fixed;
            inset: 0;
            background: linear-gradient(transparent 50%, rgba(0, 229, 255, 0.02) 50%);
            background-size: 100% 4px;
            pointer-events: none;
            z-index: 50;
        }

        .grid-bg {
            position: fixed;
            inset: 0;
            background-image:
                linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
            background-size: 50px 50px;
            transform: perspective(500px) rotateX(60deg) scale(2);
            transform-origin: center top;
            animation: grid-move 20s linear infinite;
            pointer-events: none;
        }

        @keyframes grid-move {
            0% { transform: perspective(500px) rotateX(60deg) scale(2) translateY(0); }
            100% { transform: perspective(500px) rotateX(60deg) scale(2) translateY(50px); }
        }

        .vignette {
            position: fixed;
            inset: 0;
            background: radial-gradient(ellipse at center, transparent 0%, #050505 70%);
            pointer-events: none;
            z-index: 10;
        }

        .login-container {
            position: relative;
            z-index: 20;
            padding: clamp(16px, 3vw, 32px);
        }

        .login-panel {
            position: relative;
            width: 100%;
            max-width: min(420px, calc(100vw - 32px));
            background: rgba(10, 10, 10, 0.8);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(0, 229, 255, 0.2);
            padding: 2.5rem;
            transform-origin: center center;
            will-change: transform, opacity;
        }

        .login-panel.animating {
            position: fixed;
            margin: 0;
            z-index: 200;
        }

        .flash-overlay {
            position: absolute;
            inset: -2px;
            border: 2px solid #00e5ff;
            opacity: 0;
            pointer-events: none;
            z-index: 100;
        }

        .flash-overlay.flashing { animation: flash-border 0.15s ease-out 3; }
        .flash-overlay.flashing-fast { animation: flash-border 0.08s ease-out 3; }
        .flash-overlay.flashing-close { animation: flash-border 0.15s ease-out 2; }

        @keyframes flash-border {
            0%, 100% { opacity: 0; }
            50% { opacity: 1; }
        }

        .corner {
            position: absolute;
            width: 12px;
            height: 12px;
            border: 1px solid rgba(0, 229, 255, 0.5);
            transition: all 0.3s ease;
        }

        .corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
        .corner-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
        .corner-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
        .corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

        .corner.flashing-border {
            border-color: #00e5ff;
            box-shadow: 0 0 10px rgba(0, 229, 255, 0.8);
        }

        .system-header { text-align: center; margin-bottom: 2rem; }

        .system-id {
            font-family: 'Space Mono', monospace;
            font-size: 9px;
            color: rgba(0, 229, 255, 0.6);
            letter-spacing: 0.3em;
            margin-bottom: 0.75rem;
        }

        .system-title {
            font-size: 1.25rem;
            font-weight: 400;
            letter-spacing: 0.25em;
            text-transform: uppercase;
            color: #fff;
            position: relative;
            display: inline-block;
        }

        .system-title::after {
            content: '';
            position: absolute;
            bottom: -8px;
            left: 50%;
            transform: translateX(-50%);
            width: 40px;
            height: 1px;
            background: #00e5ff;
            box-shadow: 0 0 10px #00e5ff;
        }

        .input-group { position: relative; margin-bottom: 1.25rem; }

        .input-label {
            font-family: 'Space Mono', monospace;
            font-size: 9px;
            color: rgba(255, 255, 255, 0.5);
            text-transform: uppercase;
            letter-spacing: 0.15em;
            margin-bottom: 0.5rem;
            display: block;
        }

        .input-field {
            width: 100%;
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.15);
            padding: 0.875rem 1rem 0.875rem 2.5rem;
            color: #fff;
            font-family: 'Space Mono', monospace;
            font-size: 13px;
            letter-spacing: 0.05em;
        }

        .input-field:focus {
            outline: none;
            border-color: #00e5ff;
            background: rgba(0, 229, 255, 0.05);
        }

        .input-icon {
            position: absolute;
            left: 0.875rem;
            top: 50%;
            transform: translateY(-50%);
            color: rgba(255, 255, 255, 0.4);
            pointer-events: none;
        }

        .password-toggle {
            position: absolute;
            right: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: rgba(255, 255, 255, 0.4);
            cursor: pointer;
            padding: 0.25rem;
        }

        .error-message {
            font-family: 'Space Mono', monospace;
            font-size: 10px;
            color: #ff0040;
            margin-top: 0.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            opacity: 0;
            transform: translateY(-5px);
            transition: all 0.3s ease;
        }

        .error-message.visible { opacity: 1; transform: translateY(0); }
        .error-message::before { content: '▲'; font-size: 8px; }

        .submit-btn {
            width: 100%;
            background: transparent;
            border: 1px solid rgba(0, 229, 255, 0.3);
            color: #00e5ff;
            font-family: 'Space Mono', monospace;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.2em;
            padding: 0.875rem;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
            margin-top: 0.5rem;
        }

        .submit-btn:hover {
            background: rgba(0, 229, 255, 0.1);
            border-color: #00e5ff;
        }

        .submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }


        #panelContent {
            position: relative;
            z-index: 2;
        }

        .system-header,
        .input-group,
        .submit-btn {
            transition: opacity 0.45s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), filter 0.45s ease;
            will-change: transform, opacity, filter;
        }

        .login-panel.deconstructing .system-header {
            opacity: 0;
            transform: translateY(-36px) scale(0.96);
            filter: blur(8px);
        }

        .login-panel.deconstructing .input-group:nth-of-type(1) {
            opacity: 0;
            transform: translateX(-48px) scale(0.97);
            filter: blur(8px);
            transition-delay: 0.05s;
        }

        .login-panel.deconstructing .input-group:nth-of-type(2) {
            opacity: 0;
            transform: translateX(48px) scale(0.97);
            filter: blur(8px);
            transition-delay: 0.12s;
        }

        .login-panel.deconstructing .submit-btn {
            opacity: 0;
            transform: translateY(34px) scaleX(0.92);
            filter: blur(8px);
            transition-delay: 0.2s;
        }

        .login-panel.frame-only {
            background: transparent;
            backdrop-filter: none;
            box-shadow: 0 0 24px rgba(0, 229, 255, 0.08);
        }

        .login-panel.frame-only #panelContent {
            opacity: 0;
            pointer-events: none;
        }

        .frame-trace {
            position: fixed;
            border: 1px solid rgba(0, 229, 255, 0.26);
            box-shadow: 0 0 18px rgba(0, 229, 255, 0.12), inset 0 0 14px rgba(0, 229, 255, 0.05);
            pointer-events: none;
            z-index: 220;
            transform-origin: center center;
            will-change: transform, opacity;
        }

        .frame-trace .corner {
            transition: none;
        }

        .diamond.blinking-frame {
            animation: flash-border 0.15s ease-out 3;
            opacity: 1;
            box-shadow: 0 0 18px rgba(0, 229, 255, 0.9);
        }

        .processing-overlay {
            position: fixed;
            inset: 0;
            background: #050505;
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.4s ease;
        }

        .processing-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .processing-text {
            font-family: 'Space Mono', monospace;
            font-size: 11px;
            color: #00e5ff;
            letter-spacing: 0.3em;
            margin-top: 1.5rem;
            height: 20px;
        }

        .processing-bar {
            width: 160px;
            height: 1px;
            background: rgba(0, 229, 255, 0.1);
            margin-top: 0.75rem;
            position: relative;
            overflow: hidden;
        }

        .processing-bar-fill {
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 0;
            background: #00e5ff;
            box-shadow: 0 0 10px #00e5ff;
            transition: width 0.1s linear;
        }

        .diamond-container {
            position: relative;
            width: 60px;
            height: 60px;
        }

        .diamond {
            position: absolute;
            width: 20px;
            height: 20px;
            border: 1px solid #00e5ff;
            transform: rotate(45deg);
            opacity: 0;
            transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .diamond:nth-child(1) { top: 0; left: 20px; }
        .diamond:nth-child(2) { top: 20px; left: 0; }
        .diamond:nth-child(3) { top: 20px; left: 40px; }

        .diamond.visible {
            opacity: 1;
            animation: diamond-pulse 1.5s ease-in-out infinite;
        }

        .diamond.white-to-cyan {
            animation: white-to-cyan 0.5s ease forwards, diamond-pulse 1.5s ease-in-out infinite 0.5s;
        }

        .diamond.converged-center {
            top: 0 !important;
            left: 20px !important;
            transform: rotate(45deg) scale(1);
            opacity: 1;
            animation: none;
        }

        .diamond.hidden-after-merge {
            opacity: 0 !important;
            animation: none !important;
        }

        .diamond.morph-to-circle {
            border-radius: 50%;
            transform: rotate(0deg) scale(1);
            width: 60px;
            height: 60px;
            top: -20px !important;
            left: 0 !important;
            background: transparent;
            animation: none;
            box-shadow: 0 0 22px rgba(0, 229, 255, 0.35);
            transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
        }

        @keyframes white-to-cyan {
            0% {
                border-color: #ffffff;
                box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
                background: rgba(255, 255, 255, 0.2);
            }
            100% {
                border-color: #00e5ff;
                box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
                background: transparent;
            }
        }

        @keyframes diamond-pulse {
            0%, 100% { transform: rotate(45deg) scale(1); opacity: 0.6; }
            50% { transform: rotate(45deg) scale(1.1); opacity: 1; }
        }


        .checkmark {
            width: 30px;
            height: 30px;
            overflow: visible;
        }

        .checkmark path {
            fill: none;
            stroke: #00e5ff;
            stroke-width: 3;
            stroke-linecap: round;
            stroke-linejoin: round;
            filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.9));
            stroke-dasharray: 40;
            stroke-dashoffset: 40;
            opacity: 0;
        }

        .checkmark.draw path {
            opacity: 1;
            animation: check-draw 0.5s ease-out forwards;
        }

        @keyframes check-draw {
            to {
                stroke-dashoffset: 0;
            }
        }

        .success-circle {
            position: absolute;
            top: 10px;
            left: 30px;
            transform: translate(-50%, -50%) scale(1);
            width: 60px;
            height: 60px;
            border: 1px solid #00e5ff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.18s linear, border-color 0.22s ease, box-shadow 0.3s ease;
            pointer-events: none;
            box-shadow: 0 0 22px rgba(0, 229, 255, 0.35);
        }

        .success-circle.visible {
            opacity: 1;
        }

        .success-circle.singularity {
            transition:
                transform 0.78s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.78s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.78s cubic-bezier(0.16, 1, 0.3, 1),
                border-radius 0.78s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.22s ease,
                box-shadow 0.22s ease,
                background 0.22s ease,
                border-color 0.22s ease;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            transform: translate(-50%, -50%) scale(0.15);
            background: #ffffff;
            border-color: #ffffff;
            box-shadow: 0 0 26px rgba(255, 255, 255, 0.95), 0 0 50px rgba(255, 255, 255, 0.6);
        }

        .singularity-flash {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255,255,255,0.82) 28%, rgba(255,255,255,0) 72%);
            transform: translate(-50%, -50%) scale(0);
            opacity: 0;
            pointer-events: none;
            z-index: 2;
        }

        .singularity-flash.fire {
            animation: singularity-flash-burst 0.34s ease-out forwards;
        }

        @keyframes singularity-flash-burst {
            0% {
                opacity: 0;
                transform: translate(-50%, -50%) scale(0.1);
            }
            25% {
                opacity: 1;
                transform: translate(-50%, -50%) scale(1.6);
            }
            100% {
                opacity: 0;
                transform: translate(-50%, -50%) scale(3.6);
            }
        }

        .reveal-line {
            position: fixed;
            top: 50%;
            height: 0;
            width: 1px;
            background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.96) 18%, rgba(255,255,255,0.96) 82%, rgba(255,255,255,0) 100%);
            box-shadow: 0 0 12px rgba(255,255,255,0.65), 0 0 24px rgba(0,229,255,0.22);
            opacity: 0;
            transform: translateX(-50%);
            z-index: 3;
            pointer-events: none;
        }

        .reveal-line.vertical-grow {
            top: 0;
            height: 100vh;
            opacity: 1;
            transition: height 0.34s cubic-bezier(0.16, 1, 0.3, 1), top 0.34s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s linear;
        }

        .reveal-line.split-left,
        .reveal-line.split-right {
            opacity: 1;
            transition: left 0.88s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s linear;
        }

        .reveal-line.fade-soft {
            opacity: 0.45;
            transition: opacity 0.3s ease;
        }

        .reveal-line.settled {
            top: 0;
            height: 100vh;
            width: 1px;
            opacity: 1;
            background: rgba(38, 38, 38, 0.4);
            box-shadow: none;
            transition: left 0.22s ease-out, background 0.2s ease-out, box-shadow 0.2s ease-out, opacity 0.2s ease-out;
        }

        .side-gradient-reveal {
            position: fixed;
            top: 0;
            bottom: 0;
            opacity: 0;
            pointer-events: none;
            z-index: 6;
            will-change: clip-path, opacity, filter;
            filter: brightness(1);
        }

        .side-gradient-reveal.left {
            left: 0;
            width: max(0px, min(var(--animated-frame-left), var(--true-vw)));
            background: linear-gradient(-90deg,
                rgba(0, 229, 255, 0.15) 0%,
                rgba(0, 229, 255, 0.02) 50%,
                transparent 100%
            );
            clip-path: inset(0 0 0 100%);
        }

        .side-gradient-reveal.right {
            right: 0;
            width: max(0px, calc(var(--true-vw) - var(--animated-frame-right)));
            background: linear-gradient(90deg,
                rgba(0, 229, 255, 0.15) 0%,
                rgba(0, 229, 255, 0.02) 50%,
                transparent 100%
            );
            clip-path: inset(0 100% 0 0);
        }

        .side-gradient-reveal.left.grow {
            animation: side-gradient-grow-left 1.05s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        .side-gradient-reveal.right.grow {
            animation: side-gradient-grow-right 1.05s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        @keyframes side-gradient-grow-left {
            0% { opacity: 0; clip-path: inset(0 0 0 100%); filter: brightness(1); }
            10% { opacity: 0.16; clip-path: inset(0 0 0 78%); filter: brightness(1.35); }
            16% { opacity: 0.05; clip-path: inset(0 0 0 86%); filter: brightness(0.95); }
            24% { opacity: 0.32; clip-path: inset(0 0 0 54%); filter: brightness(1.6); }
            31% { opacity: 0.14; clip-path: inset(0 0 0 66%); filter: brightness(1.05); }
            45% { opacity: 0.46; clip-path: inset(0 0 0 32%); filter: brightness(1.5); }
            57% { opacity: 0.22; clip-path: inset(0 0 0 44%); filter: brightness(1.02); }
            72% { opacity: 0.78; clip-path: inset(0 0 0 8%); filter: brightness(1.28); }
            100% { opacity: 1; clip-path: inset(0 0 0 0); filter: brightness(1); }
        }

        @keyframes side-gradient-grow-right {
            0% { opacity: 0; clip-path: inset(0 100% 0 0); filter: brightness(1); }
            10% { opacity: 0.16; clip-path: inset(0 78% 0 0); filter: brightness(1.35); }
            16% { opacity: 0.05; clip-path: inset(0 86% 0 0); filter: brightness(0.95); }
            24% { opacity: 0.32; clip-path: inset(0 54% 0 0); filter: brightness(1.6); }
            31% { opacity: 0.14; clip-path: inset(0 66% 0 0); filter: brightness(1.05); }
            45% { opacity: 0.46; clip-path: inset(0 32% 0 0); filter: brightness(1.5); }
            57% { opacity: 0.22; clip-path: inset(0 44% 0 0); filter: brightness(1.02); }
            72% { opacity: 0.78; clip-path: inset(0 8% 0 0); filter: brightness(1.28); }
            100% { opacity: 1; clip-path: inset(0 0 0 0); filter: brightness(1); }
        }

        .side-gradient-reveal.settled {
            width: var(--side-width);
            opacity: 1;
            filter: none;
            animation: none;
        }

                .processing-overlay.reveal-ready {
            background: transparent;
            transition: background 0.3s ease;
        }



    :root {
      --modal-close-duration: 0.5s;
      --modal-close-ease: cubic-bezier(0.7, 0, 0.84, 0);
      --bg: #050505;
      --panel: rgba(10, 10, 10, 0.86);
      --panel-2: rgba(14, 14, 14, 0.92);
      --line: rgba(255,255,255,0.10);
      --line-strong: rgba(0,229,255,0.35);
      --text: #e5e5e5;
      --muted: rgba(229,229,229,0.62);
      --soft: rgba(229,229,229,0.42);
      --accent: #00e5ff;
      --danger: #ff0040;
      --true-vw: 100vw;


    * { box-sizing: border-box; }
    @media (prefers-reduced-motion: reduce) {
      html {
        scroll-behavior: auto;
      }
    }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: Inter, sans-serif;
      overflow-x: hidden;
    }

    .font-mono { font-family: 'Space Mono', monospace; }

    .grid-bg,
    .grid-bg-soft,
    .scanlines,
    .vignette {
      position: fixed;
      inset: 0;
      pointer-events: none;
    }

    .grid-bg {
      background-image:
        linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
      background-size: 56px 56px;
      transform: perspective(600px) rotateX(60deg) scale(2.1);
      transform-origin: center top;
      animation: gridMove 24s linear infinite;
      opacity: 0.8;
    }

    .grid-bg-soft {
      background-image:
        radial-gradient(circle at 50% 20%, rgba(0,229,255,0.10), transparent 26%),
        radial-gradient(circle at 80% 60%, rgba(0,229,255,0.06), transparent 28%),
        radial-gradient(circle at 20% 75%, rgba(0,229,255,0.05), transparent 24%);
    }

    .scanlines {
      background: linear-gradient(transparent 50%, rgba(0,229,255,0.02) 50%);
      background-size: 100% 4px;
      z-index: 50;
    }

    .vignette {
      background: radial-gradient(ellipse at center, transparent 0%, rgba(5,5,5,0.18) 45%, #050505 80%);
    }

    @keyframes gridMove {
      from { transform: perspective(600px) rotateX(60deg) scale(2.1) translateY(0); }
      to   { transform: perspective(600px) rotateX(60deg) scale(2.1) translateY(56px); }
    }

    .page-shell {
      position: relative;
      z-index: 5;
      min-height: 100vh;
      padding: calc(var(--topbar-height, 52px) + 36px) 32px 80px;
    }

    .frame {
      position: fixed;
      top: 0;
      bottom: 0;
      width: 1px;
      background: linear-gradient(180deg, transparent, rgba(0,229,255,0.45), transparent);
      opacity: 0.66;
      z-index: 20;
      pointer-events: none;
    }

    .frame.left { left: var(--animated-frame-left); }
    .frame.right { right: calc(100vw - var(--animated-frame-right)); }

    .topbar {
      --topbar-height: 52px;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1200;
      border-bottom: 1px solid rgba(255,255,255,0.07);
      background: rgba(5,5,5,0.72);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
    }

    .topbar-inner {
      width: 100%;
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 32px;
      height: var(--topbar-height);
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 20px;
      box-sizing: border-box;
      font-family: 'Space Mono', monospace;
      font-size: 10px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      position: relative;
    }

    .topbar-brand,
    .topbar-actions {
      display: flex;
      align-items: center;
      gap: 16px;
      min-width: 0;
    }

    .topbar-brand {
      flex: 1 1 auto;
    }

    .topbar-actions {
      flex: 0 0 auto;
      margin-left: auto;
    }

    .topbar-id {
      display: flex;
      align-items: center;
      gap: 16px;
      min-width: 0;
      color: rgba(229,229,229,0.9);
      font-size: 11px;
      letter-spacing: 0.05em;
      text-transform: none;
      font-weight: 400;
    }

    .topbar-name {
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .topbar-id-sep {
      width: 1px;
      height: 12px;
      flex: 0 0 auto;
      background: rgba(255,255,255,0.15);
    }

    .topbar-sync {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 0 0 auto;
      color: rgba(229,229,229,0.45);
      font-size: 10px;
      letter-spacing: 0.14em;
      white-space: nowrap;
    }

    .topbar-sync svg {
      color: rgba(0,229,255,0.8);
    }

    .topbar-menu-toggle {
      display: none;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 4px;
      width: 36px;
      height: 36px;
      padding: 0;
      border: 1px solid rgba(255,255,255,0.1);
      background: rgba(255,255,255,0.02);
      color: rgba(229,229,229,0.8);
      cursor: pointer;
      transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
    }

    .topbar-menu-toggle span {
      display: block;
      width: 15px;
      height: 1px;
      background: currentColor;
      transition: transform 0.18s ease, opacity 0.18s ease;
    }

    .topbar-menu-toggle:hover,
    .topbar-menu-toggle:focus-visible {
      border-color: rgba(0,229,255,0.35);
      background: rgba(0,229,255,0.08);
      color: #fff;
      outline: none;
    }

    body.topbar-menu-open .topbar-menu-toggle span:nth-child(1) {
      transform: translateY(5px) rotate(45deg);
    }

    body.topbar-menu-open .topbar-menu-toggle span:nth-child(2) {
      opacity: 0;
    }

    body.topbar-menu-open .topbar-menu-toggle span:nth-child(3) {
      transform: translateY(-5px) rotate(-45deg);
    }

    .topbar-nav {
      display: flex;
      align-items: center;
      gap: 20px;
      color: rgba(229,229,229,0.45);
    }

    .topbar-nav a,
    .topbar-nav button {
      appearance: none;
      background: none;
      border: none;
      padding: 0;
      color: inherit;
      font-family: inherit;
      font-size: inherit;
      letter-spacing: inherit;
      text-transform: inherit;
      text-decoration: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 4px;
      transition: color 0.18s ease;
    }

    .topbar-nav a:hover,
    .topbar-nav button:hover { color: rgba(229,229,229,0.92); }

    .topbar-nav .bracket { color: rgba(0,229,255,0.45); transition: color 0.18s ease; }
    .topbar-nav a:hover .bracket,
    .topbar-nav button:hover .bracket { color: rgba(0,229,255,0.8); }

    .logout-link { display: none; }
    body[data-authed="1"] .logout-link { display: flex; }

    .terrain-toggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      padding: 0;
      line-height: 0;
      border: 1px solid rgba(255,255,255,0.1);
      background: rgba(255,255,255,0.02);
      cursor: pointer;
    }

    .terrain-toggle svg { transition: stroke 0.18s ease; }
    body.terrain-off .terrain-toggle { color: rgba(229,229,229,0.25); }
    body.terrain-off .terrain-toggle svg { stroke: rgba(229,229,229,0.25); }

    .hero,
    .section-wrap {
      width: 100%;
      max-width: 1200px;
      margin: 0 auto;
      box-sizing: border-box;
    }

    .hero {
      display: block;
      padding: 56px 0 72px;
      position: relative;
    }

    .hero h1 {
      margin: 0 0 20px;
      font-size: clamp(3rem, 6.5vw, 5.4rem);
      text-wrap: balance;
      line-height: 1.05;
      letter-spacing: -0.04em;
      font-weight: 400;
      color: rgba(229,229,229,0.96);
      max-width: 14ch;
    }

    .hero h1 .muted {
      color: rgba(229,229,229,0.40);
    }

    .hero-sub {
      margin: 0 0 32px;
      dmax-width: 46ch;
      color: var(--muted);
      font-size: 1.1rem;
      font-weight: 300;
      line-height: 1.7;
    }

    .hero-rule {
      width: 100%;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
      margin: 64px 0 0;
    }

    .meta-panel,
    .group-card,
    .metric-card,
    .modal-panel,
    .lightbox-card,
    .chip-btn {
      background: var(--panel);
      border: 1px solid var(--line);
      backdrop-filter: blur(18px);
    }

    .project-card {
      border: 1px solid rgb(82 82 82 / 0.5);
    }

    .meta-panel {
      padding: 20px;
      min-height: 220px;
      position: relative;
    }

    .meta-panel::before,
    .meta-panel::after,
    .group-card::before,
    .group-card::after,
    .project-card::before,
    .project-card::after,
    .modal-panel::before,
    .modal-panel::after {
      content: "";
      position: absolute;
      width: 12px;
      height: 12px;
      border-color: rgba(0,229,255,0.42);
      pointer-events: none;
    }

    .meta-panel::before,
    .group-card::before,
    .project-card::before,
    .modal-panel::before {
      top: -1px;
      left: -1px;
      border-top: 1px solid;
      border-left: 1px solid;
    }

    .meta-panel::after,
    .group-card::after,
    .project-card::after,
    .modal-panel::after {
      bottom: -1px;
      right: -1px;
      border-right: 1px solid;
      border-bottom: 1px solid;
    }

    .section-wrap + .section-wrap { margin-top: 52px; }

    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 20px;
      margin-bottom: 24px;
    }

    .section-header h2 {
      margin: 0 0 4px;
      font-size: 1.5rem;
      font-weight: 400;
      letter-spacing: -0.02em;
      color: rgba(229,229,229,0.92);
    }

    .section-header-sub {
      font-family: 'Space Mono', monospace;
      font-size: 10px;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: rgba(229,229,229,0.38);
      margin: 0;
    }

    .section-header p {
      margin: 0;
      color: var(--soft);
      font-size: 0.93rem;
    }

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

    .group-card {
      position: relative;
      padding: 24px;
      min-height: 240px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      overflow: hidden;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.012)),
        radial-gradient(circle at top left, rgba(0,229,255,0.07), transparent 34%);
      transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    }

    .group-card:hover,
    .group-card:focus-within {
      transform: translateY(-3px);
      border-color: rgba(0,229,255,0.32);
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
      background:
        linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015)),
        radial-gradient(circle at top left, rgba(0,229,255,0.09), transparent 36%);
    }

    .group-card h3,
    .project-card h3 {
      margin: 0 0 12px;
      font-size: 1.5rem;
      letter-spacing: -0.03em;
      font-weight: 500;
    }

    .group-card p,
    .project-card p,
    .metric-card p {
      margin: 0;
      color: var(--muted);
      line-height: 1.6;
    }

    .project-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 24px;
      align-items: stretch;
    }

    .project-card {
      position: relative;
      padding: 24px;
      min-height: 286px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      background: transparent;
      border-color: rgb(82 82 82 / 0.5);
      transition: border-color 0.2s ease, box-shadow 0.25s ease;
      cursor: pointer;
    }

    .project-card::before,
    .project-card::after {
      display: none;
    }

    .project-card:hover,
    .project-card:focus-visible {
      border-color: rgb(82 82 82);
      outline: none;
    }

    .project-card.featured {
      grid-column: span 2;
      min-height: 318px;
    }

    .project-card.featured [data-card-content] h3 {
      font-size: 1.72rem;
      max-width: 14ch;
    }

    .project-card.featured [data-card-content] p {
      max-width: 60ch;
    }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 18px;
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: rgba(0,229,255,0.78);
    }

    .eyebrow .dot {
      width: 5px;
      height: 5px;
      border-radius: 999px;
      background: var(--accent);
      box-shadow: 0 0 14px rgba(0,229,255,0.7);
    }

    .tag-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 18px;
    }

    .tag {
      display: inline-flex;
      align-items: center;
      border: 1px solid rgba(255,255,255,0.12);
      color: rgba(229,229,229,0.70);
      padding: 6px 10px;
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      font-family: 'Space Mono', monospace;
      background: rgba(255,255,255,0.02);
    }

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

    .metric-card {
      padding: 20px;
      min-height: 132px;
    }

    .metric-card strong {
      display: block;
      margin-bottom: 10px;
      color: #fff;
      font-size: 1.4rem;
      font-weight: 500;
    }

    .chip-btn {
      appearance: none;
      border-radius: 999px;
      padding: 10px 14px;
      color: rgba(229,229,229,0.88);
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      cursor: pointer;
      transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    }

    .chip-btn:hover,
    .chip-btn:focus-visible {
      border-color: var(--line-strong);
      color: #fff;
      outline: none;
      background: rgba(0,229,255,0.08);
    }

    .hero-kicker {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(255,255,255,0.03);
      color: rgba(229,229,229,0.74);
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.09em;
      text-transform: uppercase;
    }

    .hero-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      dmargin-top: 28px;
    }

    .hero-btn {
      appearance: none;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(255,255,255,0.03);
      color: rgba(255,255,255,0.88);
      padding: 12px 16px;
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      cursor: pointer;
      transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
    }

    .hero-btn:hover,
    .hero-btn:focus-visible {
      transform: translateY(-2px);
      border-color: var(--line-strong);
      background: rgba(0,229,255,0.08);
      outline: none;
    }

    .hero-btn.primary {
      border-color: rgba(0,229,255,0.42);
      box-shadow: inset 0 0 0 1px rgba(0,229,255,0.10), 0 0 24px rgba(0,229,255,0.08);
    }

    .meta-panel {
      min-height: auto;
      padding: 24px;
      display: grid;
      gap: 18px;
      align-content: start;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015)),
        radial-gradient(circle at top left, rgba(0,229,255,0.08), transparent 36%);
    }

    .meta-list {
      display: grid;
      gap: 14px;
    }

    .meta-item {
      padding-top: 14px;
      border-top: 1px solid rgba(255,255,255,0.08);
    }

    .meta-item:first-child {
      padding-top: 0;
      border-top: 0;
    }

    .meta-item-label {
      margin: 0 0 6px;
      color: rgba(0,229,255,0.78);
      font-family: 'Space Mono', monospace;
      font-size: 10px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
    }

    .meta-item p {
      margin: 0;
      line-height: 1.7;
      color: rgba(229,229,229,0.74);
    }

    .feature-band {
      border: 1px solid rgba(255,255,255,0.09);
      position: relative;
      overflow: hidden;
      padding: 28px;
      display: grid;
      grid-template-columns: 1fr;
      grid-template-rows: auto auto;
      gap: 28px;
      background:
        linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05)),
        radial-gradient(circle at 20% 20%, rgba(0,229,255,0.2), transparent 26%);
      backdrop-filter: blur(18px);
    }

    .feature-band::before {
      content: "";
      position: absolute;
      inset: 0;
      background:
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
      background-size: 56px 56px;
      opacity: 0.20;
      pointer-events: none;
    }

    .feature-header {
      position: relative;
      z-index: 1;
      grid-column: 1 / -1;
    }

    .feature-header h2 {
      margin: 8px 0 0;
      font-size: clamp(1.9rem, 3vw, 3rem);
      line-height: 1.05;
      letter-spacing: -0.04em;
      font-weight: 500;
      max-width: none;
    }

    .feature-body {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
      gap: 28px;
      align-items: start;
    }

    .feature-copy,
    .feature-panel {
      position: relative;
      z-index: 1;
    }

    .feature-copy p {
      margin: 0;
      max-width: 58ch;
      color: rgba(229,229,229,0.72);
      line-height: 1.8;
    }

    .feature-stats {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 14px;
      margin-top: 24px;
    }

    .feature-stat {
      padding: 14px 0 0;
      border-top: 1px solid rgba(255,255,255,0.50);
      background-color: rgba(0, 229, 255, 0.08);
      padding: 16px;
    }

    .feature-stat strong {
      display: block;
      margin-bottom: 6px;
      font-size: 1.1rem;
      font-weight: 500;
      color: #fff;
    }

    .feature-stat span {
      color: rgba(229,229,229,0.62);
      font-size: 0.92rem;
      line-height: 1.5;
    }

    .feature-panel {
      display: grid;
      gap: 12px;
      align-content: end;
    }

    .feature-card {
      padding: 16px 18px;
      border: 1px solid rgba(255,255,255,0.08);
              background: rgba(50, 255, 255, 0.02);
    }

    .feature-card h3 {
      margin: 0 0 6px;
      font-size: 0.95rem;
      font-weight: 500;
      color: #fff;
    }

    .feature-card p {
      margin: 0;
      color: rgba(229,229,229,0.62);
      line-height: 1.65;
      font-size: 0.95rem;
    }

    .group-card {
      min-height: 212px;
      padding: 22px;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.012)),
        rgba(10,10,10,0.82);
    }

    .project-grid {
      grid-template-columns: 1.2fr 1fr 1fr;
      align-items: stretch;
    }

    .project-card {
      min-height: 320px;
      padding: 26px;
      background: radial-gradient(black, #00000000);
    }

    .project-card.featured {
      min-height: 380px;
    }

    .project-card.featured h3 {
      font-size: 2rem;
      margin-bottom: 16px;
    }

    .project-card .impact-line {
      margin-top: 14px;
      color: rgba(0,229,255,0.78);
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      display: inline-flex;
      align-items: center;
      gap: 10px;
    }

    .impact-line::before {
      content: "";
      width: 24px;
      height: 1px;
      background: rgba(0,229,255,0.55);
      box-shadow: 0 0 12px rgba(0,229,255,0.28);
    }

    .project-card.featured .impact-line {
      color: rgba(255,255,255,0.88);
    }

    .project-card.featured .tag {
      border-color: rgba(0,229,255,0.22);
      color: rgba(255,255,255,0.82);
      background: rgba(0,229,255,0.07);
    }

    .group-card .tag,
    .project-card .tag {
      transition: border-color 0.22s ease, color 0.22s ease, background 0.22s ease;
    }

    .group-card:hover .tag,
    .group-card:focus-within .tag,
    .project-card:hover .tag,
    .project-card:focus-visible .tag {
      border-color: rgba(0,229,255,0.24);
      color: rgba(255,255,255,0.82);
      background: rgba(0,229,255,0.06);
    }

    .section-wrap .section-header p {
      max-width: 42rem;
    }

    .utility-grid {
      display: grid;
      grid-template-columns: 1.15fr 0.85fr;
      gap: 24px;
    }

    .utility-panel {
      padding: 24px;
      position: relative;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01)),
        rgba(10,10,10,0.84);
      border: 1px solid rgba(255,255,255,0.08);
      backdrop-filter: blur(18px);
    }

    .utility-panel h3 {
      margin: 0 0 10px;
      font-size: 1.15rem;
      font-weight: 500;
      letter-spacing: -0.02em;
    }

    .utility-panel p {
      margin: 0;
      color: rgba(229,229,229,0.68);
      line-height: 1.72;
    }

    .utility-links {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 18px;
    }

    .ghost-link {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 12px;
      border: 1px solid rgba(255,255,255,0.10);
      color: rgba(229,229,229,0.76);
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.10em;
      text-transform: uppercase;
      background: rgba(255,255,255,0.02);
    }

    @media (max-width: 1080px) {
      .hero,
      .utility-grid,
      .feature-body {
        grid-template-columns: 1fr;
      }

      .project-card.featured {
        grid-column: span 1;
        min-height: 286px;
      }

      .project-grid,
      .group-grid,
      .metric-grid,
      .feature-stats {
        grid-template-columns: 1fr;
      }
    }


    .modal-root {
      position: fixed;
      inset: 0;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.28s ease, visibility 0.28s ease;
      z-index: 300;
    }

    .lightbox-root {
      position: fixed;
      inset: 0;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.28s ease, visibility 0.28s ease;
      z-index: 9000 !important;
    }

    .modal-root.active,
    .lightbox-root.active {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }

    .modal-backdrop,
    .lightbox-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0,0,0,0.68);
      backdrop-filter: blur(10px);
    }

    .modal-shell {
      position: absolute;
      top: 60px;
      right: 28px;
      bottom: 28px;
      left: 28px;
      display: flex;
      justify-content: center;
      align-items: stretch;
    }

    .modal-panel {
      position: relative;
      width: min(1220px, 100%);
      background: var(--panel-2);
      display: grid;
      grid-template-columns: 220px minmax(0, 1fr);
      overflow: hidden;
      box-shadow: 0 32px 120px rgba(0,0,0,0.44);
    }

    .modal-sidebar {
      position: relative;
      border-right: 1px solid rgba(255,255,255,0.08);
      padding: 28px 20px 28px 24px;
      background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    }

    .modal-sidebar h4 {
      margin: 0 0 16px;
      color: rgba(0,229,255,0.78);
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      font-weight: 400;
      letter-spacing: 0.18em;
      text-transform: uppercase;
    }

    .modal-nav {
      position: relative;
      margin-top: 24px;
    }

    .modal-nav::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      width: 1px;
      background: rgba(255,255,255,0.10);
    }

    .modal-nav-progress {
      position: absolute;
      top: 0;
      left: 0;
      width: 1px;
      height: 100%;
      transform-origin: top center;
      transform: scaleY(0);
      background: linear-gradient(180deg, rgba(0,229,255,0.95), rgba(0,229,255,0.28));
      box-shadow: 0 0 12px rgba(0,229,255,0.45);
    }

    .modal-nav button {
      position: relative;
      display: block;
      width: 100%;
      padding: 0 0 0 18px;
      margin: 0 0 14px;
      border: 0;
      background: transparent;
      color: rgba(229,229,229,0.50);
      text-align: left;
      font-size: 12px;
      line-height: 1.4;
      cursor: pointer;
      transition: color 0.18s ease;
    }

    .modal-nav button::before {
      content: "";
      position: absolute;
      left: -4px;
      top: 7px;
      width: 8px;
      height: 8px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.20);
      background: #0b0b0b;
      transition: all 0.18s ease;
    }

    .modal-nav button.active {
      color: rgba(255,255,255,0.96);
    }

    .modal-nav button.active::before {
      border-color: rgba(0,229,255,0.82);
      background: var(--accent);
      box-shadow: 0 0 12px rgba(0,229,255,0.6);
    }

    .modal-content {
      position: relative;
      overflow: auto;
      max-height: calc(100vh - 56px);
      padding: 28px 28px 48px 32px;
      scrollbar-width: thin;
      scrollbar-color: rgba(0,229,255,0.40) rgba(255,255,255,0.06);
    }

    .modal-content::-webkit-scrollbar { width: 12px; }
    .modal-content::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
    .modal-content::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, rgba(0,229,255,0.68), rgba(0,229,255,0.22));
      border: 3px solid rgba(255,255,255,0.04);
      border-radius: 999px;
    }

    .modal-close,
    .lightbox-close {
      appearance: none;
      border: 1px solid rgba(255,255,255,0.12);
      color: rgba(229,229,229,0.72);
      background: rgba(0,0,0,0.36);
      width: 42px;
      height: 42px;
      border-radius: 999px;
      cursor: pointer;
      transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    }

    .modal-close:hover,
    .modal-close:focus-visible,
    .lightbox-close:hover,
    .lightbox-close:focus-visible {
      border-color: var(--line-strong);
      color: #fff;
      background: rgba(0,229,255,0.08);
      outline: none;
    }

    .modal-topbar {
      display: flex;
      justify-content: space-between;
      gap: 20px;
      align-items: start;
      margin-bottom: 28px;
      padding-right: 12px;
    }

    .modal-title {
      margin: 0;
      font-size: clamp(2.2rem, 4vw, 4rem);
      line-height: 0.96;
      letter-spacing: -0.05em;
      font-weight: 500;
    }

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

    .meta-pill {
      padding: 8px 10px;
      border: 1px solid rgba(255,255,255,0.09);
      background: rgba(255,255,255,0.02);
      font-family: 'Space Mono', monospace;
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: rgba(229,229,229,0.70);
    }

    .modal-section {
      padding: 32px 0;
      border-top: 1px solid rgba(255,255,255,0.08);
      scroll-margin-top: 24px;
    }

    .modal-section:first-of-type { border-top: 0; padding-top: 10px; }

    .modal-section h3 {
      margin: 0 0 14px;
      font-size: clamp(1.4rem, 2vw, 1.9rem);
      letter-spacing: -0.03em;
      font-weight: 500;
    }

.modal-section p {
    margin: 0 0 12px;
    color: rgba(153, 153, 153, 0.72);
    line-height: 1.8;
    font-size: 0.95rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

    .callout-grid,
    .info-grid,
    .image-grid {
      display: grid;
      gap: 16px;
      margin-top: 22px;
    }

    .callout-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .callout-grid.three,
    .info-grid.three,
    .image-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .info-grid.two,
    .image-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .callout,
    .info-card,
    .image-card,
    .quote-card {
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(255,255,255,0.025);
      padding: 16px;
    }

    .callout h4,
    .info-card h4,
    .image-card h4 {
      margin: 0 0 8px;
      font-size: 0.96rem;
      letter-spacing: -0.02em;
      font-weight: 500;
      color: #fff;
    }

    .callout p,
    .info-card p,
    .image-card p,
    .quote-card p {
      margin: 0;
      color: rgba(229,229,229,0.66);
      line-height: 1.65;
      font-size: 0.95rem;
    }

    .metric-strip {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 14px;
      margin-top: 18px;
    }

    .metric-pill {
      border: 1px solid rgba(0,229,255,0.18);
      background: rgb(0 229 255 / 24%);
      padding: 14px;
    }

    .metric-pill strong {
      display: block;
      margin-bottom: 6px;
      color: #fff;
      font-size: 1.05rem;
      font-weight: 500;
    }

    .metric-pill span {
      display: block;
      color: rgba(229,229,229,0.62);
      font-size: 0.88rem;
      line-height: 1.45;
    }

    .image-card {
      padding: 0;
      overflow: hidden;
      cursor: pointer;
      transition: border-color 0.2s ease, transform 0.2s ease;
    }

    .image-card:hover,
    .image-card:focus-visible {
      border-color: var(--line-strong);
      transform: translateY(-2px);
      outline: none;
    }

    .image-frame {
      aspect-ratio: 16 / 10;
      background:
        linear-gradient(180deg, rgba(0,229,255,0.10), rgba(255,255,255,0.02)),
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      overflow: hidden;
    }

    .image-frame::before {
      content: attr(data-label);
      position: absolute;
      top: 14px;
      left: 14px;
      font-family: 'Space Mono', monospace;
      font-size: 10px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: rgba(0,229,255,0.78);
      z-index: 1;
    }

    .image-frame:has(img)::before {
      display: none;
    }

    .image-frame img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .image-art {
      width: calc(100% - 36px);
      height: calc(100% - 50px);
      border: 1px solid rgba(255,255,255,0.10);
      background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        radial-gradient(circle at 20% 20%, rgba(0,229,255,0.18), transparent 28%),
        radial-gradient(circle at 80% 55%, rgba(255,255,255,0.08), transparent 36%);
      background-size: 18px 18px, 18px 18px, auto, auto;
      position: relative;
      overflow: hidden;
    }

    .image-art::before,
    .image-art::after {
      content: "";
      position: absolute;
      border: 1px solid rgba(255,255,255,0.10);
      background: rgba(255,255,255,0.02);
    }

    .nulled.image-art::before {
      top: 12%;
      left: 8%;
      width: 60%;
      height: 18%;
    }

    .nulled.image-art::after {
      bottom: 14%;
      right: 10%;
      width: 42%;
      height: 24%;
    }

    .image-caption {
      padding: 14px 16px 16px;
    }

    .quote-card {
      margin-top: 18px;
      border-color: rgba(0,229,255,0.16);
      background: rgba(0,229,255,0.04);
    }

    .lightbox-shell {
      position: absolute;
      inset: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .lightbox-card {
      position: relative;
      width: min(1120px, 100%);
      padding: 28px 28px 24px;
      background: rgba(10,10,10,0.97);
      border: 1px solid rgba(82,82,82,0.5);
      box-shadow:
        0 0 0 1px rgba(0,229,255,0.06),
        0 0 40px rgba(0,229,255,0.08),
        0 0 80px rgba(0,229,255,0.20),
        0 40px 120px rgba(0,0,0,0.5);
    }

    /* Corner accents on lightbox card */
    .lightbox-card::before,
    .lightbox-card::after {
      content: "";
      position: absolute;
      width: 14px;
      height: 14px;
      pointer-events: none;
      border-color: rgb(82 82 82);
    }
    .lightbox-card::before {
      top: -1px; left: -1px;
      border-top: 1px solid; border-left: 1px solid;
    }
    .lightbox-card::after {
      bottom: -1px; right: -1px;
      border-bottom: 1px solid; border-right: 1px solid;
    }

    .lightbox-topbar {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 20px;
      margin-bottom: 20px;
    }

    .lightbox-topbar-left {
      min-width: 0;
    }

    .lightbox-eyebrow {
      display: block;
      font-family: 'Space Mono', monospace;
      font-size: 10px;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: rgba(0,229,255,0.72);
      margin-bottom: 6px;
    }

    #lightboxTitle {
      margin: 0;
      font-size: clamp(1.1rem, 2vw, 1.5rem);
      font-weight: 500;
      letter-spacing: -0.02em;
      line-height: 1.2;
    }

    .lightbox-preview {
      aspect-ratio: 16 / 9;
      border: 1px solid rgba(255,255,255,0.10);
      background:
        linear-gradient(180deg, rgba(0,229,255,0.06), rgba(255,255,255,0.01)),
        linear-gradient(135deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      overflow: hidden;
    }

    .lightbox-preview .image-art {
      width: calc(100% - 50px);
      height: calc(100% - 56px);
    }

    .lightbox-meta {
      margin-top: 14px;
      padding-top: 14px;
      border-top: 1px solid rgba(255,255,255,0.07);
    }

    .lightbox-meta p {
      margin: 0;
      color: rgba(229,229,229,0.62);
      line-height: 1.75;
      font-size: 0.9rem;
      max-width: 80ch;
    }

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

    @media (max-width: 1100px) {
      .hero,
      .group-grid,
      .project-grid,
      .metric-grid,
      .callout-grid.two,
      .callout-grid.three,
      .info-grid.two,
      .info-grid.three,
      .image-grid.two,
      .image-grid.three,
      .metric-strip,
      .modal-panel {
        grid-template-columns: 1fr;
      }

      .modal-sidebar {
        display: none;
      }

      .modal-content { max-height: calc(100vh - 56px); }
    }

    @media (max-width: 760px) {
      .topbar {
        --topbar-height: 56px;
      }

      .topbar-inner {
        padding: 0 14px;
        gap: 10px;
      }

      .topbar-brand {
        gap: 10px;
        min-width: 0;
      }

      .topbar-id {
        gap: 10px;
        min-width: 0;
      }

      .topbar-name {
        max-width: min(52vw, 260px);
      }

      .topbar-id-sep,
      .topbar-sync {
        display: none;
      }

      .topbar-menu-toggle {
        display: inline-flex;
        flex: 0 0 auto;
      }

      .topbar-nav {
        position: absolute;
        top: calc(100% + 10px);
        left: 14px;
        right: 64px;
        display: grid;
        gap: 10px;
        padding: 14px;
        border: 1px solid rgba(255,255,255,0.08);
        background: rgba(5,5,5,0.94);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: 0 24px 64px rgba(0,0,0,0.38);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
      }

      .topbar-nav a,
      .topbar-nav button {
        justify-content: flex-start;
      }

      body.topbar-menu-open .topbar-nav {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
      }

      .page-shell {
        width: min(1200px, calc(100vw - 20px));
        padding: calc(var(--topbar-height, 56px) + 18px) 10px 60px;
      }

      .hero {
        padding: 28px 0 52px;
      }

      .hero h1 {
        font-size: clamp(1.7rem, 7vw, 2.7rem);
        line-height: 1.04;
        max-width: 12ch;
      }

      .hero-sub {
        font-size: 0.98rem;
        line-height: 1.75;
      }

      .hero-actions,
      .utility-links,
      .meta-row,
      .tag-row {
        gap: 10px;
      }

      .hero-btn,
      .chip-btn,
      .ghost-link {
        width: 100%;
        justify-content: center;
      }

      .modal-shell { top: 56px; right: 12px; bottom: 12px; left: 12px; }
      .lightbox-shell { inset: 12px; }
      .modal-content { padding: 20px 18px 32px; }
      .modal-topbar { padding-right: 0; }
      .frame { display: none; }
    }



    :root {
      --frame-left: 20px;
      --frame-right: calc(100vw - 20px);
      --frame-width: calc(100vw - 40px);
      --animated-frame-left: 20px;
      --animated-frame-right: calc(100vw - 20px);
      --animated-frame-width: calc(100vw - 40px);
    }

    .side-border {
      position: fixed;
      top: 0;
      bottom: 0;
      width: max(0px, min(var(--animated-frame-left), var(--true-vw)));
      background: #050505;
      z-index: 8;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.45s ease, filter 0.45s ease;
    }
    .side-border-left {
      left: 0;
      border-right: 1px solid rgba(38, 38, 38, 0.4);
      background: linear-gradient(-90deg, rgba(0, 229, 255, 0.15) 0%, rgba(0, 229, 255, 0.02) 50%, transparent 100%);
    }
    .side-border-right {
      right: 0;
      width: max(0px, calc(var(--true-vw) - var(--animated-frame-right)));
      border-left: 1px solid rgba(38, 38, 38, 0.4);
      background: linear-gradient(90deg, rgba(0, 229, 255, 0.15) 0%, rgba(0, 229, 255, 0.02) 50%, transparent 100%);
    }
    #canvasContainer {
      position: fixed;
      top: 0;
      bottom: 0;
      left: var(--animated-frame-left);
      right: calc(var(--true-vw) - var(--animated-frame-right));
      width: auto;
      z-index: 1;
      pointer-events: none;
      opacity: 0;
      overflow: hidden;
      clip-path: inset(0 0 0 0);
      contain: layout paint;
      isolation: isolate;
      transition: opacity 0.9s ease, filter 0.45s ease;
      background: transparent;
    }

    #terrainCanvas {
      transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
    }

    body.terrain-off #terrainCanvas {
      transform: translateY(110vh);
    }
    #terrainCanvas {
      display: block;
      width: 100%;
      height: 100%;
    }
    #ambientHud {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 2;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden;
      opacity: 0;
      transition: opacity 0.9s ease, filter 0.45s ease;
    }
    #worldChrome .hud-ring {
      position: absolute;
      border: 1px solid rgba(38, 38, 38, 0.45);
      border-radius: 999px;
    }
    #worldChrome .hud-ring.r1 {
      width: min(80vw, 58rem);
      height: min(80vw, 58rem);
    }
    #worldChrome .hud-ring.r2 {
      width: min(60vw, 36rem);
      height: min(60vw, 36rem);
      border-color: rgba(38, 38, 38, 0.28);
    }
    #worldChrome .hud-cross-v {
      position: absolute;
      width: 1px;
      height: 4rem;
      background: rgba(0,229,255,0.16);
    }
    #worldChrome .hud-cross-h {
      position: absolute;
      width: 4rem;
      height: 1px;
      background: rgba(0,229,255,0.16);
    }
    .hub-root {
      position: relative;
      z-index: 20;
      width: 100%;
      opacity: 0;
      transform: translateY(26px) scale(0.985);
      pointer-events: none;
      transition: opacity 0.8s ease, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .page-shell,
    #worldChrome {
      transition: filter var(--modal-close-duration) var(--modal-close-ease);
    }
    body.card-open .page-shell {
      filter: blur(6px);
    }
    body.card-open #worldChrome {
      filter: blur(6px);
    }
    .hub-root.active {
      opacity: 1;
      transform: none;
      pointer-events: auto;
    }
    #authLayer {
      position: fixed;
      inset: 0;
      z-index: 40;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.55s ease, visibility 0.55s ease;
    }
    #authLayer.visible {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }
    #authLayer.hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }
    body.hub-active #canvasContainer,
    body.hub-active #ambientHud {
      opacity: 1;
    }
    body.hub-active .side-border {
      opacity: 1;
    }
    body.hub-active .login-container,
    body.hub-active .processing-overlay {
      pointer-events: none;
    }
    body.modal-open #canvasContainer,
    body.modal-open #ambientHud,
    body.modal-open .side-border,
    body.modal-open .grid-bg,
    body.modal-open .grid-bg-soft,
    body.modal-open .vignette,
    body.modal-open .scanlines,
    body.modal-open .frame {
      opacity: 0 !important;
      filter: blur(18px);
    }
    body.modal-open .page-shell > section,
    body.modal-open .page-shell .feature-band,
    body.modal-open .page-shell .group-grid,
    body.modal-open .page-shell #projectGrid,
    body.modal-open .page-shell .utility-grid {
      opacity: 0.05;
      pointer-events: none;
      transition: opacity 0.35s ease;
    }
    body.modal-open .page-shell > header {
      opacity: 1;
    }

    /* Checkpoint 1b: keep the original outer split/gradient only */
    .hub-root .grid-bg,
    .hub-root .grid-bg-soft,
    .hub-root .vignette,
    .hub-root .scanlines,
    .hub-root .frame {
      display: none !important;
    }

    #worldChrome {
      transition: opacity 0.65s ease;
    }

    .page-shell {
      width: min(100vw - 32px, 1200px);
      margin-inline: auto;
    }

    @media (max-width: 720px) {
      .login-panel {
        padding: 1.5rem;
      }

      .system-header {
        margin-bottom: 1.5rem;
      }

      .system-title {
        font-size: 1rem;
        letter-spacing: 0.18em;
      }

      .input-field {
        padding: 0.8rem 0.9rem 0.8rem 2.35rem;
        font-size: 12px;
      }

      .submit-btn {
        padding: 0.8rem;
      }
    }

    .page-shell {
      width: min(calc(100vw - 40px), 1260px);
      margin-inline: auto;
      padding-inline: clamp(18px, 2.2vw, 30px);
      overflow-x: clip;
      box-sizing: border-box;
    }

    .page-shell > header,
    .page-shell > section {
      width: 100%;
    }

    .hero,
    .feature-band,
    .group-grid,
    #projectGrid,
    .utility-grid,
    .metric-grid {
      width: 100%;
    }

    .section-wrap {
      padding-inline: clamp(12px, 1.8vw, 24px);
    }

    .modal-shell {
      padding: clamp(16px, 2vw, 28px);
    }

    .modal-panel {
      width: min(100%, 1120px);
      margin-inline: auto;
    }

    .modal-header,
    .modal-body,
    .modal-nav {
      min-width: 0;
    }

    .modal-body {
      padding-right: clamp(14px, 1.8vw, 26px);
    }

    .case-study-body,
    .study-section,
    .section-copy,
    .image-grid,
    .metric-strip {
      min-width: 0;
    }

    .image-grid img,
    .study-image,
    .lightbox-image {
      max-width: 100%;
      height: auto;
    }

    @media (max-width: 1080px) {
      .page-shell {
        width: min(1200px, calc(100vw - 40px));
        padding-inline: 12px;
      }

      .section-wrap {
        padding-inline: 10px;
      }

      .modal-shell {
        padding: 14px;
      }

      .modal-panel {
        width: min(100%, 1000px);
      }
    }

    @media (max-width: 720px) {
      .page-shell {
        width: min(1200px, calc(100vw - 20px));
        padding-inline: 10px;
      }

      .section-wrap {
        padding-inline: 6px;
      }

      .modal-shell {
        padding: 10px;
      }

      .modal-panel {
        width: 100%;
      }

      .modal-body {
        padding-right: 0;
      }
    }

    @media (max-height: 760px) {
      .login-container {
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
      }
    }


/* ===== CARD SYSTEM — ADDITIVE ANIMATION + EXPAND RULES ===== */

/* --- Keyframes --- */
@keyframes flash-border {
    0%, 100% { opacity: 0; }
    50%       { opacity: 1; }
}

@keyframes delete-flicker {
    0%   { opacity: 1; color: #00e5ff; }
    50%  { opacity: 0.5; color: #ff0040; }
    100% { opacity: 0; color: #ff0040; }
}

@keyframes scan-down {
    0%   { top: 0; opacity: 0.6; }
    100% { top: 100%; opacity: 0; }
}

/* --- Flash animation classes --- */
.flash-overlay.flashing      { animation: flash-border 0.15s ease-out 3; }
.flash-overlay.flashing-fast { animation: flash-border 0.08s ease-out 3; }

.corner-accent.flashing-border {
    border-color: #00e5ff;
    transition: border-color 0.1s ease;
}

/* --- Word deletion --- */
.deleting-word {
    animation: delete-flicker 0.08s ease-out forwards;
}


/* Sections are animated through .motion-ready state so they don't disappear if JS fails. */


/* --- Corner accents (explicit positioned divs inside the card) --- */
.corner-accent {
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: rgb(82 82 82);
    pointer-events: none;
    transition: border-color 0.25s ease;
    z-index: 5;
}
.corner-accent.corner-tl { top: -1px;    left: -1px;  border-top: 1px solid; border-left: 1px solid; }
.corner-accent.corner-tr { top: -1px;    right: -1px; border-top: 1px solid; border-right: 1px solid; }
.corner-accent.corner-bl { bottom: -1px; left: -1px;  border-bottom: 1px solid; border-left: 1px solid; }
.corner-accent.corner-br { bottom: -1px; right: -1px; border-bottom: 1px solid; border-right: 1px solid; }

.project-card:hover .corner-accent,
.project-card:focus-visible .corner-accent { border-color: #00e5ff; }

/* --- Scan line --- */
.scan-line {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00e5ff, transparent);
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}
.project-card.scanning .scan-line {
    animation: scan-down 1s linear;
}

/* --- Inner card grid texture --- */
.card-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 1;
}

/* --- Flash overlay (card-level, not login panel) --- */
.project-card .flash-overlay {
    position: absolute;
    inset: 0;
    border: 2px solid #00e5ff;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

/* --- Morphing arrow/X icon --- */
.card-icon {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 18px;
    height: 18px;
    color: rgba(0,229,255,0.42);
    z-index: 30;
    transition: color 0.2s ease;
}

.project-card:hover .card-icon { color: #00e5ff; }

.card-icon .icon-arrow,
.card-icon .icon-x {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.card-icon .icon-x {
    opacity: 0;
    transform: rotate(-45deg) scale(0.6);
}

.card-icon.morphed .icon-arrow {
    opacity: 0;
    transform: rotate(45deg) scale(0.6);
}

.card-icon.morphed .icon-x {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.card-icon.morphed {
    cursor: pointer;
    color: rgba(229,229,229,0.72);
}

.card-icon.morphed:hover { color: #00e5ff; }

/* --- Card content layer --- */
.card-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: opacity 0.3s ease;
}
.card-content.hiding {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.card-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #00e5ff;
    background: rgba(0,229,255,0.08);
    padding: 4px 8px;
    letter-spacing: 0.05em;
}

.card-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: rgba(229,229,229,0.45);
}

/* --- Expanded content panel --- */
.expanded-content {
    --sidebar-opacity-duration: 700ms;
    --sidebar-transform-duration: 700ms;
    --topbar-opacity-duration: 800ms;
    --topbar-transform-duration: 760ms;
    --section-opacity-duration: 1400ms;
    --section-transform-duration: 1200ms;
    --topbar-item-opacity-duration: 680ms;
    --topbar-item-transform-duration: 680ms;
    --motion-offset-y: 18px;
    --topbar-item-offset-y: 14px;
    --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);

    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transition: opacity 0.3s ease;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: stretch;
    z-index: 25;
}

.expanded-content.visible {
    opacity: 1;
}

.expanded-content.motion-ready .modal-sidebar,
.expanded-content.motion-ready .modal-topbar,
.expanded-content.motion-ready [data-section] {
    opacity: 0;
    transform: translateY(var(--motion-offset-y));
    will-change: opacity, transform;
}

.expanded-content.motion-ready .modal-topbar .eyebrow,
.expanded-content.motion-ready .modal-topbar .modal-title,
.expanded-content.motion-ready .modal-topbar .modal-subtitle,
.expanded-content.motion-ready .modal-topbar .meta-row {
    opacity: 0;
    transform: translateY(var(--topbar-item-offset-y));
    will-change: opacity, transform;
}

.expanded-content.motion-ready.visible .modal-sidebar,
.expanded-content.motion-ready.visible .modal-topbar,
.expanded-content.motion-ready.visible [data-section] {
    opacity: 1;
    transform: translateY(0);
    transition-delay: var(--enter-delay, 0ms);
}

.expanded-content.motion-ready.visible .modal-topbar .eyebrow,
.expanded-content.motion-ready.visible .modal-topbar .modal-title,
.expanded-content.motion-ready.visible .modal-topbar .modal-subtitle,
.expanded-content.motion-ready.visible .modal-topbar .meta-row {
    opacity: 1;
    transform: translateY(0);
    transition-delay: var(--enter-delay, 0ms);
}

.expanded-content.motion-ready.visible .modal-sidebar {
    transition:
        opacity var(--sidebar-opacity-duration) ease,
        transform var(--sidebar-transform-duration) var(--motion-ease);
}

.expanded-content.motion-ready.visible .modal-topbar {
    transition:
        opacity var(--topbar-opacity-duration) ease,
        transform var(--topbar-transform-duration) var(--motion-ease);
}

.expanded-content.motion-ready.visible .modal-topbar .eyebrow,
.expanded-content.motion-ready.visible .modal-topbar .modal-title,
.expanded-content.motion-ready.visible .modal-topbar .modal-subtitle,
.expanded-content.motion-ready.visible .modal-topbar .meta-row {
    transition:
        opacity var(--topbar-item-opacity-duration) ease,
        transform var(--topbar-item-transform-duration) var(--motion-ease);
}

.expanded-content.motion-ready.visible [data-section] {
    transition:
        opacity var(--section-opacity-duration) ease,
        transform var(--section-transform-duration) var(--motion-ease);
}

/* --- Expand / collapse transitions --- */
.project-card.expanding {
    overflow: hidden !important;
    z-index: 400 !important;
    transition:
        top    0.7s cubic-bezier(0.16, 1, 0.3, 1),
        left   0.7s cubic-bezier(0.16, 1, 0.3, 1),
        width  0.7s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.7s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.project-card.collapsing {
    z-index: 400 !important;
    transition:
        top    0.5s cubic-bezier(0.7, 0, 0.84, 0),
        left   0.5s cubic-bezier(0.7, 0, 0.84, 0),
        width  0.5s cubic-bezier(0.7, 0, 0.84, 0),
        height 0.5s cubic-bezier(0.7, 0, 0.84, 0),
        opacity 0.5s ease !important;
}

.project-card.expanded.closing-fade {
    opacity: 0;
}

.project-card.expanded {
    background: rgba(10,10,10,0.97) !important;
    backdrop-filter: blur(24px) !important;
    border-color: rgba(255,255,255,0.08) !important;
    overflow: hidden !important;
    transform: none !important;
    z-index: 400 !important;
    padding: 0 !important;
    display: block !important;
    cursor: default;
    box-shadow:
        0 0 0 1px rgba(0,229,255,0.06),
        0 0 40px rgba(0,229,255,0.08),
        0 0 80px rgba(0,229,255,0.25),
        0 40px 120px rgba(0,0,0,0.3) !important;
}

/* --- Sidebar nav --- */
.modal-sidebar {
    position: relative;
    border-right: 1px solid rgba(255,255,255,0.08);
    padding: 40px 20px 40px 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,229,255,0.40) rgba(255,255,255,0.06);
}

.modal-sidebar h4 {
    margin: 0 0 8px;
    color: rgba(0,229,255,0.78);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.modal-nav-wrap {
    position: relative;
    margin-top: 24px;
    padding-left: 18px;
}

.modal-nav-wrap::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 1px;
    background: rgba(255,255,255,0.10);
}

.modal-nav-progress {
    position: absolute;
    top: 0; left: 0;
    width: 1px;
    height: 100%;
    transform-origin: top center;
    transform: scaleY(0);
    background: linear-gradient(180deg, rgba(0,229,255,0.95), rgba(0,229,255,0.28));
    box-shadow: 0 0 12px rgba(0,229,255,0.45);
}

.modal-nav button {
    position: relative;
    display: block;
    width: 100%;
    padding: 0 0 0 18px;
    margin: 0 0 14px;
    border: 0;
    background: transparent;
    color: rgba(229,229,229,0.50);
    text-align: left;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.18s ease;
    font-family: 'Inter', sans-serif;
}

.modal-nav button::before {
    content: "";
    position: absolute;
    left: -4px; top: 7px;
    width: 8px; height: 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.20);
    background: #0b0b0b;
    transition: all 0.18s ease;
}

.modal-nav button:hover { color: rgba(255,255,255,0.75); }
.modal-nav button:hover::before { border-color: rgba(0,229,255,0.45); }
.modal-nav button.active { color: rgba(255,255,255,0.96); }

.modal-nav button.active::before {
    border-color: rgba(0,229,255,0.82);
    background: #00e5ff;
    box-shadow: 0 0 12px rgba(0,229,255,0.6);
}

/* --- Modal body shell + inner scroll body --- */
.expanded-content > .modal-body-shell,
.expanded-content > [data-modal-body-shell] {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    padding: 40px 48px 40px 40px;
}

.expanded-content > .modal-body-shell > .modal-body,
.expanded-content > .modal-body-shell > [data-modal-body],
.expanded-content > [data-modal-body-shell] > .modal-body,
.expanded-content > [data-modal-body-shell] > [data-modal-body],
.modal-body-scroll {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 0 20px 0 0;
    scroll-padding-top: 0;
    scroll-padding-bottom: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,229,255,0.40) rgba(255,255,255,0.06);
}

.modal-body::-webkit-scrollbar,
[data-modal-body]::-webkit-scrollbar { width: 12px; }
.modal-body::-webkit-scrollbar-track,
[data-modal-body]::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
.modal-body::-webkit-scrollbar-thumb,
[data-modal-body]::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0,229,255,0.68), rgba(0,229,255,0.22));
    border: 3px solid rgba(255,255,255,0.04);
    border-radius: 999px;
}

.modal-topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 28px;
    width: 100%;
}

.modal-topbar > div {
    flex: 1 1 0;
    min-width: 0;
}

.modal-title {
    margin: 8px 0 0;
    font-size: clamp(2rem, 3.5vw, 3.5rem);
    line-height: 0.96;
    letter-spacing: -0.05em;
    font-weight: 500;
    width: 100%;
}

.modal-subtitle {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.meta-pill {
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.02);
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(229,229,229,0.65);
}

/* --- Modal sections --- */
.modal-section {
    padding: 28px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    scroll-margin-top: 24px;
    width: 100%;
    box-sizing: border-box;
}

.modal-section:first-of-type { border-top: 0; padding-top: 8px; }

.modal-section h3 {
    margin: 45px 0 16px;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    letter-spacing: -0.03em;
    font-weight: 500;
    width: 100%;
    max-width: none;
}

/* --- Callout grid --- */
.callout-grid {
    display: grid;
    gap: 14px;
    margin-top: 20px;
    margin-bottom: 20px;
}
.callout-grid.two   { grid-template-columns: repeat(2, minmax(0,1fr)); }
.callout-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.callout {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgb(150 194 255 / 27%);
    padding: 14px;
}

.callout h4 {
    margin: 0 0 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    letter-spacing: -0.01em;
}

.callout p {
    margin: 0;
    color: rgba(229,229,229,0.60);
    font-size: 0.88rem;
    line-height: 1.6;
    max-width: none;
}

/* --- Metric strip (inside modal, not .metric-card from terrain) --- */
.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    margin-top: 16px;
}

.metric-strip .metric-pill {
    border: 1px solid rgba(0,229,255,0.18);
    background: rgb(0 229 255 / 24%);
    padding: 12px;
}

.metric-strip .metric-pill strong {
    display: block;
    margin-bottom: 4px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
}

.metric-strip .metric-pill span {
    display: block;
    color: rgba(229,229,229,0.58);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* --- Image grid --- */
.image-grid {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}
.image-grid.two   { grid-template-columns: repeat(2, minmax(0,1fr)); }
.image-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.image-card {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.025);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
    text-align: left;
}

.image-card:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-2px); }

.image-frame {
    aspect-ratio: 16/10;
    background:
        linear-gradient(180deg, rgba(0,229,255,0.10), rgba(255,255,255,0.02)),
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.image-frame::before {
    content: attr(data-label);
    position: absolute;
    top: 12px; left: 12px;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(0,229,255,0.78);
}

.image-art {
    width: calc(100% - 32px);
    height: calc(100% - 44px);
    border: 1px solid rgba(255,255,255,0.10);
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        radial-gradient(circle at 20% 20%, rgba(0,229,255,0.18), transparent 28%),
        radial-gradient(circle at 80% 55%, rgba(255,255,255,0.08), transparent 36%);
    background-size: 18px 18px, 18px 18px, auto, auto;
    position: relative;
    overflow: hidden;
}

.image-caption { padding: 12px 14px 14px; }
.image-caption h4 { margin: 0 0 4px; font-size: 0.88rem; font-weight: 500; color: #fff; }
.image-caption p  { margin: 0; font-size: 0.82rem; color: rgba(229,229,229,0.55); line-height: 1.5; max-width: none; }

/* --- Quote card --- */
.quote-card {
    margin-top: 16px;
    border: 1px solid rgba(0,229,255,0.16);
    background: rgba(0,229,255,0.04);
    padding: 16px;
}

.quote-card p {
    color: rgba(229,229,229,0.75);
    font-style: italic;
    line-height: 1.7;
    max-width: none;
}

.full-width-image {
  max-width: 100%;
  height: auto;
  display: block; /* Removes unwanted bottom whitespace */
}

.link {
  color: #00e5ff;
  text-decoration: none;
  position: relative;
}

.fw_flow {
  padding-bottom: 25px;
}

.closing-fade {
  opacity: 0;
  transition: opacity var(--modal-close-duration) var(--modal-close-ease);
}


/* ===== HERO STAGE / BELOW-FOLD FIRST SECTION ===== */
.hero#introHero {
  min-height: calc(100svh - 88px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: calc(72px + clamp(120px, 18vh, 220px));
}

.hero#introHero .hero-rule {
  margin-top: auto;
}

@media (max-width: 760px) {
  .hero#introHero {
    min-height: calc(100svh - 20px);
    padding-bottom: calc(64px + clamp(96px, 16vh, 160px));
  }
}


@media (max-width: 1100px) {
    .expanded-content {
        grid-template-columns: 1fr;
    }

    .expanded-content > .modal-sidebar {
        display: none;
    }

    .expanded-content > .modal-body-shell,
    .expanded-content > [data-modal-body-shell] {
        padding: 28px;
    }
}

@media (max-width: 760px) {
    .project-card.expanded {
        border-radius: 0;
        box-shadow: 0 24px 80px rgba(0,0,0,0.42) !important;
    }

    .expanded-content > .modal-body-shell,
    .expanded-content > [data-modal-body-shell] {
        padding: 20px 16px;
    }

    .modal-title {
        font-size: clamp(1.6rem, 8vw, 2.35rem);
    }

    .modal-subtitle,
    .modal-section p,
    .callout p,
    .image-caption p {
        font-size: 0.92rem;
    }

    .metric-strip,
    .callout-grid.two,
    .callout-grid.three,
    .image-grid.two,
    .image-grid.three {
        grid-template-columns: 1fr;
    }

    .utility-panel,
    .group-card,
    .project-card,
    .feature-band,
    .meta-panel {
        padding: 18px;
    }
}


/* ===== Browser compatibility warning ===== */
.browser-compat-root[hidden] {
  display: none !important;
}

.browser-compat-root {
  position: fixed;
  left: clamp(12px, 2vw, 24px);
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 24px);
  z-index: 1000;
  pointer-events: none;
}

.browser-compat-banner {
  pointer-events: auto;
  position: relative;
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 184, 77, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 184, 77, 0.08), rgba(255, 184, 77, 0.03)),
    rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
  color: rgba(229, 229, 229, 0.92);
}

.browser-compat-banner::before,
.browser-compat-banner::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  border-color: rgba(255, 184, 77, 0.55);
}

.browser-compat-banner::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.browser-compat-banner::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.browser-compat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.browser-compat-title {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 600;
  color: #fff;
}

.browser-compat-copy {
  margin: 0;
  color: rgba(229, 229, 229, 0.78);
  line-height: 1.65;
  font-size: 0.93rem;
  max-width: 70ch;
}

.browser-compat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.browser-compat-link,
.browser-compat-dismiss {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.browser-compat-link:hover,
.browser-compat-link:focus-visible,
.browser-compat-dismiss:hover,
.browser-compat-dismiss:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 184, 77, 0.62);
  background: rgba(255, 184, 77, 0.08);
  color: #fff;
  outline: none;
}

.browser-compat-link.primary {
  border-color: rgba(255, 184, 77, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 184, 77, 0.1);
}

.browser-compat-close {
  appearance: none;
  background: none;
  border: none;
  color: rgba(229, 229, 229, 0.72);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  font-size: 18px;
}

.browser-compat-close:hover,
.browser-compat-close:focus-visible {
  color: #fff;
  outline: 2px solid rgba(255, 184, 77, 0.55);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .browser-compat-root {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .browser-compat-banner {
    padding: 14px;
  }

  .browser-compat-actions {
    gap: 8px;
  }

  .browser-compat-link,
  .browser-compat-dismiss {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}


/* Topbar accessibility override: terrain toggle + nav links */

/* Terrain toggle: no border, same green family as landscape, accessible off state */
.terrain-toggle {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  color: rgb(208, 255, 111) !important;
}

.terrain-toggle svg {
  stroke: currentColor !important;
  transition: color 0.18s ease, stroke 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.terrain-toggle:hover,
.terrain-toggle:focus-visible {
  color: rgb(208, 255, 111) !important;
  opacity: 1;
}

body.terrain-off .terrain-toggle,
body.terrain-off .terrain-toggle svg {
  color: rgba(229, 229, 229, 0.62) !important;
  stroke: currentColor !important;
  opacity: 1 !important;
}

/* Navigation: same palette, brighter defaults to meet WCAG AA against dark topbar */
.topbar-nav {
  color: rgba(229, 229, 229, 0.72) !important;
}

.topbar-nav a,
.topbar-nav button,
.logout-link {
  color: inherit !important;
}

.topbar-nav .bracket {
  color: rgba(0, 229, 255, 0.62) !important;
}

.topbar-nav a:hover,
.topbar-nav button:hover,
.topbar-nav a:focus-visible,
.topbar-nav button:focus-visible {
  color: rgba(229, 229, 229, 0.92) !important;
}

.topbar-nav a:hover .bracket,
.topbar-nav button:hover .bracket,
.topbar-nav a:focus-visible .bracket,
.topbar-nav button:focus-visible .bracket {
  color: rgba(0, 229, 255, 0.82) !important;
}

/* Keyboard focus visibility */
.topbar-nav a:focus-visible,
.topbar-nav button:focus-visible,
.terrain-toggle:focus-visible,
.topbar-menu-toggle:focus-visible {
  outline: 2px solid rgba(0, 229, 255, 0.72);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Keep mobile flyout readable too */
@media (max-width: 900px) {
  .topbar-nav {
    color: rgba(229, 229, 229, 0.78) !important;
  }

  .topbar-nav .bracket {
    color: rgba(0, 229, 255, 0.68) !important;
  }
}





/* ===== Home shell refactor ===== */
#appChrome {
  position: relative;
  z-index: 40;
  opacity: 0;
  transition: opacity 0.65s ease;
}

#appChrome.is-visible {
  opacity: 1;
}

.page-shell {
  position: relative;
  z-index: 30;
  min-height: 100vh;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.75s ease, transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.page-shell.is-visible > section {
  opacity: 1;
  transform: none;
}

.page-shell > section {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.75s ease, transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-shell.is-visible > section:nth-child(1) { transition-delay: 90ms; }
.page-shell.is-visible > section:nth-child(2) { transition-delay: 170ms; }
.page-shell.is-visible > section:nth-child(3) { transition-delay: 250ms; }
.page-shell.is-visible > section:nth-child(4) { transition-delay: 330ms; }

#modalPortal {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}

#modalPortal.active {
  pointer-events: auto;
}

#lightboxPortal {
  position: relative;
  z-index: 1300;
}

.side-border.reveal-pulse {
  animation: chrome-rail-pulse 960ms cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar.reveal-pulse {
  animation: chrome-topbar-pulse 960ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chrome-rail-pulse {
  0% { opacity: 1; filter: brightness(1); }
  20% { opacity: 1; filter: brightness(1.5); }
  55% { opacity: 1; filter: brightness(1.1); }
  100% { opacity: 1; filter: brightness(1); }
}

@keyframes chrome-topbar-pulse {
  0% { box-shadow: inset 0 -1px 0 rgba(255,255,255,0.07); }
  25% { box-shadow: inset 0 -1px 0 rgba(0,229,255,0.72), 0 0 28px rgba(0,229,255,0.18); }
  100% { box-shadow: inset 0 -1px 0 rgba(255,255,255,0.07); }
}

body.card-open .page-shell,
body.card-open #worldChrome {
  filter: blur(6px);
}

body.card-open #appChrome,
body.card-open .topbar {
  filter: none !important;
}

body.modal-open .page-shell > section,
body.modal-open .page-shell .feature-band,
body.modal-open .page-shell .group-grid,
body.modal-open .page-shell #projectGrid,
body.modal-open .page-shell .utility-grid {
  opacity: 0.05;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body.modal-open .page-shell > header {
  opacity: 1;
}

@media (max-width: 760px) {
  .page-shell {
    transition-duration: 0.6s;
  }
}


/* Real background behind the reticle */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 50% 50%,
      rgba(0, 229, 255, 0.14) 0%,
      rgba(0, 229, 255, 0.08) 18%,
      rgba(0, 229, 255, 0.03) 34%,
      transparent 56%
    ),
    linear-gradient(
      180deg,
      #08131b 0%,
      #060b10 42%,
      #050505 100%
    );
}