/* ============================================
   CSS VARIABLES & RESET
   ============================================ */
:root {
    /* Colors */
    --primary-color: #007bff;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-color: #e0e0e0;
    --text-dark: #333333;
    --text-medium: #666666;
    --text-light: #555;
    --text-footer: #5a6c7d;
    --background-light: #ffffff;
    --background-gradient: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    --border-light: #e0e0e0;

    /* Shadows */
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 123, 255, 0.2);
    --shadow-hover: rgba(0, 0, 0, 0.12);
    --shadow-strong: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);

    /* Social Media Colors */
    --github-bg: #f6f8fa;
    --github-border: #e1e4e8;
    --github-icon: #24292e;
    --gamejolt-bg: #2f7f6f;
    --steam-bg: #171a21;
    --youtube-bg: #ff0000;
    --email-bg: #4285F4;
}

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

/* ============================================
   BASE STYLES
   ============================================ */
body {
    font-family: 'Rubik', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--background-light);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth transitions for theme changes */
*,
*::before,
*::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Allow text selection for content */
p,
h1,
h2,
h3,
li {
    user-select: text;
}

/* Disable selection for UI elements */
button,
.tab-button,
.read-more-button {
    user-select: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Improved focus indicators */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.tab-button:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: -3px;
}

/* ============================================
   HEADER
   ============================================ */
header {
    text-align: center;
    margin-top: 5rem;
    margin-bottom: 5rem;
    position: relative;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--background-gradient);
    border: 2px solid var(--border-light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px var(--shadow-light);
    z-index: 100;
}

.theme-toggle:hover {
    transform: translateY(-3px) rotate(15deg);
    box-shadow: 0 8px 20px var(--shadow-hover);
    border-color: var(--primary-color);
}

.theme-toggle:active {
    transform: translateY(-1px) rotate(0deg);
}

.theme-toggle i {
    font-size: 1.3rem;
    color: var(--text-dark);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover i {
    transform: scale(1.1);
}

/* Rotate icon on theme change */
.theme-toggle.rotating i {
    animation: rotateIcon 0.5s ease-in-out;
}

@keyframes rotateIcon {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(0.8);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.tagline {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-top: 1rem;
    font-weight: 500;
}

.description {
    font-size: 1.1rem;
    color: var(--text-medium);
    margin-bottom: 2rem;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
    flex: 1;
}

section {
    margin-bottom: 3rem;
    background: var(--background-gradient);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-strong);
    border: 1px solid var(--border-light);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

section:hover {
    transform: translateY(-2px);
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    position: relative;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid transparent;
    border-image: var(--primary-gradient) 1;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* ============================================
   TYPOGRAPHY ENHANCEMENTS
   ============================================ */

/* Highlighted text */
.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Tech badges */
.tech-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0.3rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Tech stack section */
.tech-stack {
    background: rgba(102, 126, 234, 0.05);
    border-left: 4px solid #667eea;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
}

.tech-stack .label {
    font-weight: 600;
    color: var(--text-dark);
    margin-right: 0.5rem;
}

/* Special text styles */
.intro-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.goal-text {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 1.2rem;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    font-size: 1.1rem;
    margin: 1.5rem 0;
}

.update-note {
    background: rgba(255, 193, 7, 0.1);
    padding: 1rem 1.2rem;
    border-radius: 10px;
    border-left: 4px solid #ffc107;
    font-size: 1rem;
    margin-top: 1.5rem;
}

.warning-text {
    background: rgba(255, 152, 0, 0.1);
    padding: 1rem 1.2rem;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
    margin: 1rem 0;
}

.benefit-text {
    background: rgba(76, 175, 80, 0.1);
    padding: 1rem 1.2rem;
    border-radius: 8px;
    border-left: 4px solid #4caf50;
    margin: 1rem 0;
}

/* Section subtitle */
.section-subtitle {
    color: var(--text-medium);
    font-size: 1.05rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* Project subtitle */
.project-subtitle {
    color: var(--text-medium);
    font-size: 1rem;
    margin-top: -0.3rem;
    margin-bottom: 1rem;
    font-style: italic;
}

/* Game title styling */
.game-title {
    font-weight: 600;
    color: #4caf50;
}

/* Project status badges */
.project-status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.project-status-badge.archived {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    color: white;
}

.project-status-badge.active {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

/* Project features list */
.project-features {
    background: rgba(102, 126, 234, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.project-features ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0 0 0;
}

.project-features li {
    padding: 0.4rem 0;
    font-size: 1rem;
}

.project-features strong {
    color: var(--text-dark);
    font-size: 1.05rem;
}

/* ============================================
   TAB NAVIGATION
   ============================================ */
.tab-container {
    display: flex;
    flex-direction: column;
    margin-top: 0.5rem;
}

nav.tab-buttons {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.tab-button {
    background-color: var(--secondary-color);
    border: none;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-size: 1.1rem;
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: var(--text-light);
    position: relative;
    overflow: hidden;
}

.tab-button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tab-button:hover {
    background-color: #c0c0c0;
    color: var(--text-dark);
    transform: translateY(-2px);
}

.tab-button:hover::after {
    transform: scaleX(1);
}

.tab-button.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.tab-pane {
    display: none;
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--background-gradient);
    box-shadow: var(--shadow-strong);
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* ============================================
   SOCIAL LINKS
   ============================================ */
.social-links {
    text-align: center;
}

.social-links .links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-dark);
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 120px;
    box-shadow: 0 4px 6px var(--shadow-light);
}

.social-link:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-hover);
}

.social-link i {
    font-size: 2rem;
    margin-bottom: 0.8rem;
}

.social-link img {
    height: 2rem;
    margin-bottom: 0.8rem;
}

.social-link.github {
    background-color: var(--github-bg);
    border: 1px solid var(--github-border);
}

.social-link.github i,
.social-link.github span {
    color: var(--github-icon);
}

.social-link.gamejolt {
    background-color: var(--gamejolt-bg);
    color: white;
}

.social-link.steam {
    background-color: var(--steam-bg);
    color: white;
}

.social-link.youtube {
    background-color: var(--youtube-bg);
    color: white;
}

.social-link.email {
    background-color: var(--email-bg);
    color: white;
}

.copy-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

.copy-message.show {
    opacity: 1;
}

/* ============================================
   PROJECTS
   ============================================ */
.projects-content ul {
    list-style: none;
    padding: 0;
}

.project-item {
    background: var(--background-gradient);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-strong);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInUp 0.5s ease-out backwards;
}

.project-item:nth-of-type(1) {
    animation-delay: 0.1s;
}

.project-item:nth-of-type(2) {
    animation-delay: 0.2s;
}

.project-item:nth-of-type(3) {
    animation-delay: 0.3s;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



.project-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
}



.project-item h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.project-item p {
    margin-bottom: 1rem;
}

.project-item .project-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.project-actions {
    display: flex;
    align-items: center;
    margin-top: 1rem;
}

.download-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 2px solid var(--primary-color);
}

.download-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.project-details-hidden {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.read-more-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    color: white;
    font-weight: 500;
    position: relative;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    min-width: 140px;
    text-align: center;
}

.read-more-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    filter: brightness(1.15);
}

.read-more-button:active {
    transform: translateY(-1px) scale(1.02);
}

.read-more-button::after {
    content: ' ▼';
    margin-left: 0.5rem;
    font-size: 0.8em;
    transition: transform 0.3s ease;
    display: inline-block;
}

.read-more-button[aria-expanded="true"]::after {
    content: ' ▲';
    transform: rotate(180deg);
}

/* ============================================
   YANDEX BANNER
   ============================================ */
#yandex-banner-left {
    margin: 2rem 0;
}

.yandex-banner-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-footer);
    font-weight: 500;
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
    --primary-color: #4a9eff;
    --text-dark: #e4e4e4;
    --text-medium: #b0b0b0;
    --text-light: #a0a0a0;
    --text-footer: #8a9ba8;
    --background-light: #1a1a1a;
    --background-gradient: linear-gradient(145deg, #1e1e1e 0%, #252525 100%);
    --border-light: #333333;
    --shadow-light: rgba(255, 255, 255, 0.05);
    --shadow-strong: 0 10px 30px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    --secondary-color: #2a2a2a;
}

[data-theme="dark"] body {
    background: #0f0f0f;
}

[data-theme="dark"] .project-item {
    background: var(--background-gradient);
    border-color: #2a2a2a;
}

[data-theme="dark"] .tab-button {
    background-color: #2a2a2a;
    color: #b0b0b0;
}

[data-theme="dark"] .tab-button:hover {
    background-color: #3a3a3a;
    color: #e4e4e4;
}

[data-theme="dark"] .yandex-banner-placeholder {
    background: #252525;
    border-color: #333;
    color: #888;
}

/* Auto dark theme support (respects system preference) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-color: #4a9eff;
        --text-dark: #e4e4e4;
        --text-medium: #b0b0b0;
        --text-light: #a0a0a0;
        --text-footer: #8a9ba8;
        --background-light: #1a1a1a;
        --background-gradient: linear-gradient(145deg, #1e1e1e 0%, #252525 100%);
        --border-light: #333333;
        --shadow-light: rgba(255, 255, 255, 0.05);
        --shadow-strong: 0 10px 30px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
        --secondary-color: #2a2a2a;
    }

    :root:not([data-theme="light"]) body {
        background: #0f0f0f;
    }

    :root:not([data-theme="light"]) .project-item {
        background: var(--background-gradient);
        border-color: #2a2a2a;
    }

    :root:not([data-theme="light"]) .tab-button {
        background-color: #2a2a2a;
        color: #b0b0b0;
    }

    :root:not([data-theme="light"]) .tab-button:hover {
        background-color: #3a3a3a;
        color: #e4e4e4;
    }

    :root:not([data-theme="light"]) .yandex-banner-placeholder {
        background: #252525;
        border-color: #333;
        color: #888;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Optimize animations for better performance */
.tab-button,
.social-link,
.project-item,
.read-more-button,
.download-link {
    will-change: transform;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Safe area support for notched devices (iPhone X+) */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Large Screens (1920px and above) */
@media (min-width: 1920px) {
    .container {
        max-width: 1400px;
        padding: 3rem;
    }

    h1 {
        font-size: 3rem;
    }

    .tagline {
        font-size: 2rem;
    }

    section {
        padding: 2.5rem;
    }

    .social-links .links {
        gap: 2.5rem;
    }

    .social-link {
        width: 140px;
    }
}

/* Desktop/Laptop (1024px - 1440px) */
@media (min-width: 1024px) and (max-width: 1440px) {
    .container {
        max-width: 1100px;
        padding: 2rem;
    }

    h1 {
        font-size: 2.3rem;
    }

    .social-links .links {
        gap: 1.8rem;
    }
}

/* Tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 2rem 1.5rem;
    }

    header {
        margin-top: 4rem;
        margin-bottom: 4rem;
    }

    h1 {
        font-size: 2.2rem;
    }

    .tagline {
        font-size: 1.7rem;
    }

    section {
        padding: 1.8rem;
    }

    .social-links .links {
        gap: 1.5rem;
    }

    .social-link {
        width: 110px;
        padding: 0.9rem;
    }

    .tab-button {
        padding: 0.75rem 1.3rem;
        font-size: 1.05rem;
        min-height: 44px;
        /* Touch target size */
    }

    .project-item {
        padding: 1.8rem;
    }
}

/* Mobile Landscape & Small Tablets (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .container {
        padding: 1.5rem;
    }

    header {
        margin-top: 3rem;
        margin-bottom: 3rem;
    }

    h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1.6rem;
    }

    section {
        padding: 1.5rem;
    }

    .social-links .links {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .social-link {
        width: 100%;
        min-height: 44px;
        /* Touch target size */
    }

    .tab-button {
        padding: 0.8rem 1.3rem;
        font-size: 1.05rem;
        min-height: 44px;
        /* Touch target size */
    }

    .tab-pane {
        padding: 1.3rem;
    }
}

/* Mobile Portrait (320px - 480px) */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    header {
        margin-top: 2rem;
        margin-bottom: 2rem;
    }

    h1 {
        font-size: clamp(1.6rem, 5vw, 2rem);
    }

    h2 {
        font-size: clamp(1.4rem, 4.5vw, 1.6rem);
    }

    .tagline {
        font-size: clamp(1.2rem, 4vw, 1.4rem);
    }

    .description {
        font-size: clamp(0.95rem, 3.5vw, 1.05rem);
    }

    p {
        font-size: clamp(0.95rem, 3.5vw, 1.05rem);
    }

    section {
        padding: 1.2rem;
        margin-bottom: 2rem;
    }

    .social-links .links {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .social-link {
        width: 100%;
        max-width: none;
        padding: 1rem 0.5rem;
        min-height: 44px;
        /* Touch target size */
    }

    .social-link i {
        font-size: 1.8rem;
        margin-bottom: 0.6rem;
    }

    .social-link img {
        height: 1.8rem;
        margin-bottom: 0.6rem;
    }

    .social-link span {
        font-size: 0.9rem;
    }

    .tab-buttons {
        flex-direction: column;
        gap: 0.6rem;
    }

    .tab-button {
        width: 100%;
        padding: 0.9rem 1rem;
        font-size: 1rem;
        min-height: 44px;
        /* Touch target size */
    }

    .tab-pane {
        padding: 1rem;
    }

    .read-more-button {
        width: 100%;
        padding: 0.9rem 1.5rem;
        min-height: 44px;
        /* Touch target size */
    }

    .download-link {
        width: 100%;
        text-align: center;
        padding: 0.8rem 1rem;
        min-height: 44px;
        /* Touch target size */
    }

    .project-item {
        padding: 1.2rem;
    }

    .project-item h3 {
        font-size: 1.3rem;
    }

    .tech-badge {
        font-size: 0.85rem;
        padding: 0.25rem 0.6rem;
    }

    .project-features li {
        font-size: 0.95rem;
    }

    .copy-message {
        top: 10px;
        padding: 10px 20px;
        font-size: 0.9rem;
        max-width: 90%;
    }
}

/* Extra Small Mobile (320px - 375px) */
@media (max-width: 375px) {
    .container {
        padding: 0.8rem;
    }

    h1 {
        font-size: clamp(1.5rem, 5vw, 1.8rem);
    }

    h2 {
        font-size: clamp(1.3rem, 4.5vw, 1.5rem);
    }

    section {
        padding: 1rem;
    }

    .intro-text,
    .goal-text,
    .update-note,
    .warning-text,
    .benefit-text {
        font-size: 0.95rem;
        padding: 0.9rem;
    }

    .project-status-badge {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    /* Theme toggle adjustments for small screens */
    .theme-toggle {
        width: 44px;
        height: 44px;
        top: -10px;
        right: -5px;
    }

    .theme-toggle i {
        font-size: 1.1rem;
    }
}