/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variables */
:root {
    --primary-color: #1a1a1a;
    --background-color: #ffffff;
    --text-color: #333333;
    --spacing: 2rem;
}

/* Base Styles */
html, body {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding: 0;
    cursor: url('cursors/circle-outline.svg') 16 16, auto;
    min-height: 100vh;
    min-width: 100vw;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
}

/* Ensure all elements use the custom cursor */
* {
    cursor: url('cursors/circle-outline.svg') 16 16, auto;
}

/* Specific interactive elements */
.nav-circle, 
.poem-circle,
.poem-text:hover,
a,
button,
input[type="submit"],
input[type="button"],
.gallery-item,
.gallery-item img,
.clickable-text,
.keyword,
.overlay-close,
.session-tracker-toggle,
a:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    cursor: url('cursors/circle-filled.svg') 16 16, pointer !important;
}

/* Header */
.site-header {
    text-align: center;
    margin-bottom: 2rem;
    margin-top: 70px;
}

.site-header h1 {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 3px;
}

.site-header h1 a {
    color: inherit;
    text-decoration: none;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 100vw;
    padding: 1.5rem;
    margin: 0;
    box-sizing: border-box;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    transition: transform 0.3s ease;
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: url('cursors/circle-filled.svg') 16 16, pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item.large {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item.wide {
    grid-column: span 2;
    grid-row: span 1;
}

.gallery-item.tall {
    grid-column: span 1;
    grid-row: span 2;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

/* Image Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: none;
    z-index: 1000;
    cursor: url('cursors/circle-filled.svg') 16 16, pointer;
}

.overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.overlay-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
}

.overlay-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    cursor: url('cursors/circle-outline.svg') 16 16, auto;
}

/* Overlay poem */
.overlay-poem {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-family: "Courier New", monospace;
    font-size: 1.1em;
    line-height: 1.8;
    width: 400px;
    max-width: min(400px, calc(100% - 40px));
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-height: calc(100% - 40px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.overlay-poem .text-container {
    display: inline;
    white-space: pre-wrap;
    font-family: inherit;
}

.overlay-poem .typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: white;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

.overlay-poem .poem-date {
    font-size: 0.9em;
    color: inherit;
    margin-bottom: 15px;
    transition: opacity 0.5s ease;
    text-align: left;
    font-family: inherit;
}

.overlay-poem .poem-line {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    text-align: left;
    font-family: inherit;
}

.overlay-poem.reveal .poem-date,
.overlay-poem.reveal .poem-line {
    opacity: 1;
    transform: translateY(0);
}

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

/* Navigation Circle */
.nav-circle {
    position: fixed;
    top: 2rem;
    left: 2rem;
    width: 12px;
    height: 12px;
    background-color: black;
    border-radius: 50%;
    display: block;
    transition: transform 0.2s ease;
}

.nav-circle:hover {
    transform: scale(1.2);
}

/* Text Content */
.text-content {
    max-width: 600px;
    margin: 4rem auto;
    padding: 0 2rem;
    font-weight: 300;
    line-height: 1.6;
}

.text-content p {
    margin-bottom: 2rem;
}

.poem-header {
    margin-top: 3rem;
}

/* Poem Section */
.poem-section {
    display: flex;
    flex-direction: column;
    /*align-items: center;*/
    margin-top: 2rem;
}

.poem-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: white;
    border: 1px solid black;
    padding: 0;
    margin: 2rem 0;
    animation: breathe 4s ease-in-out infinite;
    transition: transform 0.2s ease;
}

.poem-circle:hover {
    animation-play-state: paused;
    transform: scale(1.2);
}

@keyframes breathe {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.poem-date {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
    width: 100%;
}

.poem-text {
    font-size: 0.9em;
    line-height: 1.5;
    transition: all 0.3s ease;
    white-space: pre-line;
    text-align: left;
    margin: 20px 0;
}

.poem-text:hover {
    color: #666;
}

.poem-text.showing-full {
    color: #666;
}

/* Poem Snippets */
.poem-snippet {
    position: absolute;
    font-family: "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    color: rgba(0, 0, 0, 0.8);
    padding: 0.5rem 1rem;
    cursor: url('cursors/circle-filled.svg') 16 16, pointer;
    pointer-events: auto;
    transition: all 1.6s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    z-index: 1000;
    white-space: pre-line;
    animation: 
        fadeInElegant 4s cubic-bezier(0.4, 0, 0.2, 1) forwards,
        pulse 6s ease-in-out infinite;
    transform-origin: center;
    text-align: left;
    will-change: transform, opacity;
}

.poem-snippet.hovering {
    color: rgba(0, 0, 0, 1);
    transform: scale(1.2);
    animation-play-state: paused;
    cursor: url('cursors/circle-filled.svg') 16 16, pointer !important;
}

.poem-snippet:hover {
    animation-play-state: paused;
    transform: scale(1.2);
    cursor: url('cursors/circle-filled.svg') 16 16, pointer !important;
}

.poem-snippet.fading {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transition: all 3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

@keyframes fadeInElegant {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Breathing Circle */
.circle {
    width: 20px;
    height: 20px;
    background: black;
    border-radius: 50%;
    border: 1px solid black;
    padding: 0;
    margin: 2rem 0;
    animation: breatheSmall 8s ease-in-out infinite;
    transition: transform 0.2s ease;
}

.circle:hover {
    transform: scale(1.2);
}

@keyframes breatheSmall {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
}

/* Save Indicator */
.save-indicator {
    position: fixed;
    font-family: "Courier New", monospace;
    font-size: 1rem;
    font-weight: bold;
    color: #000;
    background: #f0f0f0;
    padding: 0.5rem 1rem;
    border: 2px solid #000;
    box-shadow: 2px 2px 0 #000;
    pointer-events: none;
    white-space: nowrap;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999; /* Extremely high z-index to ensure it's always on top */
}

.save-indicator.saving {
    animation: saveFlash 2s ease-out forwards;
}

@keyframes saveFlash {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(20px);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-20px);
    }
}

/* Question Overlay */
.question-overlay {
    position: fixed;
    background-color: #f0f0f0;
    padding: 1.5rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    width: 300px;
    border: 2px solid #000;
    box-shadow: 4px 4px 0 #000;
    font-family: "Courier New", monospace;
    cursor: url('cursors/circle-filled.svg') 16 16, pointer;
    user-select: none;
}

.question-overlay.dragging {
    opacity: 0.9;
    box-shadow: 6px 6px 0 #000;
    transform: scale(1.02);
    cursor: grabbing;
}

.question-overlay.active {
    opacity: 1;
    visibility: visible;
}

.question-overlay.saving {
    transform: scale(0.95) translateY(-10px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.question-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #f0f0f0;
}

.question-text {
    font-size: 1rem;
    line-height: 1.4;
    color: #000;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.question-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #000;
    font-size: 1rem;
    background: #fff;
    font-family: "Courier New", monospace;
    transition: border-color 0.3s ease;
    cursor: text;
}

.question-input:focus {
    outline: none;
    border-width: 2px;
    box-shadow: 2px 2px 0 #000;
}

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

.receipt-modal-content {
    background: #fff;
    padding: 2rem;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    border: 2px solid #000;
    font-family: monospace;
}

.receipt {
    text-align: center;
    white-space: pre-wrap;
}

.receipt-header {
    border-bottom: 2px dashed #000;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.receipt-section {
    margin: 1rem 0;
    text-align: left;
}

.receipt-footer {
    border-top: 2px dashed #000;
    margin-top: 1rem;
    padding-top: 1rem;
}

.receipt-close {
    display: block;
    margin: 1rem auto 0;
    padding: 0.5rem 1rem;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: monospace;
}

.receipt-close:hover {
    background: #333;
}

.receipt-loading {
    text-align: center;
    padding: 2rem;
    font-family: monospace;
}

.receipt-error {
    text-align: center;
    padding: 2rem;
    color: #ff0000;
    font-family: monospace;
}

.generated-poem {
    font-family: monospace;
    white-space: pre-wrap;
    text-align: center;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #000;
    background: #f9f9f9;
}

/* Clickable Text Styles */
.clickable-text {
    cursor: pointer;
    transition: color 0.3s ease;
}

.clickable-text:hover {
    color: #666;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    .gallery-item.large {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* Session Tracker */
.session-tracker {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Courier New', monospace;
}

.session-tracker-toggle {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    background: #2d2d2d;
    border: 1px solid #444;
    color: #00ff00;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    padding: 0;
}

.retro-computer {
    width: 40px;
    height: 40px;
    position: relative;
}

.screen {
    width: 30px;
    height: 24px;
    background: #000;
    border: 2px solid #666;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.computer-base {
    width: 36px;
    height: 6px;
    background: #666;
    margin: 2px auto 0;
    border-radius: 1px;
}

.scanline {
    position: absolute;
    width: 100%;
    height: 2px;
    background: rgba(0, 255, 0, 0.3);
    animation: scan 2s linear infinite;
}

.terminal-text {
    color: #0f0;
    font-size: 16px;
    line-height: 20px;
    padding: 2px;
    animation: blink 1s step-end infinite;
}

@keyframes scan {
    0% {
        top: -20%;
    }
    100% {
        top: 100%;
    }
}

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

.session-tracker-toggle:hover {
    transform: scale(1.1);
    background: #333;
}

.session-tracker-toggle:hover .screen {
    border-color: #888;
}

.session-tracker-toggle:hover .computer-base {
    background: #888;
}

.session-tracker-content {
    position: absolute;
    top: 60px;
    right: 0;
    width: 400px;
    max-height: 80vh;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 15px;
    overflow-y: auto;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    color: #00ff00;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.session-tracker-content.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.session-tracker-section {
    margin-bottom: 15px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.session-tracker-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.session-tracker-section h3 {
    font-size: 12px;
    margin-bottom: 8px;
    color: #fff;
    font-weight: normal;
    display: flex;
    align-items: center;
}

.session-tracker-section h3::before {
    content: '>';
    margin-right: 8px;
    color: #00ff00;
}

.session-tracker-section pre {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    margin: 0;
    color: #00ff00;
    padding-left: 16px;
}

.session-tracker-section .timestamp {
    color: #888;
}

.session-tracker-empty {
    color: #666;
    font-style: italic;
}

.session-tracker-new {
    animation: highlight 1s ease-out;
}

@keyframes highlight {
    0% {
        background-color: rgba(0, 255, 0, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

.receipt {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    z-index: 9999;
    animation: fadeInOut 3s ease-in-out;
}

.receipt-content {
    font-family: monospace;
    font-size: 14px;
}

.receipt h2 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.receipt p {
    margin: 5px 0;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}
