/* ================================================
   loophole.dev - Evolved Minimal / Dashboard / Marble
   Palette: Midnight-Blue
   Fonts: Exo 2, Inter, IBM Plex Mono
   ================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #0a0f24;
    color: #e8ecf2;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    line-height: 1.7;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: #d4a847;
    color: #0a0f24;
}

/* --- Layer 0: Marble Background --- */
.marble-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.marble-veins {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    opacity: 0.04;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(232, 236, 242, 0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(232, 236, 242, 0.4) 0%, transparent 40%),
        radial-gradient(ellipse at 40% 80%, rgba(232, 236, 242, 0.3) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 20%, rgba(232, 236, 242, 0.5) 0%, transparent 35%),
        radial-gradient(ellipse at 50% 50%, rgba(232, 236, 242, 0.2) 0%, transparent 60%);
    background-blend-mode: soft-light;
    animation: marble-drift 20s linear infinite;
}

@keyframes marble-drift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-2%, -1%); }
    100% { transform: translate(0, 0); }
}

/* --- Top Bar --- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    background: rgba(10, 15, 36, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #1a2744;
}

.topbar-wordmark {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
    color: #e8ecf2;
}

.wordmark-dot {
    color: #d4a847;
}

.nav-toggle {
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid #2d3a52;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: border-color 0.3s ease;
    position: relative;
    z-index: 110;
}

.nav-toggle:hover {
    border-color: #4a6fa5;
}

.hamburger-line {
    display: block;
    width: 18px;
    height: 1.5px;
    background-color: #4a6fa5;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active .hamburger-line:first-child {
    transform: translateY(3.25px) rotate(45deg);
}

.nav-toggle.active .hamburger-line:last-child {
    transform: translateY(-3.25px) rotate(-45deg);
}

/* --- Overlay Navigation --- */
.overlay-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99;
    background: rgba(10, 15, 36, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay-nav.active {
    opacity: 1;
    visibility: visible;
}

.overlay-nav-list {
    list-style: none;
    text-align: center;
}

.overlay-nav-list li {
    margin: 24px 0;
}

.overlay-nav-link {
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: #2d3a52;
    text-decoration: none;
    letter-spacing: -0.03em;
    transition: color 0.3s ease;
    position: relative;
}

.overlay-nav-link:hover {
    color: #d4a847;
}

.overlay-nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #d4a847;
    transition: width 0.3s ease;
}

.overlay-nav-link:hover::after {
    width: 100%;
}

/* --- Sidebar Rail --- */
.sidebar-rail {
    position: fixed;
    top: 56px;
    left: 0;
    width: 56px;
    height: calc(100vh - 56px);
    background: #111a33;
    border-right: 1px solid #1a2744;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 24px;
    gap: 8px;
    overflow: hidden;
}

.rail-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 18px;
    cursor: pointer;
    color: #4a6fa5;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.rail-item:hover {
    background: rgba(74, 111, 165, 0.08);
    color: #d4a847;
}

.rail-item.active {
    color: #d4a847;
    background: rgba(212, 168, 71, 0.06);
}

.rail-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    stroke: currentColor;
}

.rail-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    margin-left: 12px;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-width 0.3s ease-out, opacity 0.3s ease-out;
}

.sidebar-rail:hover .rail-label {
    max-width: 160px;
    opacity: 1;
}

.sidebar-rail:hover {
    width: 240px;
    transition: width 0.3s ease-out;
}

.sidebar-rail {
    transition: width 0.3s ease-out;
}

/* --- Main Content --- */
.main-content {
    margin-left: 56px;
    padding-top: 56px;
    position: relative;
    z-index: 1;
}

/* --- Acts (Sections) --- */
.act {
    position: relative;
    min-height: 100vh;
}

/* --- Act 1: The Question --- */
.act-1 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.act-1-inner {
    text-align: center;
    padding: 48px 24px;
    max-width: 900px;
}

.hero-heading {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 4.8rem);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    line-height: 1.1;
    color: #e8ecf2;
    margin-bottom: 40px;
}

.gold-crack {
    width: 100%;
    height: 2px;
    background: #d4a847;
    margin: 0 auto 40px;
    transform: scaleX(0);
    transform-origin: left;
    animation: crack-draw 3s ease-out forwards;
}

.gold-crack-wide {
    max-width: 600px;
    animation-delay: 0.5s;
}

@keyframes crack-draw {
    0% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

.hero-cta {
    margin-top: 48px;
}

.cta-comment {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #4a6fa5;
    cursor: pointer;
    transition: color 0.3s ease;
    display: inline-block;
    padding: 12px 24px;
    border: 1px solid #2d3a52;
    border-radius: 2px;
}

.cta-comment:hover {
    color: #d4a847;
    border-color: #4a6fa5;
    box-shadow: 0 4px 16px rgba(74, 111, 165, 0.2);
}

/* --- Act 2: The Surface --- */
.act-2 {
    min-height: 150vh;
    padding: 120px 0;
}

.act-2-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 48px;
}

/* --- Statement Blocks --- */
.statement-block {
    max-width: 100%;
    margin-bottom: 80px;
}

.statement-block-secondary {
    margin-top: 80px;
}

.section-heading {
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: -0.03em;
    color: #e8ecf2;
    margin-bottom: 16px;
}

.section-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #e8ecf2;
    opacity: 0.85;
    max-width: 640px;
}

.gold-text {
    color: #d4a847;
    opacity: 1;
    font-weight: 500;
    font-size: clamp(1.1rem, 1.5vw, 1.25rem);
}

/* --- Detail Column --- */
.detail-column {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Dashboard Cards (Layer 2) --- */
.dashboard-card {
    background: #111a33;
    border: 1px solid #2d3a52;
    border-radius: 4px;
    padding: 24px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    position: relative;
}

.dashboard-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: #d4a847;
    transition: width 0.3s ease;
}

.dashboard-card:hover {
    border-color: #4a6fa5;
    box-shadow: 0 8px 32px rgba(10, 15, 36, 0.35);
    transform: translateY(-2px);
}

.dashboard-card:hover::after {
    width: 100%;
}

.dashboard-card:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(10, 15, 36, 0.25);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #1a2744;
}

.card-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #4a6fa5;
}

.card-timestamp {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #2d3a52;
}

.card-body p {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #e8ecf2;
    opacity: 0.8;
    font-size: 0.95rem;
    line-height: 1.7;
}

.card-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #1a2744;
}

.card-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #4a6fa5;
    letter-spacing: 0.05em;
}

.card-status-alert {
    color: #c44b4b;
}

/* --- Act 3: The Fracture --- */
.act-3 {
    min-height: 150vh;
    padding: 120px 0;
    position: relative;
    overflow: hidden;
}

.fracture-veins {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.06;
    background:
        linear-gradient(137deg, transparent 40%, rgba(232, 236, 242, 0.5) 40.5%, transparent 41%),
        linear-gradient(213deg, transparent 55%, rgba(232, 236, 242, 0.3) 55.3%, transparent 55.6%),
        linear-gradient(167deg, transparent 30%, rgba(232, 236, 242, 0.4) 30.2%, transparent 30.5%),
        linear-gradient(78deg, transparent 65%, rgba(212, 168, 71, 0.4) 65.2%, transparent 65.5%),
        linear-gradient(312deg, transparent 45%, rgba(212, 168, 71, 0.3) 45.2%, transparent 45.5%);
    animation: fracture-shift 20s linear infinite;
}

@keyframes fracture-shift {
    0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 100px 50px, -50px 100px, 75px -25px, -100px 75px, 50px -100px; }
}

.act-3-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 48px;
    position: relative;
    z-index: 2;
}

/* --- Floating Panels --- */
.floating-panel {
    background: rgba(17, 26, 51, 0.9);
    border: 1px solid rgba(74, 111, 165, 0.15);
    backdrop-filter: blur(2px);
    border-radius: 4px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(10, 15, 36, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.3s ease;
    position: relative;
}

.floating-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: #d4a847;
    transition: width 0.3s ease;
}

.floating-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(10, 15, 36, 0.45);
    border-color: rgba(74, 111, 165, 0.3);
}

.floating-panel:hover::after {
    width: 100%;
}

.panel-marker {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    color: #d4a847;
    margin-bottom: 12px;
    font-weight: 400;
}

.panel-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #e8ecf2;
    opacity: 0.85;
    font-size: 0.95rem;
    line-height: 1.7;
}

.panel-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #1a2744;
}

.meta-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #d4a847;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.meta-ref {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #2d3a52;
}

/* --- Act 4: The Discovery --- */
.act-4 {
    min-height: 100vh;
    padding: 120px 0;
    position: relative;
}

.act-4::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(212, 168, 71, 0.03) 30%, rgba(212, 168, 71, 0.06) 50%, rgba(212, 168, 71, 0.03) 70%, transparent 100%);
    pointer-events: none;
}

.act-4-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 48px;
    position: relative;
    z-index: 2;
}

.discovery-block {
    text-align: center;
    margin-bottom: 80px;
}

.discovery-heading {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4.5vw, 3.6rem);
    letter-spacing: -0.03em;
    color: #d4a847;
    line-height: 1.15;
    margin-bottom: 32px;
}

.discovery-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #e8ecf2;
    opacity: 0.9;
    max-width: 640px;
    margin: 0 auto;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.8;
}

/* --- Discovery Grid --- */
.discovery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 60px;
}

.discovery-card {
    background: #111a33;
    border: 1px solid #2d3a52;
    border-radius: 4px;
    padding: 32px 24px;
    text-align: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    position: relative;
}

.discovery-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: #d4a847;
    transition: width 0.3s ease;
}

.discovery-card:hover {
    border-color: #4a6fa5;
    box-shadow: 0 8px 32px rgba(10, 15, 36, 0.35);
    transform: translateY(-2px);
}

.discovery-card:hover::after {
    width: 100%;
}

.discovery-card:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(10, 15, 36, 0.25);
}

.discovery-card-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    color: #d4a847;
}

.discovery-card-icon svg {
    width: 100%;
    height: 100%;
}

.discovery-card-title {
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
    color: #e8ecf2;
    margin-bottom: 12px;
}

.discovery-card-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    color: #e8ecf2;
    opacity: 0.75;
    line-height: 1.6;
}

/* --- Act 5: The Exit --- */
.act-5 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.act-5-inner {
    text-align: center;
    padding: 48px 24px;
    position: relative;
}

.exit-vein-loop {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 0.04;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(212, 168, 71, 0.5) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(232, 236, 242, 0.4) 0%, transparent 40%);
    animation: exit-pulse 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes exit-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.04; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.07; }
}

.exit-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.95rem;
    color: #2d3a52;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.exit-gold {
    color: #d4a847;
}

.exit-meta {
    margin-top: 40px;
    position: relative;
    z-index: 1;
}

.exit-version {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #1a2744;
    letter-spacing: 0.05em;
}

/* --- Scroll Reveal Animations --- */
.act .statement-block,
.act .detail-column,
.act .discovery-block,
.act .discovery-grid {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.act .statement-block.revealed,
.act .detail-column.revealed,
.act .discovery-block.revealed,
.act .discovery-grid.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Parallax Layer Offsets (subtle) --- */
.layer-parallax-slow {
    will-change: transform;
}

.layer-parallax-medium {
    will-change: transform;
}

.layer-parallax-fast {
    will-change: transform;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar-rail {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .discovery-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .act-2-inner,
    .act-3-inner,
    .act-4-inner {
        padding: 0 24px;
    }

    .hero-heading {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    .discovery-heading {
        font-size: clamp(1.4rem, 5vw, 2.4rem);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .panel-meta {
        flex-direction: column;
        gap: 4px;
    }

    .topbar {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .act-1-inner,
    .act-5-inner {
        padding: 24px 16px;
    }

    .floating-panel,
    .dashboard-card {
        padding: 16px;
    }

    .discovery-card {
        padding: 24px 16px;
    }
}
