@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

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

:root {
    --amber: #ffb000;
    --amber-dim: #cc8800;
    --amber-glow: #ffcc00;
    --bg: #0a0a00;
    --scanline: rgba(0, 0, 0, 0.5);
}

html {
    font-size: 16px;
}

body {
    background-color: var(--bg);
    color: var(--amber);
    font-family: 'VT323', monospace;
    font-size: 1rem;
    line-height: 1.4;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    text-shadow: 0 0 5px var(--amber-dim), 0 0 10px var(--amber-dim);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* CRT Scanline Effect */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.2) 50%,
        rgba(0,0,0,0.2)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1000;
    animation: scanline 8s linear infinite;
}

/* Screen flicker */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 176, 0, 0.02);
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    animation: flicker 0.15s infinite;
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

@keyframes flicker {
    0% { opacity: 0.02; }
    50% { opacity: 0.05; }
    100% { opacity: 0.02; }
}

.terminal {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
    position: relative;
    width: 100%;
}

/* ASCII Art Header */
.ascii-art {
    color: var(--amber);
    font-size: 0.7rem;
    line-height: 1.2;
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 1rem;
    text-align: center;
    text-shadow: 0 0 10px var(--amber-dim), 0 0 20px var(--amber);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--amber-dim) var(--bg);
}

/* Command prompt line */
.prompt {
    margin-bottom: 0.5rem;
    color: var(--amber);
    font-size: 1rem;
}

.prompt::before {
    content: "term% ";
    color: var(--amber-dim);
}

/* Navigation as ls command output - no box, looks like terminal output */
.nav-ls {
    margin: 0 0 1rem 0;
}

.nav-ls::before {
    content: "term% ls /usr/glenda/nav";
    display: block;
    color: var(--amber-dim);
    margin-bottom: 0.3rem;
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: 0;
}

.nav-item {
    color: var(--amber);
    position: relative;
}

.nav-item a {
    border-bottom: none;
    padding: 0.2rem 0.4rem;
    transition: all 0.2s;
    display: inline-block;
    touch-action: manipulation;
    min-height: 22px;
    line-height: 22px;
    padding-top: 0;
    padding-bottom: 0;
}

.nav-item a:hover {
    background: var(--amber);
    color: var(--bg);
    text-shadow: none;
    box-shadow: 0 0 10px var(--amber), 0 0 20px var(--amber);
}

/* Man page header */
.man-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--amber-dim);
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.man-title {
    font-weight: bold;
}

/* Section headers */
.section-title {
    color: var(--amber);
    font-weight: bold;
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 1rem;
}

/* Content sections */
.section {
    margin-bottom: 1rem;
    padding-left: 1rem;
}

.section p {
    margin-bottom: 0.6rem;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Lists */
.section ul {
    list-style: none;
    padding-left: 1rem;
    margin-bottom: 0.5rem;
}

.section ul li {
    margin-bottom: 0.3rem;
    word-wrap: break-word;
}

.section ul li::before {
    content: "-> ";
    color: var(--amber-dim);
}

/* Links styled as terminal commands */
a {
    color: var(--amber);
    text-decoration: none;
    border-bottom: 1px dotted var(--amber-dim);
    transition: all 0.3s;
    word-wrap: break-word;
}

a:hover {
    color: var(--amber-glow);
    text-shadow: 0 0 15px var(--amber), 0 0 25px var(--amber);
    border-bottom: 1px solid var(--amber);
}

/* Contact section specific */
.contact-line {
    margin: 0.3rem 0;
    word-wrap: break-word;
}

.contact-label {
    display: inline-block;
    width: 6rem;
    color: var(--amber-dim);
}

/* Footer - left aligned like other prompts */
.footer {
    color: var(--amber-dim);
    text-align: left;
}

.footer::before {
    content: "term% ";
    color: var(--amber-dim);
}

/* Cursor blink */
.cursor {
    display: inline-block;
    width: 8px;
    height: 0.9em;
    background: var(--amber);
    animation: blink 1s infinite;
    vertical-align: middle;
    margin-left: 2px;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--amber-dim);
    border: 1px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--amber);
}

/* Selection color */
::selection {
    background: var(--amber);
    color: var(--bg);
}

/* Image styling for gallery */
.gallery-img {
    max-width: 100%;
    height: auto;
    border: 2px solid var(--amber-dim);
    margin: 0.5rem 0;
    filter: sepia(100%) hue-rotate(-10deg) saturate(200%);
    opacity: 0.9;
    display: block;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

th, td {
    border: 1px solid var(--amber-dim);
    padding: 0.5rem;
    text-align: left;
    word-wrap: break-word;
}

th {
    background: rgba(255, 176, 0, 0.1);
    font-weight: bold;
}

/* Project boxes */
.project-box {
    border: 1px solid var(--amber-dim);
    padding: 1rem;
    margin: 1rem 0;
    background: rgba(255, 176, 0, 0.03);
}

.project-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--amber-glow);
    font-size: 1.1rem;
}

/* Gallery items */
.gallery-item {
    border: 1px solid var(--amber-dim);
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(255, 176, 0, 0.03);
}

.gallery-item h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

.gallery-date {
    color: var(--amber-dim);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.gallery-date::before {
    content: "Date: ";
}

/* Footer line for contact page - also left aligned */
.footer-line {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--amber-dim);
    text-align: left;
    color: var(--amber-dim);
    font-size: 0.9rem;
}

/* VM Container - Terminal style with proper amber filter */
.vm-container {
    border: 2px solid var(--amber-dim);
    margin: 1rem 0;
    background: #000;
    overflow: hidden;
}

.vm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 176, 0, 0.1);
    border-bottom: 1px solid var(--amber-dim);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.vm-title {
    font-weight: bold;
    color: var(--amber-glow);
}

.vm-controls {
    display: flex;
    gap: 0.5rem;
}

.vm-btn {
    background: var(--bg);
    color: var(--amber);
    border: 1px solid var(--amber-dim);
    padding: 0.3rem 0.8rem;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    touch-action: manipulation;
}

.vm-btn:hover:not(:disabled) {
    background: var(--amber);
    color: var(--bg);
    box-shadow: 0 0 10px var(--amber);
}

.vm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* VM Screen - completely isolated from section styles */
.vm-screen {
    width: 100%;
    height: 400px;
    background: #000;
    position: relative;
    overflow: hidden;
    /* Proper amber color filter */
    filter: sepia(100%) hue-rotate(-10deg) saturate(500%) brightness(0.9);
    /* Reset text alignment but keep font */
    text-align: left;
    font-family: monospace;
    line-height: normal;
    font-size: 14px;
}

/* Force left alignment for ALL elements inside VM - override everything */
.vm-screen,
.vm-screen *,
.vm-screen *::before,
.vm-screen *::after {
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    /* Preserve monospace font for VM content */
    font-family: monospace !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
}

/* v86 canvas and text elements specifically */
.vm-screen canvas,
.vm-screen div,
.vm-screen pre,
.vm-screen span {
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    font-family: monospace !important;
}

.vm-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--amber);
    padding: 1rem;
    filter: none;
    /* Reset the forced left align for placeholder */
    text-align: center !important;
    /* Use site font for placeholder */
    font-family: 'VT323', monospace !important;
}

.vm-placeholder * {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    /* Use site font for placeholder */
    font-family: 'VT323', monospace !important;
}

.vm-hint {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    color: var(--amber-dim);
}

.vm-status-bar {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--amber-dim);
    background: rgba(255, 176, 0, 0.05);
    font-size: 0.9rem;
    color: var(--amber-dim);
    text-align: left;
}

/* v86 canvas styling */
.vm-screen canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* VM error message */
.vm-error {
    border: 1px solid var(--amber-dim);
    padding: 1rem;
    margin: 1rem 0;
    background: rgba(255, 0, 0, 0.1);
    color: var(--amber);
}

.vm-error p {
    margin: 0;
}

/* Mobile VM adjustments */
@media (max-width: 600px) {
    .vm-screen {
        height: 300px;
    }
    
    .vm-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .vm-controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    .vm-btn {
        flex: 1;
    }
}

@media (max-width: 400px) {
    .vm-screen {
        height: 250px;
    }
}

/* Tablet VM adjustments */
@media (min-width: 601px) and (max-width: 900px) {
    .vm-screen {
        height: 350px;
    }
}

/* Large desktop VM */
@media (min-width: 1200px) {
    .vm-screen {
        height: 500px;
    }
}

/* Mobile optimizations */
@media (max-width: 600px) {
    html {
        font-size: 14px;
    }
    
    .terminal {
        padding: 0.8rem;
    }
    
    .ascii-art {
        font-size: 0.5rem;
        line-height: 1.1;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0.2rem;
    }
    
    .nav-item a {
        min-height: 44px;
        line-height: 44px;
        display: block;
        width: 100%;
    }
    
    .man-header {
        flex-direction: column;
        gap: 0.3rem;
        font-size: 0.85rem;
    }
    
    .section {
        padding-left: 0.5rem;
    }
    
    .contact-label {
        display: block;
        width: 100%;
        margin-bottom: 0.2rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 0.4rem;
    }
}

/* Tablet optimizations */
@media (min-width: 601px) and (max-width: 900px) {
    .ascii-art {
        font-size: 0.6rem;
    }
    
    .terminal {
        padding: 1.5rem;
    }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
    html {
        font-size: 18px;
    }
    
    .ascii-art {
        font-size: 0.8rem;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .nav-item a:hover {
        background: transparent;
        color: var(--amber);
        box-shadow: none;
    }
    
    .nav-item a:active {
        background: var(--amber);
        color: var(--bg);
    }
    
    a:hover {
        color: var(--amber);
        text-shadow: none;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after,
    .cursor {
        animation: none;
    }
}

/* Dark mode support (already dark, but ensures consistency) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0a00;
    }
}
