/**
 * Zorkland Terminal Aesthetic - Apple II CRT Style
 * /Library/WebServer/Documents/michaelphamilton/zork/css/style.css
 */

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

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

:root {
    --bg: #000000;
    --text: #33ff33;
    --text-dim: #22aa22;
    --text-faint: #117711;
    --border: #225522;
    --highlight: #44ff44;
    --glow: rgba(51, 255, 51, 0.15);
}

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 18px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    text-shadow: 0 0 5px var(--glow);
}

/* Header */
header {
    position: relative;
    padding: 20px 40px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    flex-shrink: 0;
}

.title {
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text);
}

.author {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.map-icon {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 36px;
    height: 36px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.map-icon:hover {
    color: var(--text);
    border-color: var(--text);
    filter: drop-shadow(0 0 4px var(--glow));
}

.status {
    opacity: 0.8;
}

/* Main container */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 40px;
    overflow: hidden;
}

/* Output area */
#output {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 10px;
}

/* Text entries */
.entry {
    margin-bottom: 24px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.entry.command {
    color: var(--text-dim);
}

.entry.response {
    color: var(--text);
}

.entry.error {
    color: #ff5555;
    text-shadow: 0 0 5px rgba(255, 85, 85, 0.3);
}

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

/* Location images */
.location-image-container {
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

.location-image {
    width: 100%;
    display: block;
    filter: sepia(20%) saturate(80%) brightness(0.9) contrast(1.1);
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.location-image.loaded {
    opacity: 1;
}

.location-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--bg));
    pointer-events: none;
}

/* Map Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: #050505;
    border: 1px solid var(--border);
    padding: 30px;
    max-width: 500px;
    width: 90%;
}

.modal-content .map-title {
    text-align: center;
    color: var(--text);
    font-size: 16px;
    letter-spacing: 0.3em;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.modal-content .map-hint {
    text-align: center;
    color: var(--text-faint);
    font-size: 14px;
    margin-top: 20px;
}

#map-svg svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Map styling */
.map-node {
    fill: #111;
    stroke: var(--text-faint);
    stroke-width: 1;
    transition: all 0.2s ease;
}

.map-node.current {
    fill: var(--text);
    stroke: var(--highlight);
    filter: drop-shadow(0 0 6px var(--glow));
}

.map-node.visited {
    fill: var(--border);
}

.map-node-group {
    cursor: pointer;
}

.map-node-group:hover .map-node {
    fill: var(--highlight);
    stroke: var(--highlight);
    filter: drop-shadow(0 0 8px var(--glow));
}

.map-node-group:hover .map-label {
    fill: var(--highlight);
}

.map-edge {
    stroke: var(--text-faint);
    stroke-width: 1;
    fill: none;
}

.map-label {
    fill: var(--text-faint);
    font-family: 'VT323', monospace;
    font-size: 12px;
    text-anchor: middle;
    transition: fill 0.2s ease;
}

.map-label.current {
    fill: var(--text);
}

/* Typing cursor */
.cursor {
    animation: blink 0.7s infinite;
}

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

/* Input area */
#input-line {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    flex-shrink: 0;
}

#prompt {
    color: var(--text);
    margin-right: 10px;
    user-select: none;
}

#input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    outline: none;
    caret-color: var(--text);
    text-shadow: 0 0 5px var(--glow);
}

#input::placeholder {
    color: var(--text-faint);
}

#input:disabled {
    opacity: 0.5;
}

/* Footer */
footer {
    padding: 20px 40px;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 14px;
    text-align: center;
    flex-shrink: 0;
}

/* Scrollbar */
#output::-webkit-scrollbar {
    width: 8px;
}

#output::-webkit-scrollbar-track {
    background: #0a0a0a;
}

#output::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

#output::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
}

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

/* Loading state */
.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* CRT scanline effect (subtle) */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 9999;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    header, footer {
        padding: 15px 20px;
    }
    
    main {
        padding: 20px;
    }
    
    body {
        font-size: 16px;
    }
}