/* loophole.dev - Monochrome flat-design with retro CD-ROM aesthetic */

/* CSS Custom Properties for animated weight breathing */
@property --headline-weight {
    syntax: '<number>';
    inherits: false;
    initial-value: 300;
}

@property --border-gap-pos {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 25%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0a0a0a;
    color: #b0b0b0;
    font-family: 'Albert Sans', sans-serif;
    font-size: clamp(0.95rem, 1.2vw + 0.5rem, 1.15rem);
    font-weight: 400;
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
}

/* Scanline Overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.015) 2px,
        rgba(255, 255, 255, 0.015) 3px
    );
    pointer-events: none;
    z-index: 9999;
}

body.panel-4-active::before {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 2px,
        rgba(255, 255, 255, 0.03) 3px
    );
}

/* Typography */
.headline {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.4rem, 5vw + 1rem, 5.6rem);
    font-weight: var(--headline-weight, 300);
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: #e8e8e8;
}

.headline.breathing {
    animation: breathe 8s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}

@keyframes breathe {
    0%, 100% { --headline-weight: 300; }
    50% { --headline-weight: 700; }
}

.body-text {
    font-family: 'Albert Sans', sans-serif;
    font-size: clamp(0.95rem, 1.2vw + 0.5rem, 1.15rem);
    font-weight: 400;
    line-height: 1.65;
    color: #b0b0b0;
    max-width: 54ch;
}

.meta-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82em;
    font-weight: 400;
    color: #5e5e5e;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-top: 1.5rem;
}

.code-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.4rem;
    font-weight: 400;
    color: #7a7a7a;
    line-height: 1.7;
    background: transparent;
    border: none;
    white-space: pre;
    display: block;
}

.code-keyword { color: #e8e8e8; }
.code-fn { color: #b0b0b0; }
.code-comment { color: #5e5e5e; font-style: italic; }

/* Loophole gap in title */
.loophole-gap {
    display: inline-block;
    width: 0.15em;
    height: 0.85em;
    vertical-align: baseline;
    position: relative;
}

.loophole-gap::after {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    width: 100%;
    height: 80%;
    border-left: 1px solid #3d3d3d;
    border-right: 1px solid #3d3d3d;
    opacity: 0.4;
}

/* Fixed Navigation Strip */
#nav-strip {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 1000;
    padding: 12px 0;
}

.nav-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #3d3d3d;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: border-color 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.nav-indicator.active {
    border-color: #e8e8e8;
}

.nav-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0%;
    height: 0%;
    background: #e8e8e8;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
                height 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.nav-indicator.visited::before {
    width: 100%;
    height: 100%;
}

/* Background Fish */
#bg-fish {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-fish {
    position: absolute;
    opacity: 0.04;
    filter: grayscale(100%) contrast(1.4) brightness(0.7);
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

.bg-fish:hover {
    opacity: 0.12;
}

.fish-bg-1 {
    width: 300px;
    height: auto;
    top: 15%;
    right: 8%;
    animation: swim1 40s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

.fish-bg-2 {
    width: 250px;
    height: auto;
    top: 45%;
    left: 75%;
    animation: swim2 35s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

.fish-bg-3 {
    width: 350px;
    height: auto;
    top: 70%;
    right: 15%;
    animation: swim3 45s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

@keyframes swim1 {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8vh); }
}

@keyframes swim2 {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-6vh) rotate(2deg); }
}

@keyframes swim3 {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10vh); }
}

/* Panels */
.panel {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4vh 6vw 4vh 48px;
    z-index: 1;
}

.panel-content {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2.4vw;
    align-items: center;
    width: 100%;
}

/* Panel 1 - Left heavy (Z-pattern entry top-left) */
.panel-left .panel-text-area {
    grid-column: 1 / 6;
}

.panel-left .panel-fish-area {
    grid-column: 7 / 11;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Panel 2 - Right heavy */
.panel-right .panel-fish-left {
    grid-column: 1 / 4;
    display: flex;
    justify-content: center;
    align-items: center;
}

.panel-right .panel-text-area {
    grid-column: 4 / 11;
}

/* Panel exit */
.panel-exit {
    justify-content: flex-end;
    align-items: flex-end;
}

.panel-exit .panel-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.exit-content {
    text-align: right;
    padding-bottom: 8vh;
}

.exit-line-container {
    display: flex;
    align-items: center;
    width: 85vw;
    margin-bottom: 2rem;
}

.exit-line {
    flex: 1;
    height: 1px;
    background: #2a2a2a;
}

.exit-gap {
    width: 40px;
}

.exit-text {
    margin-bottom: 2rem;
}

.domain-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 300;
    color: #e8e8e8;
    letter-spacing: -0.02em;
}

.exit-meta {
    margin-top: 0.5rem;
}

.exit-fish {
    position: relative;
    width: 60px;
    height: 42px;
    cursor: pointer;
}

.fish-interactive {
    width: 60px;
    height: 42px;
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.padlock-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 42px;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.exit-fish:hover .fish-interactive {
    opacity: 0;
}

.exit-fish:hover .padlock-icon {
    opacity: 1;
}

/* Panel Dividers - Partial lines with gaps */
.panel-divider {
    position: absolute;
    bottom: 0;
    display: flex;
    align-items: center;
    height: 4px;
}

.divider-odd {
    left: 15%;
    width: 40%;
}

.divider-even {
    left: 45%;
    width: 40%;
}

.divider-line {
    flex: 1;
    height: 4px;
    background: #1a1a1a;
}

.divider-gap {
    width: 40px;
    height: 4px;
}

/* Fish Accents */
.fish-accent {
    filter: grayscale(100%) contrast(1.4) brightness(0.7);
}

.lionfish {
    width: 300px;
    height: auto;
    opacity: 0.15;
    animation: swimUp 40s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

.pufferfish {
    width: 120px;
    height: auto;
    opacity: 0.2;
    animation: pufferBreath 3s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

@keyframes pufferBreath {
    0% { transform: scale(1); }
    100% { transform: scale(1.12); }
}

.angelfish-code {
    position: absolute;
    top: 10%;
    right: 5%;
    width: 100px;
    height: auto;
    opacity: 0.12;
    z-index: 1;
    animation: swimUp 30s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

.moorish-formation {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.moorish-1 {
    width: 60px;
    height: auto;
    opacity: 0.2;
    animation: moorishWave1 3s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

.moorish-2 {
    width: 80px;
    height: auto;
    opacity: 0.22;
    animation: moorishWave2 3s 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

.moorish-3 {
    width: 100px;
    height: auto;
    opacity: 0.25;
    animation: moorishWave3 3s 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) infinite alternate;
}

@keyframes moorishWave1 {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(5px) translateY(-3px); }
}

@keyframes moorishWave2 {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(-4px) translateY(-5px); }
}

@keyframes moorishWave3 {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(6px) translateY(-4px); }
}

@keyframes swimUp {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8vh); }
}

/* Broken Cards */
.broken-card {
    background: #151515;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    border: 1px solid #2a2a2a;
}

/* Each card has a gap in its right border */
.broken-card::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 30%;
    width: 1px;
    height: 4px;
    background: #151515;
    z-index: 1;
}

.broken-card:nth-child(2)::after {
    top: 50%;
}

.broken-card:nth-child(3)::after {
    top: 70%;
}

/* Code Block */
.code-block-wrapper {
    margin-top: 2rem;
}

.code-block {
    background: #151515;
    padding: 2.5rem 3rem;
    position: relative;
    overflow: hidden;
}

/* Animated border gap that rotates around perimeter */
.broken-border-animated {
    border: 1px solid #2a2a2a;
    background-image:
        linear-gradient(#151515, #151515);
    background-clip: padding-box;
}

.broken-border-animated::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    background: #151515;
    z-index: 2;
    animation: borderGapRotate 12s linear infinite;
}

@keyframes borderGapRotate {
    0% { top: -5px; left: 20%; }
    25% { top: 20%; left: calc(100% - 5px); }
    50% { top: calc(100% - 5px); left: 60%; }
    75% { top: 60%; left: -5px; }
    100% { top: -5px; left: 20%; }
}

/* Panel 4 - Depth: subtle background shift */
#panel-4 {
    background-color: #0a0a0a;
    transition: background-color 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#panel-4.in-view {
    background-color: #0f0f0f;
}

.prose-block .body-text {
    margin-bottom: 1.5rem;
}

.prose-block .body-text:last-child {
    margin-bottom: 0;
}

/* Definition text in panel 1 */
.definition {
    margin-top: 1.5rem;
    opacity: 0.9;
}

/* Section entry animations */
.panel {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.panel.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Variable weight on scroll for panel 2 body text */
.broken-card .body-text {
    transition: font-weight 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Hover states - Pure White only on hover */
.headline:hover {
    color: #f5f5f5;
}

.nav-indicator:hover {
    border-color: #f5f5f5;
}

/* Responsive */
@media (max-width: 768px) {
    .panel {
        padding: 4vh 4vw 4vh 40px;
    }

    .panel-content {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .panel-left .panel-text-area,
    .panel-left .panel-fish-area,
    .panel-right .panel-fish-left,
    .panel-right .panel-text-area {
        grid-column: auto;
    }

    .lionfish {
        width: 200px;
    }

    .exit-line-container {
        width: 90vw;
    }

    .code-text {
        font-size: 0.9rem;
    }

    #nav-strip {
        width: 24px;
    }

    .nav-indicator {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 480px) {
    .headline {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    .lionfish {
        width: 150px;
    }

    .code-text {
        font-size: 0.75rem;
    }

    .code-block {
        padding: 1.5rem;
    }
}
