/* ==================== WINDOWS 95 AUTHENTIC DESIGN ==================== */

/* Fonts */
@font-face {
    font-family: 'W95FA';
    src: url('/static/fonts/w95fa.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: block;
    unicode-range: U+0020-007F, U+00A0-00FF;
}

@font-face {
    font-family: 'W95FA';
    src: url('/static/fonts/MorePerfectDOSVGA-Cyrillic.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
    unicode-range: U+0400-04FF, U+0500-052F;
}

@font-face {
    font-family: 'IBM VGA Cyrillic';
    src: url('/static/fonts/WebPlus_IBM_VGA_8x16.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'Fixedsys';
    src: url('/static/fonts/Fixedsys.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'MS Sans Serif 8pt';
    src: url('/static/fonts/MSSansSerif.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

/* ==================== CSS VARIABLES ==================== */
:root {
    --win-gray: #c0c0c0;
    --win-border-light: #ffffff;
    --win-border-dark: #808080;
    --win-border-darkest: #000000;
    --win-title-active: #000080;
    --win-desktop: #008080;

    --text-primary: #000000;
    --text-white: #ffffff;
    --text-gray: #808080;

    --btn-face: #c0c0c0;
    --btn-shadow: #808080;
    --btn-dark-shadow: #000000;
    --btn-highlight: #ffffff;
    --btn-light: #dfdfdf;

    --font-ui: 'W95FA', 'IBM VGA Cyrillic', 'MS Sans Serif 8pt', monospace;
    --font-mono: 'Fixedsys', 'IBM VGA Cyrillic', 'Courier New', monospace;

    /* Taskbar height - used by multiple components */
    --taskbar-h: 48px;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: never;
    text-rendering: optimizeSpeed;
}

body {
    font-family: var(--font-ui);
    font-size: 11px;
    background-color: var(--win-desktop);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,.02) 2px,
        rgba(0,0,0,.02) 4px
    );
    color: var(--text-primary);
    line-height: 1.2;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* ==================== DESKTOP ICONS ==================== */
.desktop-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, 80px);
    gap: 20px;
    padding: 20px;
    padding-bottom: calc(var(--taskbar-h) + 12px);
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    cursor: pointer;
    text-align: center;
    padding: 8px;
    border: 2px solid transparent;
    -webkit-user-select: none;
    user-select: none;
}

.desktop-icon:hover {
    background: rgba(0, 0, 128, 0.1);
    border: 2px dotted var(--text-white);
}

.desktop-icon.selected {
    background: rgba(0, 0, 128, 0.3);
    border: 2px dotted var(--text-white);
}

.desktop-icon-image {
    font-size: 32px;
    margin-bottom: 4px;
    filter: drop-shadow(1px 1px 0px rgba(0,0,0,0.4));
}

.desktop-icon-label {
    color: var(--text-white);
    font-size: 11px;
    text-shadow:
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000;
    word-wrap: break-word;
}

/* ==================== WINDOW ==================== */
.win95-window {
    position: fixed;
    background: var(--win-gray);
    border: 2px solid;
    border-color: var(--btn-light) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-light);
    box-shadow:
        inset 1px 1px 0 var(--btn-highlight),
        inset -1px -1px 0 var(--btn-shadow),
        2px 2px 10px rgba(0,0,0,0.4);
    z-index: 100;
    display: none;
    min-width: 280px;
}

.win95-window.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.1s ease-out;
}

.win95-window.minimized {
    display: none !important;
}

.win95-window.maximized {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: calc(100dvh - var(--taskbar-h)) !important;
    max-width: 100vw !important;
    max-height: calc(100dvh - var(--taskbar-h)) !important;
    transform: none !important;
    margin: 0 !important;
}

.win95-window.maximized .win95-content {
    max-height: 100% !important;
    flex: 1 !important;
}

/* ==================== TITLE BAR ==================== */
.win95-title-bar {
    background: linear-gradient(to right, #000080, #1084d0);
    color: white;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    -webkit-user-select: none;
    user-select: none;
    flex-shrink: 0;
}

.win95-title {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
    font-size: 11px;
    padding: 2px 4px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.win95-title-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.win95-title-buttons {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.win95-title-button {
    width: 18px;
    height: 16px;
    background: var(--win-gray);
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #000000;
    font-family: "MS Sans Serif", sans-serif;
}

.win95-title-button:hover { background: #dfdfdf; }
.win95-title-button:active {
    border-color: #808080 #ffffff #ffffff #808080;
    background: #a0a0a0;
}
.win95-title-button.minimize { font-size: 16px; padding-bottom: 4px; }
.win95-title-button.maximize { font-size: 13px; }
.win95-title-button.close { font-size: 16px; }

/* ==================== WINDOW CONTENT ==================== */
.win95-content {
    flex: 1;
    overflow: auto;
    background: white;
    border: 2px solid;
    border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
    margin: 2px;
    display: flex;
    flex-direction: column;
    font-size: 11px;
    max-height: 500px;
}

.win95-inner-content {
    padding: 16px;
    flex: 1;
    line-height: 1.5;
    -webkit-user-select: text;
    user-select: text;
}

.win95-inner-content p { margin-bottom: 12px; line-height: 1.5; }
.win95-inner-content h1, .win95-inner-content h2, .win95-inner-content h3 {
    font-weight: bold;
    margin-bottom: 8px;
}
.win95-inner-content h1 { font-size: 14px; }
.win95-inner-content h2 { font-size: 12px; }
.win95-inner-content h3 { font-size: 11px; }
.win95-inner-content code, .win95-inner-content pre {
    font-family: var(--font-mono);
    font-size: 11px;
}

/* ==================== TASKBAR ==================== */
.win95-taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--taskbar-h);
    background: var(--win-gray);
    border-top: 2px solid var(--btn-highlight);
    display: flex;
    align-items: center;
    padding: 2px;
    padding-left: max(2px, env(safe-area-inset-left, 2px));
    padding-right: max(2px, env(safe-area-inset-right, 2px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    gap: 4px;
    z-index: 10000;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.win95-start-button {
    height: 40px;
    padding: 0 8px;
    background: var(--btn-face);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-ui);
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    flex-shrink: 0;
}

.win95-start-button:hover { background: var(--btn-light); }
.win95-start-button.active,
.win95-start-button:active {
    border-color: var(--btn-dark-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-dark-shadow);
}

.win95-start-logo {
    width: 24px;
    height: 24px;
    font-size: 20px;
}

.win95-task-buttons {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    height: 40px;
    align-items: center;
    scrollbar-width: none;
}
.win95-task-buttons::-webkit-scrollbar { display: none; }

.win95-task-button {
    min-width: 120px;
    max-width: 200px;
    height: 36px;
    background: var(--btn-face);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    font-family: var(--font-ui);
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.win95-task-button:hover { background: var(--btn-light); }
.win95-task-button.active {
    border-color: var(--btn-dark-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-dark-shadow);
    background: var(--btn-shadow);
}
.win95-task-icon { font-size: 14px; flex-shrink: 0; }

.win95-tray {
    height: 40px;
    border: 1px solid;
    border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
    padding: 0 8px;
    display: flex;
    align-items: center;
    font-size: 11px;
}
.win95-clock { min-width: 60px; text-align: center; }

/* ==================== START MENU ==================== */
.win95-start-menu {
    position: fixed;
    bottom: var(--taskbar-h);
    left: 2px;
    width: 250px;
    max-height: 400px;
    background: var(--win-gray);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
    box-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    display: none;
    z-index: 9999;
}

.win95-start-menu.active {
    display: flex;
}

.win95-start-sidebar {
    background: linear-gradient(to top, #000080, #1084d0);
    color: white;
    padding: 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-weight: bold;
    font-size: 20px;
    letter-spacing: 2px;
    flex-shrink: 0;
}

.win95-start-items {
    padding: 4px 0;
    flex: 1;
    overflow-y: auto;
}

.win95-start-item {
    padding: 8px 32px 8px 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    font-size: 11px;
}

.win95-start-item:hover {
    background: var(--win-title-active);
    color: white;
}

.win95-start-item-icon {
    position: absolute;
    left: 12px;
    font-size: 18px;
}

.win95-start-separator {
    height: 1px;
    background: var(--btn-shadow);
    margin: 4px 8px;
    border-bottom: 1px solid var(--btn-highlight);
}

/* ==================== BUTTONS ==================== */
.btn,
button,
input[type="submit"],
input[type="button"] {
    min-width: 75px;
    padding: 4px 12px;
    background: var(--btn-face);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
    font-family: var(--font-ui);
    font-size: 11px;
    cursor: pointer;
    outline: none;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
}

.btn:hover, button:hover { background: var(--btn-light); }
.btn:active, button:active {
    border-color: var(--btn-dark-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-dark-shadow);
}
.btn:focus { outline: 1px dotted #000; outline-offset: -4px; }
.btn-primary { font-weight: bold; }

/* ==================== FORMS ==================== */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    padding: 4px;
    border: 2px solid;
    border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
    background: white;
    font-family: var(--font-ui);
    font-size: 11px;
    -webkit-user-select: text;
    user-select: text;
}

textarea { resize: none; overflow-y: auto; }

input:focus, textarea:focus {
    outline: none;
    border-color: var(--btn-dark-shadow) var(--btn-light) var(--btn-light) var(--btn-dark-shadow);
}

.form-control { width: 100%; margin-bottom: 8px; }
label { display: block; margin-bottom: 4px; font-size: 11px; }

/* ==================== PROFILE & CONTENT ==================== */
.profile-section {
    background: white;
    border: 2px solid;
    border-color: var(--btn-shadow) var(--btn-highlight) var(--btn-highlight) var(--btn-shadow);
    padding: 16px;
    margin-bottom: 16px;
}

.profile-img {
    border: 2px solid var(--btn-shadow);
    max-width: 150px;
}

.skill-badge {
    background: var(--btn-face);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
    padding: 8px;
    text-align: center;
    font-size: 11px;
    margin-bottom: 8px;
}

/* ==================== TABLE ==================== */
table { width: 100%; border-collapse: collapse; background: white; }
th, td {
    padding: 6px;
    text-align: left;
    border: 1px solid var(--btn-shadow);
    font-size: 11px;
    -webkit-user-select: text;
    user-select: text;
}
th { background: var(--win-gray); font-weight: bold; }
tr:nth-child(even) { background: #f0f0f0; }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: var(--win-gray); }
::-webkit-scrollbar-thumb {
    background: var(--btn-face);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
}
::-webkit-scrollbar-button {
    background: var(--btn-face);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
    height: 16px;
    width: 16px;
}
::-webkit-scrollbar-button:vertical:decrement {
    background: var(--btn-face) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><polygon points="4,2 1,6 7,6" fill="black"/></svg>') center no-repeat;
}
::-webkit-scrollbar-button:vertical:increment {
    background: var(--btn-face) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><polygon points="4,6 1,2 7,2" fill="black"/></svg>') center no-repeat;
}

/* ==================== PROJECTS ==================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.project-card {
    background: var(--win-gray);
    border: 2px solid;
    border-color: var(--btn-highlight) var(--btn-dark-shadow) var(--btn-dark-shadow) var(--btn-highlight);
    padding: 12px;
}

.project-title { font-weight: bold; margin-bottom: 8px; font-size: 12px; }
.project-description { font-size: 11px; margin-bottom: 12px; min-height: 60px; }

/* ==================== SLOT MACHINE ==================== */
.slot-reel {
    font-size: 56px;
    background: #fff;
    padding: 15px;
    border: 2px inset;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    line-height: 1;
    -webkit-user-select: none;
    user-select: none;
}

/* ==================== RESPONSIVE (mobile-first unified) ==================== */
@media (max-width: 768px) {
    :root { --taskbar-h: 40px; }

    body {
        position: fixed;
        width: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    /* ALL windows become full-screen on mobile — one rule, zero per-window hacks */
    .win95-window.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        height: calc(100dvh - var(--taskbar-h)) !important;
        max-height: calc(100dvh - var(--taskbar-h)) !important;
        transform: none !important;
        margin: 0 !important;
    }

    .win95-window.active .win95-content {
        max-height: 100% !important;
        flex: 1 !important;
    }

    /* Maximized is same as active on mobile */
    .win95-window.maximized {
        height: calc(100dvh - var(--taskbar-h)) !important;
    }

    .desktop-icons {
        grid-template-columns: repeat(auto-fill, 70px);
        gap: 4px;
        padding: 10px;
        padding-bottom: calc(var(--taskbar-h) + 8px);
        height: calc(100dvh - var(--taskbar-h));
        overflow-y: auto;
        overflow-x: hidden;
        align-content: start;
    }

    .desktop-icon { width: 70px; height: 60px; padding: 2px; }
    .desktop-icon-image { font-size: 24px; margin-bottom: 1px; }
    .desktop-icon-label { font-size: 9px; line-height: 1.1; }

    .win95-inner-content { padding: 8px !important; }
    .profile-section { padding: 8px !important; margin-bottom: 8px !important; }
    .profile-img { max-width: 80px !important; }

    .win95-start-button span { display: none; }
    .win95-task-button { min-width: 80px; max-width: 120px; height: 32px; font-size: 9px; padding: 0 4px; }
    .win95-task-buttons { height: 32px; }
    .win95-tray { height: 32px; font-size: 10px; padding: 0 4px; }
    .win95-start-menu { width: 200px; max-height: 70vh; bottom: var(--taskbar-h); }
    .win95-start-sidebar { font-size: 16px; padding: 6px; }
    .win95-start-item { padding: 6px 24px 6px 32px; font-size: 10px; }
    .win95-start-item-icon { left: 8px; font-size: 14px; }

    .slot-reel { font-size: 40px; width: 70px; height: 70px; padding: 10px; }

    table { font-size: 9px; }
    table td, table th { padding: 2px !important; }
}

/* Landscape phones wider than 768px (e.g. iPhone 13/14 in landscape) */
@media (orientation: landscape) and (max-height: 600px) {
    .win95-window.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        height: calc(100dvh - var(--taskbar-h)) !important;
        max-height: calc(100dvh - var(--taskbar-h)) !important;
        transform: none !important;
        margin: 0 !important;
    }
    .win95-window.active .win95-content {
        max-height: 100% !important;
        flex: 1 !important;
    }
    .win95-window.maximized {
        height: calc(100dvh - var(--taskbar-h)) !important;
    }
    .win95-inner-content { padding: 8px !important; }
    .profile-section { padding: 8px !important; margin-bottom: 8px !important; }
}

/* Tablets: portrait and landscape up to 1100px */
@media (min-width: 769px) and (max-width: 1100px) {
    .win95-window.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        height: calc(100dvh - var(--taskbar-h)) !important;
        max-height: calc(100dvh - var(--taskbar-h)) !important;
        transform: none !important;
        margin: 0 !important;
    }
    .win95-window.active .win95-content {
        max-height: 100% !important;
        flex: 1 !important;
    }
    .win95-window.maximized {
        height: calc(100dvh - var(--taskbar-h)) !important;
    }
    .win95-inner-content { padding: 12px !important; }
}

/* ==================== BOOT SCREEN ==================== */
#boot-screen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-family: var(--font-ui);
}

#boot-logo {
    color: #fff;
    font-size: 32px;
    letter-spacing: 4px;
}

#boot-tagline {
    color: #888;
    font-size: 11px;
    letter-spacing: 1px;
}

#boot-bar-wrap {
    width: 220px;
    height: 14px;
    border: 2px solid #fff;
    background: #000;
    overflow: hidden;
}

#boot-bar {
    height: 100%;
    width: 0;
    background: repeating-linear-gradient(
        to right,
        #fff 0px, #fff 18px,
        transparent 18px, transparent 22px
    );
    transition: width 0.12s linear;
}

/* ==================== WINDOW ANIMATIONS ==================== */
@keyframes minimizeOut {
    0%   { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 0; transform: scale(0.85) translateY(40px); }
}

@keyframes closeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.win95-window.animating-minimize {
    animation: minimizeOut 0.15s ease-in forwards !important;
    pointer-events: none;
    display: flex !important;
}

.win95-window.animating-close {
    animation: closeOut 0.15s ease-in forwards !important;
    pointer-events: none;
}

/* ==================== UTILITIES ==================== */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-bold { font-weight: bold; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* Hide legacy elements */
.navbar, .container { display: none !important; }
