/* =====================================================
   ALEXANDER TRIFONOV - TERMINAL EVOLUTION
   Retro CRT aesthetic meets modern design
   ===================================================== */

/* CSS Custom Properties */
:root {
    /* Colors */
    --void-black: #0a0a0a;
    --crt-dark: #111111;
    --crt-gray: #1a1a1a;
    --phosphor-green: #33ff33;
    --phosphor-green-dim: #1a8c1a;
    --phosphor-green-glow: rgba(51, 255, 51, 0.25);
    --amber: #ffb000;
    --amber-dim: #996a00;
    --amber-glow: rgba(255, 176, 0, 0.25);
    --text-primary: #e0e0e0;
    --text-secondary: #888888;

    /* Typography */
    --font-terminal: 'VT323', monospace;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-sans: 'IBM Plex Sans', sans-serif;

    /* Spacing */
    --section-padding: 6rem;
    --container-max: 1200px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-medium: 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--void-black);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Scanlines Overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9999;
    opacity: 0.5;
}

/* Highlight Classes */
.highlight-green {
    color: var(--phosphor-green);
    text-shadow: 0 0 10px var(--phosphor-green-glow);
}

.highlight-amber {
    color: var(--amber);
    text-shadow: 0 0 10px var(--amber-glow);
}

/* =====================================================
   HERO - INTERACTIVE BOOT SEQUENCE
   ===================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void-black);
    position: relative;
    overflow: hidden;
}

.hero.boot-complete {
    min-height: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
    transition: all 0.5s ease;
}

.boot-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
}

.boot-screen {
    font-family: var(--font-terminal);
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    color: var(--phosphor-green);
    text-align: left;
    text-shadow: 0 0 10px var(--phosphor-green-glow);
    min-height: 400px;
    line-height: 1.5;
}

.boot-output {
    white-space: pre-wrap;
    word-break: break-word;
}

.boot-output .line {
    display: block;
    min-height: 1.4em;
}

.boot-output .progress-line {
    display: block;
}

.boot-output .ascii-art {
    font-size: clamp(0.5rem, 1.2vw, 0.75rem);
    line-height: 1.15;
    margin: 1rem 0;
    display: block;
}

.boot-output .highlight-green {
    color: var(--phosphor-green);
    text-shadow: 0 0 15px var(--phosphor-green-glow);
    font-size: 1.1em;
}

.boot-output .highlight-amber {
    color: var(--amber);
    text-shadow: 0 0 15px var(--amber-glow);
}

.boot-prompt {
    display: block;
    text-align: center;
    margin-top: 30vh;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--phosphor-green);
    text-shadow: 0 0 10px var(--phosphor-green-glow);
    animation: pulse-glow 1.5s ease-in-out infinite;
    letter-spacing: 0.05em;
}

.boot-countdown {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--phosphor-green-dim);
    letter-spacing: 0.05em;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.7; text-shadow: 0 0 10px var(--phosphor-green-glow); }
    50% { opacity: 1; text-shadow: 0 0 20px var(--phosphor-green-glow), 0 0 30px var(--phosphor-green-glow); }
}

.boot-cursor {
    display: inline;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.skip-boot {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--text-secondary);
    padding: 0.5rem 1rem;
    min-height: 44px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    z-index: 100;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.skip-boot:hover,
.skip-boot:active {
    opacity: 1;
    border-color: var(--phosphor-green);
    color: var(--phosphor-green);
}

.skip-boot.hidden {
    display: none;
}

/* Screen flicker effect */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.8; }
    94% { opacity: 1; }
    95% { opacity: 0.9; }
    96% { opacity: 1; }
}

/* =====================================================
   SECTIONS - COMMON STYLES
   ===================================================== */
.section {
    padding: var(--section-padding) 0;
    position: relative;
}

.section-title {
    font-family: var(--font-terminal);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--phosphor-green);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px var(--phosphor-green-glow);
}

.terminal-prompt::before {
    content: '';
}

.section-subtitle {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

/* =====================================================
   PROFILE SECTION
   ===================================================== */
.profile-section {
    background: linear-gradient(180deg, var(--void-black) 0%, var(--crt-dark) 100%);
}

.profile-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 4rem;
    align-items: start;
}

@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.profile-photo-wrapper {
    position: sticky;
    top: 2rem;
}

.crt-frame {
    position: relative;
    padding: 1rem;
    background: var(--crt-gray);
    border: 2px solid var(--phosphor-green-dim);
    border-radius: 8px;
    box-shadow:
        0 0 20px var(--phosphor-green-glow),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.crt-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.03) 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    border-radius: 6px;
    pointer-events: none;
}

.profile-photo {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    filter: sepia(10%) contrast(1.1);
}

.photo-placeholder {
    display: none;
    width: 100%;
    aspect-ratio: 1;
    background: var(--void-black);
    border-radius: 4px;
    align-items: center;
    justify-content: center;
}

.placeholder-text {
    font-family: var(--font-terminal);
    color: var(--phosphor-green-dim);
    font-size: 1.2rem;
}

.reset-bios {
    display: block;
    width: 100%;
    min-height: 44px; /* Minimum touch target */
    font-family: var(--font-terminal);
    font-size: 0.8rem;
    color: var(--phosphor-green);
    background: transparent;
    border: 1px solid var(--phosphor-green-dim);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.reset-bios.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.reset-bios:hover,
.reset-bios:focus {
    background: rgba(51, 255, 51, 0.1);
    border-color: var(--phosphor-green);
    text-shadow: 0 0 10px var(--phosphor-green-glow);
    box-shadow: 0 0 10px var(--phosphor-green-glow);
    outline: none;
}

.reset-bios:active {
    background: rgba(51, 255, 51, 0.2);
    transform: scale(0.98);
}

.profile-contact {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-contact-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    min-height: 44px; /* Minimum touch target size */
    background: var(--crt-gray);
    border: 1px solid var(--phosphor-green-dim);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: all var(--transition-medium);
    -webkit-tap-highlight-color: transparent; /* Better mobile tap feedback */
    touch-action: manipulation; /* Disable double-tap zoom for faster response */
}

.profile-contact-link:hover,
.profile-contact-link:active {
    border-color: var(--phosphor-green);
    box-shadow: 0 0 15px var(--phosphor-green-glow);
}

.profile-contact-link .contact-icon {
    color: var(--phosphor-green);
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

.profile-content {
    padding-top: 1rem;
}

.intro-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    max-width: 600px;
}

/* =====================================================
   TIMELINE SECTION (Mobile-First)
   ===================================================== */
.timeline-section {
    background: var(--crt-dark);
    overflow: hidden;
}

.timeline-scroll {
    padding: 2rem 0;
}

/* Mobile: Vertical stacked layout */
.timeline-track {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0;
}

.timeline-era {
    background: var(--crt-gray);
    border: 1px solid var(--phosphor-green-dim);
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

/* Desktop: Horizontal scroll layout */
@media (min-width: 768px) {
    .timeline-scroll {
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--phosphor-green-dim) var(--crt-gray);
    }

    .timeline-scroll::-webkit-scrollbar {
        height: 8px;
    }

    .timeline-scroll::-webkit-scrollbar-track {
        background: var(--crt-gray);
        border-radius: 4px;
    }

    .timeline-scroll::-webkit-scrollbar-thumb {
        background: var(--phosphor-green-dim);
        border-radius: 4px;
    }

    .timeline-track {
        flex-direction: row;
        gap: 2rem;
        padding: 0 1rem;
        min-width: max-content;
    }

    .timeline-era {
        flex: 0 0 280px;
    }

    .timeline-era:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px var(--phosphor-green-glow);
    }
}

.timeline-era.current-era {
    border-color: var(--amber);
    box-shadow: 0 0 20px var(--amber-glow);
}

.era-header {
    margin-bottom: 1rem;
}

.era-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.25rem;
}

.era-title {
    font-family: var(--font-terminal);
    font-size: 1.3rem;
    color: var(--phosphor-green);
    text-shadow: 0 0 10px var(--phosphor-green-glow);
}

.current-era .era-title {
    color: var(--amber);
    text-shadow: 0 0 10px var(--amber-glow);
}

.you-are-here {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--amber);
    background: rgba(255, 176, 0, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.era-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.code-fossil {
    background: var(--void-black);
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--phosphor-green-dim);
}

.code-fossil code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--phosphor-green);
    display: block;
    line-height: 1.6;
}

.strata-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--phosphor-green-dim), var(--phosphor-green), var(--phosphor-green-dim));
    border-radius: 0 0 8px 8px;
    opacity: 0.5;
}

.current-era .strata-layer {
    background: linear-gradient(90deg, var(--amber-dim), var(--amber), var(--amber-dim));
}

/* =====================================================
   SKILLS SECTION
   ===================================================== */
.skills-section {
    background: var(--void-black);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.skill-card {
    background: var(--crt-gray);
    border: 1px solid var(--phosphor-green-dim);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.skill-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 15px var(--phosphor-green-glow);
}

.skill-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--crt-dark);
}

.skill-icon {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--phosphor-green-dim);
}

.skill-header h3 {
    font-family: var(--font-terminal);
    font-size: 1.3rem;
    color: var(--phosphor-green);
}

.skill-list {
    list-style: none;
}

.skill-list li {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.skill-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--phosphor-green-dim);
}

/* =====================================================
   GLOBAL SECTION
   ===================================================== */
.global-section {
    background: var(--crt-dark);
}

.global-map {
    margin: 2rem 0;
}

.map-container {
    position: relative;
    display: flex;
    justify-content: center;
}

.ascii-map {
    font-family: var(--font-terminal);
    font-size: clamp(0.5rem, 1.5vw, 0.9rem);
    color: var(--phosphor-green-dim);
    line-height: 1.3;
    white-space: pre;
    text-align: center;
}

.ping-dots {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.ping-dot {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 8px;
    height: 8px;
    background: var(--phosphor-green);
    border-radius: 50%;
    animation: ping 2s infinite;
    box-shadow: 0 0 10px var(--phosphor-green);
}

.ping-dot:nth-child(2) { animation-delay: 0.3s; }
.ping-dot:nth-child(3) { animation-delay: 0.6s; }
.ping-dot:nth-child(4) { animation-delay: 0.9s; }
.ping-dot:nth-child(5) { animation-delay: 1.2s; }

@keyframes ping {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.locations-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.location {
    color: var(--text-primary);
}

.separator {
    color: var(--phosphor-green-dim);
}

/* =====================================================
   ABOUT SECTION
   ===================================================== */
.about-section {
    background: linear-gradient(180deg, var(--void-black) 0%, var(--crt-dark) 100%);
}

.about-content {
    max-width: 700px;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.dino-quote {
    font-family: var(--font-terminal);
    font-size: 1.5rem;
    color: var(--amber);
    text-shadow: 0 0 20px var(--amber-glow);
    padding: 1.5rem;
    margin-top: 2rem;
    border-left: 4px solid var(--amber);
    background: rgba(255, 176, 0, 0.05);
    border-radius: 0 8px 8px 0;
}

/* =====================================================
   TERMINAL SECTION
   ===================================================== */
.terminal-section {
    background: var(--crt-dark);
}

.interactive-terminal {
    max-width: 700px;
    background: var(--void-black);
    border: 1px solid var(--crt-gray);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    margin-bottom: 3rem;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--crt-gray);
    border-bottom: 1px solid var(--void-black);
}

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

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27ca40; }

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

.terminal-body {
    padding: 1rem;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.terminal-line {
    color: var(--text-secondary);
    line-height: 1.6;
}

.terminal-line .cmd-highlight {
    color: var(--phosphor-green);
}

.terminal-line.command {
    color: var(--phosphor-green);
}

.terminal-line.response {
    color: var(--text-primary);
    padding-left: 1rem;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--crt-gray);
}

.prompt {
    font-family: var(--font-terminal);
    color: var(--phosphor-green);
    font-size: 1.1rem;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--phosphor-green);
    caret-color: var(--phosphor-green);
}

.terminal-input::placeholder {
    color: var(--phosphor-green-dim);
    opacity: 0.5;
}

/* Contact Cards */
.contact-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    min-height: 48px; /* Minimum touch target size */
    background: var(--crt-gray);
    border: 1px solid var(--phosphor-green-dim);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-medium);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.contact-card:hover,
.contact-card:active {
    border-color: var(--phosphor-green);
    box-shadow: 0 0 20px var(--phosphor-green-glow);
    transform: translateY(-2px);
}

.contact-icon {
    font-family: var(--font-terminal);
    font-size: 1.5rem;
    color: var(--phosphor-green);
    width: 2rem;
    text-align: center;
}

.contact-label {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    padding: 3rem 0;
    background: var(--void-black);
    border-top: 1px solid var(--crt-gray);
}

.footer-content {
    text-align: center;
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.copyright {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */
@media (max-width: 768px) {
    :root {
        --section-padding: 4rem;
    }

    .container {
        padding: 0 1.5rem;
    }

    .boot-line.ascii-art pre {
        font-size: 0.5rem;
    }

    .timeline-era {
        flex: 0 0 240px;
    }

    .ascii-map {
        display: none;
    }

    .ping-dots {
        display: none;
    }

    .profile-photo-wrapper {
        position: static;
        max-width: 200px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .boot-line.ascii-art {
        display: none;
    }

    .contact-cards {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-card {
        justify-content: center;
    }
}
