/* ================================================================
   style.css — OMORI Whitespace · Pure pixel-art aesthetic
   No gradients · No blur · No rounded corners · Sharp pixels
   ================================================================ */

/* Font loaded via <link> in index.html */

/* ------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------ */
:root {
    --font-pixel: 'Press Start 2P', monospace;

    --white:  #ffffff;
    --black:  #0a0a0a;
    --grey-1: #e0e0e0;
    --grey-2: #aaaaaa;
    --grey-3: #666666;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ------------------------------------------------------------------
   Reset
   ------------------------------------------------------------------ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
    font-family: var(--font-pixel);
    background: var(--white);
    color: var(--black);
    image-rendering: pixelated;
    cursor: default;
    user-select: none;
}

/* ------------------------------------------------------------------
   Canvas
   ------------------------------------------------------------------ */
#game-canvas {
    position: fixed; inset: 0;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ------------------------------------------------------------------
   Loading screen
   ------------------------------------------------------------------ */
#loading-screen {
    position: fixed; inset: 0;
    background: var(--black);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    z-index: 200;
    transition: opacity 0.8s var(--ease-out);
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }

.loader-dots {
    display: flex; gap: 8px;
    margin-bottom: 16px;
}
.loader-dots span {
    width: 6px; height: 6px;
    background: rgba(255,255,255,0.5);
    animation: blink 1.2s infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

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

.loader-text {
    font-family: var(--font-pixel);
    font-size: 8px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
}

/* ------------------------------------------------------------------
   Intro — Welcome screen
   ------------------------------------------------------------------ */
#intro-overlay {
    position: fixed; inset: 0;
    background: var(--black);
    display: flex; align-items: center; justify-content: center;
    z-index: 190;
    opacity: 0; pointer-events: none;
    transition: opacity 1s var(--ease-out);
}
#intro-overlay.visible  { opacity: 1; pointer-events: all; }
#intro-overlay.fade-out { opacity: 0; pointer-events: none; transition: opacity 1.5s var(--ease-out); }
#intro-overlay.gone     { display: none; }

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

.intro-title {
    font-family: var(--font-pixel);
    font-size: 16px;
    color: #fff;
    letter-spacing: 4px;
    text-transform: uppercase;
    line-height: 2.2;
    margin-bottom: 32px;
    animation: floatTitle 3s ease-in-out infinite, fadeIn 1s var(--ease-out) 0.4s both;
}

.start-btn {
    font-family: var(--font-pixel);
    font-size: 10px;
    letter-spacing: 3px;
    color: #fff;
    background: none;
    border: 2px solid rgba(255,255,255,0.4);
    padding: 12px 32px;
    cursor: pointer;
    animation: floatBtn 2.5s ease-in-out infinite, fadeIn 1s var(--ease-out) 1s both;
    transition: border-color 0.15s, color 0.15s;
}
.start-btn:hover {
    border-color: #fff;
}

@keyframes floatTitle {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes floatBtn {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ------------------------------------------------------------------
   Controls hint
   ------------------------------------------------------------------ */
#controls-hint {
    position: fixed;
    bottom: 28px; left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 60;
    opacity: 0;
    transition: opacity 0.6s var(--ease-out);
    pointer-events: none;
}
#controls-hint.visible { opacity: 1; }

.hint-keys {
    display: flex; flex-direction: column;
    align-items: center; gap: 2px;
    margin-bottom: 8px;
}
.hint-row { display: flex; gap: 2px; }

.key {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    background: var(--black);
    border: 2px solid #333;
    font-family: var(--font-pixel);
    font-size: 7px;
    color: rgba(255,255,255,0.7);
}

.hint-text {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
    margin-top: 3px;
}

/* ------------------------------------------------------------------
   Popup overlay
   ------------------------------------------------------------------ */
#popup-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0);
    z-index: 100;
    pointer-events: none;
    transition: background 0.4s var(--ease-out);
}
#popup-overlay.visible {
    background: rgba(0,0,0,0.35);
    pointer-events: all;
}

/* ------------------------------------------------------------------
   Portfolio popup — pixel art menu style, no blur, sharp edges
   ------------------------------------------------------------------ */
#portfolio-popup {
    position: fixed;
    bottom: 0; left: 50%;
    transform: translateX(-50%) translateY(105%) scale(0.97);
    width: min(360px, 90vw);
    max-height: 75vh;
    background: var(--white);
    border: 3px solid var(--black);
    border-bottom: none;
    z-index: 110;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    transition: transform 0.4s var(--ease-out), opacity 0.3s var(--ease-out);
}
#portfolio-popup.visible {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
}

.popup-content { padding: 20px 18px 24px; }

.popup-close {
    position: absolute; top: 8px; right: 10px;
    width: 24px; height: 24px;
    background: none;
    border: 2px solid var(--black);
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--black);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.popup-close:hover {
    background: var(--black);
    color: var(--white);
}

.popup-header {
    margin-bottom: 16px;
    border-bottom: 2px solid var(--black);
    padding-bottom: 12px;
}

.popup-accent {
    width: 24px; height: 3px;
    margin-bottom: 10px;
}

.popup-title {
    font-family: var(--font-pixel);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 4px;
    color: var(--black);
}

.popup-subtitle {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--grey-2);
}

.popup-body {
    display: flex; flex-direction: column; gap: 14px;
}

/* Image */
.popup-image-container {
    width: 100%;
    overflow: hidden;
}
.popup-image {
    width: 100%; height: auto; display: block;
    image-rendering: pixelated;
}
.popup-image-placeholder {
    width: 100%; height: 140px;
    border: 2px dashed;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--grey-2);
    line-height: 2;
}
.popup-image-placeholder code {
    font-family: var(--font-pixel);
    font-size: 6px;
    background: var(--grey-1);
    padding: 2px 4px;
}

/* Video */
.popup-video-wrap {
    position: relative;
    width: 100%; padding-top: 56.25%;
    border: 2px solid var(--black);
    overflow: hidden;
}
.popup-video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
}

.popup-description {
    font-family: var(--font-pixel);
    font-size: 7px;
    line-height: 2.2;
    color: var(--grey-3);
}

/* Gallery grid */
.popup-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.popup-gallery-3col {
    grid-template-columns: 1fr 1fr 1fr;
}
.popup-gallery-item {
    text-align: center;
    border: 2px solid var(--grey-1);
    padding: 6px;
    background: #fafafa;
}
.popup-gallery-item img {
    display: block;
    margin: 0 auto 4px;
    image-rendering: pixelated;
    max-width: 100%;
}
.popup-gallery-label {
    font-family: var(--font-pixel);
    font-size: 5px;
    color: var(--grey-3);
    margin-top: 2px;
}

.popup-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.popup-tag {
    padding: 3px 8px;
    border: 2px solid;
    font-family: var(--font-pixel);
    font-size: 6px;
    letter-spacing: 0.3px;
}

.popup-link {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 16px;
    border: 2px solid var(--black);
    color: var(--white);
    text-decoration: none;
    font-family: var(--font-pixel);
    font-size: 7px;
    letter-spacing: 0.5px;
    transition: transform 0.15s;
}
.popup-link:hover {
    transform: translateY(-2px);
}

/* ------------------------------------------------------------------
   Volume
   ------------------------------------------------------------------ */
#volume-control {
    position: fixed; top: 12px; right: 12px;
    z-index: 80;
    display: flex;
    gap: 4px;
}

.ui-btn {
    width: 28px; height: 28px;
    background: var(--white);
    border: 2px solid var(--black);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--black);
    transition: background 0.15s;
}
.ui-btn:hover {
    background: var(--black);
    color: var(--white);
}
.ui-btn.muted svg { opacity: 0.2; }

/* ------------------------------------------------------------------
   Settings panel
   ------------------------------------------------------------------ */
#settings-panel {
    position: fixed;
    top: 46px; right: 12px;
    width: 180px;
    background: var(--black);
    border: 2px solid #333;
    z-index: 85;
    padding: 0;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
#settings-panel.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.settings-header {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 2px;
    padding: 8px 10px 6px;
    border-bottom: 1px solid #222;
}

.settings-group {
    padding: 8px 10px;
    border-bottom: 1px solid #1a1a1a;
}
.settings-group:last-child { border-bottom: none; }

.settings-label {
    font-family: var(--font-pixel);
    font-size: 6px;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* Speed buttons */
.settings-speed-btns {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.speed-btn {
    flex: 1;
    font-family: var(--font-pixel);
    font-size: 6px;
    color: rgba(255,255,255,0.5);
    background: none;
    border: 1px solid #333;
    padding: 4px 0;
    cursor: pointer;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.speed-btn:hover {
    border-color: #555;
    color: #fff;
}
.speed-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* Pixel slider */
.pixel-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #333;
    outline: none;
    margin-top: 6px;
    cursor: pointer;
}
.pixel-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: #fff;
    border: none;
    cursor: pointer;
}
.pixel-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: #fff;
    border: none;
    cursor: pointer;
}

/* Pixel checkbox */
.pixel-checkbox {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border: 1px solid #555;
    background: none;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.pixel-checkbox:checked {
    background: #fff;
}
.pixel-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 1px; left: 1px;
    width: 6px; height: 6px;
    background: #000;
}

/* FPS counter */
#fps-counter {
    position: fixed;
    top: 12px; left: 12px;
    font-family: var(--font-pixel);
    font-size: 7px;
    color: rgba(255,255,255,0.4);
    background: rgba(0,0,0,0.5);
    padding: 3px 6px;
    border: 1px solid #333;
    z-index: 80;
    pointer-events: none;
    display: none;
}
#fps-counter.visible { display: block; }

/* ------------------------------------------------------------------
   Scrollbar
   ------------------------------------------------------------------ */
#portfolio-popup::-webkit-scrollbar       { width: 4px; }
#portfolio-popup::-webkit-scrollbar-track { background: var(--grey-1); }
#portfolio-popup::-webkit-scrollbar-thumb { background: var(--black); }

/* ------------------------------------------------------------------
   Mobile
   ------------------------------------------------------------------ */
@media (max-width: 600px) {
    .popup-content  { padding: 16px 14px 20px; }
    .popup-title    { font-size: 10px; }
    #controls-hint  { bottom: 14px; }
}

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

/* ------------------------------------------------------------------
   Resume Button Widget (top-right)
   ------------------------------------------------------------------ */
#resume-btn {
    text-decoration: none;
}

/* ------------------------------------------------------------------
   Interactive Pixel Footer Overlay
   ------------------------------------------------------------------ */
.pixel-footer {
    position: absolute;
    transform: translate(-50%, 0);
    text-align: center;
    z-index: 10;
    pointer-events: auto;
    display: none;
    font-family: var(--font-pixel);
    width: 280px;
    box-sizing: border-box;
}
.footer-name {
    font-size: 10px;
    color: rgba(0,0,0,0.4);
    margin: 0 0 16px 0;
    letter-spacing: 0.5px;
}
.footer-link {
    display: block;
    font-size: 6px;
    color: rgba(0,0,0,0.3);
    text-decoration: none;
    margin-bottom: 12px;
    transition: color 0.15s;
}
.footer-link:hover {
    color: var(--black);
    text-decoration: underline;
}
.footer-link.resume-link {
    font-weight: bold;
    color: #7a44aa; /* Nice purple from resume style */
}
.footer-link.resume-link:hover {
    color: #5a2c8a;
}
.footer-love {
    font-size: 5px;
    color: rgba(0,0,0,0.15);
    margin-top: 32px;
}

/* ------------------------------------------------------------------
   Popup Additions (Problem, Reflection, Tech Stack)
   ------------------------------------------------------------------ */
.popup-problem {
    font-family: var(--font-pixel);
    font-size: 7px;
    line-height: 2.2;
    color: var(--grey-3);
    border-left: 2px solid var(--black);
    padding-left: 8px;
    margin: 4px 0;
}
.popup-reflection {
    font-family: var(--font-pixel);
    font-size: 7px;
    line-height: 2.2;
    color: var(--grey-3);
    background: var(--grey-1);
    padding: 8px;
    border-left: 2px solid var(--black);
    margin: 8px 0;
}
.popup-tech-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.section-label {
    font-family: var(--font-pixel);
    font-size: 6px;
    color: var(--grey-2);
    font-weight: bold;
}
.tech-tag {
    background: #f0ebf7;
    border-color: #7a44aa !important;
    color: #7a44aa !important;
}
