/* ═══════════════════════════════════════════════════════════════
   MIKKO NIEMELÄ - RETRO ASCII TERMINAL THEME
   1990s aesthetic meets 2026 performance
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg-color: #0a0a0a;
    --terminal-bg: #1a1a2e;
    --text-primary: #00ff41;
    --text-secondary: #0abdc6;
    --text-dim: #4a5568;
    --accent: #ff00ff;
    --accent-secondary: #ffff00;
    --border-color: #00ff41;
    --glow: 0 0 10px rgba(0, 255, 65, 0.5);
    --font-mono: 'Space Mono', 'Courier New', monospace;
    --font-retro: 'VT323', monospace;
    --font-reading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Theme: Matrix (default) - Classic dark hacker */
[data-theme="matrix"] {
    --bg-color: #0a0a0a;
    --terminal-bg: #1a1a2e;
    --text-primary: #00ff41;
    --text-secondary: #0abdc6;
    --text-dim: #4a5568;
    --accent: #ff00ff;
    --accent-secondary: #ffff00;
    --border-color: #00ff41;
    --glow: 0 0 10px rgba(0, 255, 65, 0.5);
}

/* Theme: Amber - Warm sepia/parchment light theme */
[data-theme="amber"] {
    --bg-color: #f5e6d3;
    --terminal-bg: #fffef5;
    --text-primary: #8b4513;
    --text-secondary: #a0522d;
    --text-dim: #b8a088;
    --accent: #d2691e;
    --accent-secondary: #cd853f;
    --border-color: #8b4513;
    --glow: 0 0 8px rgba(139, 69, 19, 0.3);
}

/* Theme: Ocean - Deep blue marine */
[data-theme="cyan"] {
    --bg-color: #0a1628;
    --terminal-bg: #0d2137;
    --text-primary: #00d4ff;
    --text-secondary: #00ffcc;
    --text-dim: #3a6a8a;
    --accent: #ff6b6b;
    --accent-secondary: #4ecdc4;
    --border-color: #00d4ff;
    --glow: 0 0 15px rgba(0, 212, 255, 0.4);
}

/* Theme: Synthwave - Purple/pink retro sunset */
[data-theme="synthwave"] {
    --bg-color: #1a0a2e;
    --terminal-bg: #2d1b4e;
    --text-primary: #ff6ec7;
    --text-secondary: #00ffff;
    --text-dim: #8a6aaa;
    --accent: #ff00ff;
    --accent-secondary: #ffd319;
    --border-color: #ff6ec7;
    --glow: 0 0 20px rgba(255, 110, 199, 0.5);
}

/* Theme: Light - Clean modern light mode */
[data-theme="phosphor"] {
    --bg-color: #f5f5f5;
    --terminal-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #374151;
    --text-dim: #9ca3af;
    --accent: #2563eb;
    --accent-secondary: #059669;
    --border-color: #d1d5db;
    --glow: none;
}

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

/* Smooth theme transitions */
body,
.terminal-window,
.terminal-header,
.theme-switcher,
nav a,
.btn,
h1, h2, h3,
p, li, span,
.ascii-logo,
.footer-ascii {
    transition: background-color 0.4s ease,
                color 0.4s ease,
                border-color 0.4s ease,
                box-shadow 0.4s ease,
                text-shadow 0.4s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scanlines overlay - subtle for readability */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08),
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.15;
}

/* Hide scanlines on light theme for clean reading */
[data-theme="phosphor"] .scanlines,
[data-theme="amber"] .scanlines {
    opacity: 0;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* SVG diagram styles */
.blog-content svg {
    color: var(--text-primary);
    margin: 30px auto;
    display: block;
}

.blog-content svg text {
    font-family: var(--font-reading);
}

.blog-content svg rect,
.blog-content svg line,
.blog-content svg polygon {
    vector-effect: non-scaling-stroke;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER & NAVIGATION
   ═══════════════════════════════════════════════════════════════ */

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.ascii-logo {
    font-family: 'Courier New', Courier, 'Lucida Console', Monaco, monospace;
    font-size: clamp(8px, 1.5vw, 14px);
    color: var(--text-primary);
    text-shadow: var(--glow);
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.1;
    letter-spacing: 0;
}

nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

nav a {
    font-family: var(--font-retro);
    font-size: 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

nav a:hover,
nav a.active {
    color: var(--text-primary);
    border-color: var(--text-primary);
    text-shadow: var(--glow);
    background: rgba(0, 255, 65, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   TERMINAL WINDOW
   ═══════════════════════════════════════════════════════════════ */

.terminal-window {
    background: var(--terminal-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 30px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
}

.terminal-header {
    background: linear-gradient(to bottom, #3a3a5a, #2a2a4a);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

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

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

.terminal-title {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.terminal-content {
    padding: 30px 35px;
}

/* More padding for reading content on larger screens */
@media (min-width: 768px) {
    .terminal-content {
        padding: 40px 50px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */

.prompt {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.prompt::before {
    content: '>';
    color: var(--accent);
    margin-right: 8px;
}

h1 {
    font-family: var(--font-retro);
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--text-primary);
    text-shadow: var(--glow);
    margin-bottom: 25px;
    letter-spacing: 2px;
}

/* Clean h1 for reading content */
.blog-content h1 {
    font-family: var(--font-reading);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    text-shadow: none;
    letter-spacing: normal;
    margin-bottom: 10px;
}

/* Glitch effect */
.glitch {
    position: relative;
    animation: glitch-skew 4s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    color: var(--accent);
    animation: glitch-effect 3s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    transform: translate(-2px);
}

.glitch::after {
    color: var(--text-secondary);
    animation: glitch-effect 2s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    transform: translate(2px);
}

@keyframes glitch-effect {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    10% { transform: skew(0.5deg); }
    20% { transform: skew(-0.5deg); }
    30% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

.bio p,
.interests p,
.credentials li {
    font-family: var(--font-reading);
    margin-bottom: 15px;
    font-size: 1rem;
    line-height: 1.8;
}

.highlight {
    background: linear-gradient(to bottom, transparent 60%, rgba(255, 255, 0, 0.3) 60%);
    color: inherit;
    font-weight: 600;
    padding: 0 2px;
}

/* Better highlight for light themes */
[data-theme="phosphor"] .highlight,
[data-theme="amber"] .highlight {
    background: linear-gradient(to bottom, transparent 60%, rgba(49, 130, 206, 0.2) 60%);
}

.subtle {
    color: var(--text-dim);
    font-style: italic;
}

.credentials ul {
    list-style: none;
    padding-left: 10px;
}

.credentials li {
    padding: 5px 0;
}

.credentials li::before {
    content: '';
}

/* ═══════════════════════════════════════════════════════════════
   CONTACT SECTION
   ═══════════════════════════════════════════════════════════════ */

.ascii-box {
    font-family: var(--font-retro);
    font-size: clamp(0.7rem, 2vw, 1rem);
    color: var(--text-secondary);
    margin-bottom: 20px;
    overflow-x: auto;
}

.contact-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    font-family: var(--font-retro);
    font-size: 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 12px 24px;
    border: 2px solid var(--text-primary);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn:hover {
    background: var(--text-primary);
    color: var(--bg-color);
    box-shadow: var(--glow);
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════════
   BLOG STYLES
   ═══════════════════════════════════════════════════════════════ */

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

.blog-item {
    padding: 20px 0;
    border-bottom: 1px dashed var(--text-dim);
}

.blog-item:last-child {
    border-bottom: none;
}

.blog-item a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    display: block;
    transition: all 0.3s ease;
}

.blog-item a:hover {
    color: var(--accent-secondary);
    text-shadow: var(--glow);
    padding-left: 10px;
}

.blog-date {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 5px;
}

.blog-content {
    font-family: var(--font-reading);
    color: var(--text-primary);
    line-height: 1.75;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.blog-content h2 {
    font-family: var(--font-reading);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.6rem;
    margin: 45px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    text-shadow: none;
}

.blog-content h3 {
    font-family: var(--font-reading);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.25rem;
    margin: 35px 0 15px;
}

.blog-content h4 {
    font-family: var(--font-reading);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 25px 0 10px;
}

.blog-content p {
    margin-bottom: 20px;
}

.blog-content ul,
.blog-content ol {
    margin: 15px 0 20px 25px;
}

.blog-content li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.blog-content code {
    background: rgba(0, 255, 65, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.blog-content pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 20px 0;
    border-left: 3px solid var(--text-primary);
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-retro);
    font-size: 1.2rem;
}

.back-link:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════
   THEME SWITCHER
   ═══════════════════════════════════════════════════════════════ */

.theme-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    gap: 8px;
    padding: 10px;
    background: var(--terminal-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--glow);
    transition: all 0.3s ease;
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.theme-btn:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px currentColor;
}

.theme-btn.active {
    border-color: #fff;
    box-shadow: 0 0 15px currentColor;
}

.theme-btn[data-theme="matrix"] { background: #00ff41; }
.theme-btn[data-theme="amber"] { background: linear-gradient(135deg, #f5e6d3, #8b4513); }
.theme-btn[data-theme="cyan"] { background: linear-gradient(135deg, #0a1628, #00d4ff); }
.theme-btn[data-theme="synthwave"] { background: linear-gradient(135deg, #ff00ff, #00ffff); }
.theme-btn[data-theme="phosphor"] { background: linear-gradient(135deg, #f8f9fa, #3182ce); }

.theme-label {
    font-family: var(--font-retro);
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-right: 8px;
    align-self: center;
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
}

.footer-ascii {
    font-family: var(--font-retro);
    font-size: clamp(0.6rem, 1.5vw, 0.9rem);
    color: var(--text-dim);
}

.blink {
    animation: blink 1s infinite;
}

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

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════ */

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

    .ascii-logo {
        font-size: 7px;
    }

    nav {
        gap: 10px;
    }

    nav a {
        font-size: 1.2rem;
        padding: 6px 12px;
    }

    .terminal-content {
        padding: 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .contact-links {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

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

    header::before {
        content: '[ MIKKO NIEMELÄ ]';
        font-family: var(--font-retro);
        font-size: 1.5rem;
        color: var(--text-primary);
        text-shadow: var(--glow);
        display: block;
        margin-bottom: 20px;
    }

    .terminal-header {
        padding: 8px 10px;
    }

    .terminal-title {
        font-size: 0.75rem;
    }

    .bio p,
    .interests p {
        font-size: 0.9rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PERFORMANCE OPTIMIZATIONS
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .glitch::before,
    .glitch::after {
        animation: none;
    }

    .glitch {
        animation: none;
    }

    .blink {
        animation: none;
    }

    * {
        transition-duration: 0.01ms !important;
    }
}

/* Smooth scrolling only when appropriate */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ═══════════════════════════════════════════════════════════════
   AUTHOR PHOTO SECTION
   ═══════════════════════════════════════════════════════════════ */

.author-photo-section {
    margin: 1.5rem 0;
    text-align: center;
}

.author-photo {
    max-width: 200px;
    height: auto;
    border: 2px solid var(--border-color);
    box-shadow: var(--glow), 0 0 20px rgba(0, 0, 0, 0.5);
    filter: saturate(0.9);
    transition: all 0.3s ease;
}

.author-photo:hover {
    box-shadow: var(--glow), 0 0 30px var(--text-primary);
    transform: scale(1.02);
}

.photo-caption {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}

/* Retro CRT effect on photo for dark themes */
[data-theme="matrix"] .author-photo,
[data-theme="cyan"] .author-photo,
[data-theme="synthwave"] .author-photo {
    filter: saturate(0.85) contrast(1.05);
}

/* Clean photo for light themes */
[data-theme="amber"] .author-photo,
[data-theme="phosphor"] .author-photo {
    filter: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .author-photo {
        max-width: 150px;
    }
}

/* Print styles */
@media print {
    .scanlines,
    .terminal-header {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .terminal-window {
        border: 1px solid #ccc;
        box-shadow: none;
    }

    a {
        color: black;
    }
}
