/* geist-regular - latin */
@font-face {
    font-display: swap;
    font-family: 'Geist';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/geist-v4-latin-regular.woff2') format('woff2');
}

/* geist-600 - latin */
@font-face {
    font-display: swap;
    font-family: 'Geist';
    font-style: normal;
    font-weight: 600;
    src: url('../fonts/geist-v4-latin-600.woff2') format('woff2');
}

/* geist-700 - latin */
@font-face {
    font-display: swap;
    font-family: 'Geist';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/geist-v4-latin-700.woff2') format('woff2');
    /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* jetbrains-mono-regular - latin */
@font-face {
    font-display: swap;
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/jetbrains-mono-v24-latin-regular.woff2') format('woff2');
}

/* jetbrains-mono-600 - latin */
@font-face {
    font-display: swap;
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 600;
    src: url('../fonts/jetbrains-mono-v24-latin-600.woff2') format('woff2');
}

/* jetbrains-mono-700 - latin */
@font-face {
    font-display: swap;
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/jetbrains-mono-v24-latin-700.woff2') format('woff2');
}


:root {
    --bg: #000B1E;
    --accent: #00A3FF;
    --text: #F8FAFC;
    --text-muted: #8AA4C8;
    --border-color: rgba(138, 164, 200, 0.2);
    --terminal-bg: rgba(0, 11, 30, 0.8);
    --terminal-border: rgba(0, 163, 255, 0.3);

    --font-sans: 'Geist', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --torch-x: -500px;
    --torch-y: -500px;

    --global-progress: 0;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Scroll Line (The Backbone) */
.scroll-line {
    position: fixed;
    top: 0;
    left: 2rem;
    width: 2px;
    height: 100vh;
    background: linear-gradient(to bottom, transparent, var(--accent) 10%, var(--accent) 90%, transparent);
    z-index: 10;
    transform-origin: top;
    transform: scaleY(var(--global-progress));
    opacity: 0.5;
    pointer-events: none;
}

@media (max-width: 768px) {
    .scroll-line {
        left: 0.5rem;
    }
}

/* Torch Effect & Grid */
.blueprint-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background-size: 20px 20px;
    background-image: radial-gradient(circle, rgba(248, 250, 252, 0.05) 1px, transparent 1px);
}

#torch {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    background-size: 20px 20px;
    background-image: radial-gradient(circle, rgba(248, 250, 252, 0.25) 1px, transparent 1px);
    mask-image: radial-gradient(circle 350px at var(--torch-x) var(--torch-y), black, transparent);
    -webkit-mask-image: radial-gradient(circle 350px at var(--torch-x) var(--torch-y), black, transparent);
}

/* Global Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem 4rem 6rem;
    /* Left padding accommodates scroll line */
}

@media (max-width: 768px) {
    .container {
        padding-left: 2rem;
    }
}

/* Typography elements */
.accent {
    color: var(--accent);
}

.code-comment {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Section styling */
.section-header {
    margin-bottom: 2.5rem;
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
}

.section-header h2 {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--accent);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.line-decorator {
    height: 1px;
    width: 150px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

/* Hero Section */
.hero {
    margin: 4rem 0 8rem 0;
}

.badge-location {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.main-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    font-weight: 400;
}

/* Split Sections (Projects) */
.projects {
    margin-bottom: 6rem;
}

.split-section {
    position: relative;
    background: rgba(0, 11, 30, 0.5);
    backdrop-filter: blur(5px);
    margin-bottom: 4rem;
    padding: 1px;
    /* border space */
}

.split-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    /* CRITICAL for sticky */
    min-height: 100vh;
    /* Allow enough height for storytelling scrolling */
    opacity: calc(var(--progress) * 2);
    /* Fade in based on progress */
}

/* Sticky Z-Pattern Alternating Layout */
.split-section:nth-child(odd) .split-content {
    flex-direction: row-reverse;
}

@media (max-width: 900px) {

    .split-content,
    .split-section:nth-child(odd) .split-content {
        flex-direction: column;
        opacity: 1 !important;
        /* Force visibility on mobile */
    }
}

.visual-pane {
    position: sticky;
    top: 10vh;
    /* Sticks 10vh from the top */
    height: 80vh;
    /* Fixed viewport height */
    flex: 1 1 50%;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: rgba(8, 163, 255, 0.02);
    /* Border adjustments based on visual position */
    border-right: 1px dashed var(--border-color);
}

.visual-pane .card-header {
    width: 100%;
    align-self: flex-start;
    margin-bottom: auto;
    /* Push content to middle */
}

.visual-wrapper {
    width: 100%;
    max-width: 500px;
    margin-bottom: auto;
}

.split-section:nth-child(odd) .visual-pane {
    border-right: none;
    border-left: 1px dashed var(--border-color);
}

@media (max-width: 900px) {
    .visual-pane {
        position: relative;
        top: 0;
        height: 50vh;
        border-right: none;
        border-left: none;
        border-bottom: 1px dashed var(--border-color);
        flex: 1 1 100%;
        width: 100%;
    }

    .split-section:nth-child(odd) .visual-pane {
        border-left: none;
        border-bottom: 1px dashed var(--border-color);
    }
}

.visual-wrapper {
    width: 100%;
    max-width: 500px;
}

.tech-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0, 163, 255, 0.2));
}

.text-pane {
    flex: 1 1 50%;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
}

@media (max-width: 900px) {
    .text-pane {
        flex: 1 1 100%;
        width: 100%;
    }
}

.card-header {
    margin-bottom: 4rem;
    /* Spacer before stories */
}

.card-header h3 {
    font-size: 2rem;
    /* Make it bigger for the story intro */
    font-weight: 600;
    color: var(--text);
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
}

/* Immersive Storytelling Blocks */
.story-block {
    margin-bottom: 6rem;
    /* High margin to enforce scrolling */
}

.story-block:last-child {
    margin-bottom: 2rem;
}

.story-title {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.story-block p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Formula & Metrics display */
.story-data {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(0, 163, 255, 0.05);
    border: 1px dashed var(--terminal-border);
}

.metric-line {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.metric-line:last-child {
    margin-bottom: 0;
}

/* Terminal Buttons */
.terminal-btn {
    display: inline-block;
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: rgba(0, 11, 30, 0.8);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: bold;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.terminal-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(0, 163, 255, 0.15);
    transition: all 0.3s ease;
    z-index: 0;
}

.terminal-btn:hover::before {
    left: 0;
}

.terminal-btn {
    z-index: 1;
    /* relative to ::before */
}

.terminal-btn:hover {
    box-shadow: 0 0 15px rgba(0, 163, 255, 0.4);
    text-shadow: 0 0 8px rgba(0, 163, 255, 0.8);
}


/* Terminal System Logs */
.system-logs {
    margin-bottom: 6rem;
}

.terminal {
    background: var(--terminal-bg);
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    position: relative;
    padding: 1px;
    /* space for borders */
}

.terminal-header {
    background: rgba(0, 11, 30, 0.95);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--terminal-border);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    opacity: calc(var(--progress) * 4);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
}

.dot.yellow {
    background: #ffbd2e;
}

.dot.green {
    background: #27c93f;
}

.terminal-header .title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.terminal-body {
    padding: 2rem 2rem 3rem 2rem;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
    opacity: calc(var(--progress) * 2);
}

.log-line {
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.timestamp {
    color: var(--text-muted);
}

.status {
    color: var(--accent);
    font-weight: bold;
}

.message {
    color: var(--text);
}

.comment {
    color: rgba(138, 164, 200, 0.7);
    font-size: 0.9em;
}

/* Contact Module */
.contact-module {
    border-radius: 0;
    max-width: 600px;
}

.contact-body {
    padding: 3rem;
    background: repeating-linear-gradient(45deg,
            rgba(0, 11, 30, 0.9),
            rgba(0, 11, 30, 0.9) 10px,
            rgba(0, 163, 255, 0.05) 10px,
            rgba(0, 163, 255, 0.05) 20px);
}

.contact-data {
    font-size: 1.2rem;
    font-weight: bold;
    word-break: break-all;
    /* Prevent email from overflowing on mobile */
}

.log-prompt {
    margin-top: 1.5rem;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--text);
    animation: blink 1s step-end infinite;
    vertical-align: bottom;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Scroll-Driven Animated Borders SVG & Paths */
.border-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    /* Flip SVG vertically to draw from bottom up */
    transform: scaleY(-1);
}

.animated-border {
    stroke: var(--terminal-border);
    stroke-width: 2px;
    stroke-dasharray: 1;
    /* Stroke calculation based directly on --progress (0 to 1) */
    stroke-dashoffset: calc(1 - var(--progress));
}

.animated-path {
    stroke-dasharray: 1;
    /* Internal SVGs draw forwards as we scroll down */
    stroke-dashoffset: calc(1 - var(--progress));
    /* No CSS transition, purely JS/Scroll driven */
}

@media (max-width: 900px) {

    .animated-border,
    .animated-path {
        stroke-dashoffset: 0 !important;
        /* Force fully drawn on mobile */
    }
}

/* No-Lag Corners */
.corner {
    position: absolute;
    width: 15px;
    height: 15px;
    border: 0 solid var(--accent);
    z-index: 3;
    pointer-events: none;
    background-color: transparent;
    opacity: calc((var(--progress) - 0.95) * 100);
}

.corner.top-left {
    top: -1px;
    left: -1px;
    border-top-width: 2px;
    border-left-width: 2px;
}

.corner.top-right {
    top: -1px;
    right: -1px;
    border-top-width: 2px;
    border-right-width: 2px;
}

.corner.bottom-left {
    bottom: -1px;
    left: -1px;
    border-bottom-width: 2px;
    border-left-width: 2px;
}

.corner.bottom-right {
    bottom: -1px;
    right: -1px;
    border-bottom-width: 2px;
    border-right-width: 2px;
}

@media (max-width: 900px) {
    .corner {
        opacity: 1 !important;
        /* Force fully visible on mobile */
    }
}

/* Modal System */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 11, 30, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-border);
    box-shadow: 0 0 30px rgba(0, 163, 255, 0.2);
    width: 90%;
    max-width: 1000px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px dashed var(--terminal-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 163, 255, 0.05);
}

.modal-title {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 0.9rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ff5f56;
}

.modal-body {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-body video,
.modal-body img {
    max-width: 100%;
    max-height: 75vh;
    border: 1px solid rgba(138, 164, 200, 0.2);
}

/* Code blocks directly inside SVG foreignObject */
.svg-code-block {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent);
    background: rgba(0, 11, 30, 0.8);
    border: 1px dashed rgba(0, 163, 255, 0.4);
    padding: 10px;
    border-radius: 4px;
    white-space: pre;
    line-height: 1.4;
    width: 100%;
    height: 100%;
}

.svg-keyword {
    color: #ff5f56;
}

/* Redish for flow control */
.svg-function {
    color: #27c93f;
}

/* Green for functions */

/* Footer */
.footer {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 3rem 0 2rem 0;
    border-top: 1px dashed var(--border-color);
}