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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --main-light: #f0f0f5;
    --secondary-light: #fff;
    --main-dark: #06060c;
    --secondary-dark: #111118;
    --text-light: #070707;
    --text-dark: #dfe9ff;

    --font-small: clamp(1rem, 1.5vw, 1.25rem);
    --font-medium: clamp(1.25rem, 2vw, 1.625rem);
    --font-large: clamp(1.625rem, 3vw, 2.625rem);
    --font-xlarge: clamp(4.25rem, 10vw, 6.875rem);

    --transition: 0.3s ease;
    --default: 0.3s ease;

    /* === LIQUID GLASS === */
    --lg-iri-1: rgba(120, 180, 255, 0.55);
    --lg-iri-2: rgba(200, 140, 255, 0.5);
    --lg-iri-3: rgba(255, 180, 220, 0.45);
    --lg-iri-4: rgba(140, 255, 200, 0.35);
    --lg-glass-fill: rgba(255, 255, 255, 0.03);
    --lg-glass-fill-hover: rgba(255, 255, 255, 0.06);
    --lg-glass-border: rgba(255, 255, 255, 0.12);
    --lg-glass-border-hover: rgba(255, 255, 255, 0.22);
    --lg-specular: rgba(255, 255, 255, 0.15);
    --lg-specular-strong: rgba(255, 255, 255, 0.25);
    --lg-viscous: 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

button,
a {
    outline: none;
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
}

#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

body {
    background: var(--main-light);
    color: var(--text-light);
    height: 100vh;
    width: 100vw;
    display: flex;
    font-family: "Cabin", sans-serif;
    overflow: hidden;
    transition: background 0.5s ease, color 0.5s ease;
    margin: 0;
    padding: 0;
}
body.dark {
    background: var(--main-dark);
    color: var(--text-dark);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 100;
    background: rgba(255, 255, 255, 0.6);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    transition: background 0.5s ease, border-color 0.5s ease;
}

body.dark .sidebar {
    background: rgba(10, 10, 18, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--lg-glass-border-hover);
    box-shadow:
        inset -1px 0 0 0 rgba(120, 180, 255, 0.06),
        inset 0 1px 0 0 var(--lg-specular-strong),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.06),
        4px 0 24px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
}

.sidebar-logo-btn {
    padding: 0.5rem;
    border-radius: 50%;
    transition: transform 0.3s ease;
}
.sidebar-logo-btn:hover .logo {
    animation: logoSpin 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.sidebar-logo-btn .logo path {
    stroke: var(--text-light);
    transition: stroke 0.3s ease;
}
body.dark .sidebar-logo-btn .logo path {
    stroke: var(--text-dark);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

/* ===== BUBBLE NAV INDICATOR ===== */
.sidebar-nav .bubble-indicator {
    position: absolute;
    left: 0;
    width: 100%;
    border-radius: 14px 12px 13px 11px;
    pointer-events: none;
    z-index: 0;
    /* Light mode bubble */
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
    /* Fluid transition */
    transition: top 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius var(--lg-viscous),
                opacity 0.3s ease;
    opacity: 1;
}

body.dark .sidebar-nav .bubble-indicator {
    background: var(--lg-glass-fill);
    border: 1px solid var(--lg-glass-border);
    box-shadow:
        inset 0 1px 0 0 var(--lg-specular-strong),
        inset 0 -1px 0 0 rgba(255, 255, 255, 0.05),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.08),
        inset -1px 0 0 0 rgba(200, 140, 255, 0.08),
        0 4px 16px rgba(0, 0, 0, 0.2);
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.125rem;
    border-radius: 12px 10px 11px 13px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-light);
    transition: color 0.2s ease, font-weight 0.2s ease,
                border-radius var(--lg-viscous),
                background 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease,
                transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
    overflow: hidden;
    text-align: left;
    justify-content: flex-start;
    border: 1px solid transparent;
    background: transparent;
}

.sidebar-btn svg path {
    stroke: var(--text-light);
    transition: stroke 0.2s ease;
}
body.dark .sidebar-btn {
    color: var(--text-dark);
}
body.dark .sidebar-btn svg path {
    stroke: var(--text-dark);
}

.sidebar-btn:hover {
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.03);
}
body.dark .sidebar-btn:hover {
    color: var(--text-dark);
    background: var(--lg-glass-fill-hover);
    border-color: var(--lg-glass-border-hover);
    box-shadow:
        inset 0 1px 0 0 var(--lg-specular-strong),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.1),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.1),
        inset -1px 0 0 0 rgba(140, 255, 200, 0.08),
        0 0 12px rgba(120, 180, 255, 0.08);
}

.sidebar-btn:active {
    transform: scale(0.95);
}

.sidebar-btn.active {
    font-weight: 600;
}
body.dark .sidebar-btn.active {
    background: var(--lg-glass-fill);
    border-color: rgba(255, 255, 255, 0.06);
}

.sidebar-btn span {
    font-size: 1rem;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
body.dark .sidebar-footer {
    border-top-color: var(--lg-glass-border);
}

.sidebar-contacts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contacts-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin: 0;
    padding: 0;
}

.contact-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px 8px 9px 11px;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.2s ease,
                border-radius var(--lg-viscous),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}
body.dark .contact-link {
    color: var(--text-dark);
    background: var(--lg-glass-fill);
    border-color: var(--lg-glass-border);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.06),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.06),
        inset -1px 0 0 0 rgba(140, 255, 200, 0.05);
}
.contact-link:hover {
    transform: translateY(-3px) scale(1.1);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 11px 9px 10px 8px;
}
body.dark .contact-link:hover {
    background: var(--lg-glass-fill-hover);
    border-color: var(--lg-glass-border-hover);
    box-shadow:
        inset 0 1px 0 0 var(--lg-specular-strong),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.12),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.12),
        inset -1px 0 0 0 rgba(140, 255, 200, 0.1),
        0 0 16px rgba(120, 180, 255, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.25);
}

.sidebar-theme {
    display: flex;
    justify-content: center;
}
.sidebar-theme-btn {
    padding: 0.5rem;
    background: none;
}

.sidebar-copyright {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    text-align: center;
}
.copyright-text {
    opacity: 0.6;
    white-space: nowrap;
}
.copyright-email {
    color: var(--text-light);
    opacity: 0.85;
    text-decoration: none;
    transition: opacity 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
body.dark .copyright-email {
    color: var(--text-dark);
}
.copyright-email:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 280px;
    height: 100vh;
    width: calc(100vw - 280px);
    overflow: hidden;
}

.horizontal-scroll-container {
    display: flex;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.horizontal-scroll-container::-webkit-scrollbar { height: 6px; }
.horizontal-scroll-container::-webkit-scrollbar-track { background: transparent; }
.horizontal-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}
body.dark .horizontal-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

.scroll-section {
    min-width: 100%;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    flex-shrink: 0;
    padding: 2rem;
}

#typing-text {
    font-size: var(--font-large);
    line-height: 1.6;
}
#typing-text .typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background: var(--text-light);
    margin-left: 4px;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}
body.dark #typing-text .typing-cursor {
    background: var(--text-dark);
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

h3 {
    font-size: 2.625rem;
    line-height: 50.4px;
    letter-spacing: -0.5%;
    padding-bottom: 42px;
}
.content {
    display: flex;
    text-align: center;
    justify-content: center;
}

/* ===== LIQUID GLASS KEYFRAMES ===== */
@keyframes lg-iri-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes lg-ripple-expand {
    0%   { transform: scale(0); opacity: 1; }
    70%  { opacity: 0.4; }
    100% { transform: scale(2.5); opacity: 0; }
}

.lg-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.08) 40%,
        transparent 70%
    );
    transform: scale(0);
    animation: lg-ripple-expand 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: none;
    z-index: 50;
}

@keyframes logoSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
#year-trigger {
    display: inline-block;
    cursor: pointer;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
@keyframes ripple-animation {
    to { transform: scale(4); opacity: 0; }
}

/* ===== LAMP / THEME TOGGLE ===== */
.theme-icon,
.theme-icon-dark {
    position: absolute;
    height: 12em;
    top: 0px;
    right: -10px;
    z-index: 10;
    transform-origin: 50% 0%;
    transition: transform 0.05s linear;
    will-change: transform;
}
.theme-icon { display: inline; }
.theme-icon-dark { display: none; }
.theme-icon.dark { display: none; }
.theme-icon-dark.dark { display: inline; }

.theme-secondary {
    background: transparent;
    transition: background 0.5s ease;
}
.theme-secondary.dark { background: transparent; }

body footer .btn.theme-secondary { background: #fff !important; }
body.dark footer .btn.theme-secondary.dark,
body.dark footer .btn.theme-secondary,
footer .btn.theme-secondary.dark { background: #111118 !important; }

.btn.dark .logo path {
    stroke: var(--text-dark);
    transition: var(--default);
}

#welcome .text {
    font-size: var(--font-xlarge);
}

/* ===== STACK SECTION ===== */
#stack {
    overflow-y: auto;
    overflow-x: hidden;
}
#stack #stack_container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: start;
    margin: auto;
    gap: 3rem;
    padding: 84px 2rem;
    max-width: 1400px;
}
#stack .category {
    opacity: 0;
    transform: translateY(30px);
}
#stack .category h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    padding-bottom: 2rem;
    text-align: center;
    position: relative;
}
#stack .category h3::after {
    content: "";
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--text-light), transparent);
    border-radius: 2px;
}
#stack .category.dark h3::after {
    background: linear-gradient(90deg, transparent, var(--text-dark), transparent);
}
#stack .category > div {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 100%;
    justify-content: center;
}

/* Glass stack cards */
#stack .stack_block {
    flex: 0 1 calc(33.333% - 1rem);
    min-width: 280px;
    max-width: 350px;
    border-radius: 16px 13px 14px 15px;
    padding: 2rem 1.5rem;
    transition: transform 0.35s ease, box-shadow 0.35s ease,
                border-radius var(--lg-viscous),
                background 0.3s ease, border-color 0.3s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    cursor: pointer;
    will-change: transform;
}
#stack .stack_block:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}
#stack .stack_block:active {
    transform: scale(0.97);
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#stack .stack_block.dark {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.015) 40%,
        rgba(255, 255, 255, 0.0) 60%,
        rgba(255, 255, 255, 0.03) 100%
    );
    border: 1px solid transparent;
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.08),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.08),
        inset -1px 0 0 0 rgba(140, 255, 200, 0.06),
        0 4px 20px rgba(0, 0, 0, 0.3);
}
/* Iridescent border for dark stack cards — soap bubble edge refraction */
#stack .stack_block.dark::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1.5px;
    background: linear-gradient(
        135deg,
        var(--lg-iri-1),
        var(--lg-iri-2),
        var(--lg-iri-3),
        var(--lg-iri-4),
        var(--lg-iri-1),
        var(--lg-iri-2)
    );
    background-size: 400% 400%;
    animation: lg-iri-shift 6s ease-in-out infinite;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}
/* Soap bubble specular edge highlight */
#stack .stack_block.dark::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        165deg,
        rgba(255, 255, 255, 0.12) 0%,
        transparent 25%,
        transparent 60%,
        rgba(180, 200, 255, 0.06) 80%,
        rgba(255, 180, 220, 0.04) 100%
    );
    pointer-events: none;
    z-index: 1;
}
#stack .stack_block.dark:hover::before {
    opacity: 1;
}
#stack .stack_block.dark:hover {
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.12),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.12),
        inset -1px 0 0 0 rgba(140, 255, 200, 0.1),
        0 0 20px rgba(120, 180, 255, 0.08),
        0 12px 40px rgba(0, 0, 0, 0.45);
}

#stack .stack_block img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}
#stack .stack_block:hover img {
    transform: scale(1.1) rotate(5deg);
}
#stack .stack_content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    text-align: center;
    width: 100%;
}
#stack .stack_name {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    font-weight: 600;
}
#stack .stack_yo_exp {
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    opacity: 0.7;
}
#stack .experience-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}
#stack .stack_block.dark .experience-bar {
    background: rgba(255, 255, 255, 0.08);
}
#stack .experience-fill {
    height: 100%;
    background: linear-gradient(90deg, #666, #999);
    border-radius: 2px;
    width: 0;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
#stack .stack_block.dark .experience-fill {
    background: linear-gradient(90deg, #888, #bbb);
}

@media (max-width: 1200px) {
    #stack .stack_block {
        flex: 0 1 calc(50% - 0.75rem);
        min-width: 240px;
    }
}
@media (max-width: 768px) {
    #stack .category > div { gap: 1rem; }
    #stack #stack_container { padding: 60px 1rem; gap: 2rem; }
    #stack .stack_block {
        flex: 0 1 100%;
        min-width: 240px;
        max-width: 100%;
    }
}

/* ===== PROJECT CARDS - SOLID, NO TRANSPARENCY ===== */
.swiper { width: 80vw; height: 75vh; }
.swiper-slide { display: flex !important; }

.project-card {
    display: flex;
    border-radius: 1em;
    gap: 1rem;
    width: 80%;
    height: 70%;
    padding: 1rem;
    margin: auto;
    position: relative;
    background: #fff;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.35s ease,
                border-radius var(--lg-viscous);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    will-change: transform;
    overflow: hidden;
}
.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border-radius: 1.1em 0.95em 1.05em 0.9em;
}
.project-card.dark {
    background: #111118;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.06),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.06),
        0 4px 20px rgba(0, 0, 0, 0.3);
}
.project-card.dark:hover {
    border-color: var(--lg-glass-border-hover);
    box-shadow:
        inset 0 1px 0 0 var(--lg-specular-strong),
        inset 0 -1px 0 0 rgba(200, 140, 255, 0.12),
        inset 1px 0 0 0 rgba(120, 180, 255, 0.1),
        inset -1px 0 0 0 rgba(140, 255, 200, 0.08),
        0 0 24px rgba(120, 180, 255, 0.08),
        0 16px 48px rgba(0, 0, 0, 0.5);
}
.project-card .project-text { transition: color 0.3s ease; }
.project-card.dark .project-text { color: var(--text-dark); }
.project-card img { height: 100%; border-radius: 10px; }
.project-card .project-info { text-align: start; }
.project-card h2 { font-size: var(--font-large); margin: 10px 0; }
.project-card p { font-size: var(--font-small); }

.project-card .stacks-for-project {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.project-card .stack-for-project {
    padding: 0.5rem 0.75rem;
    border-radius: 2rem;
    background-color: rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease, transform 0.2s ease;
    cursor: default;
}
.project-card .stack-for-project:hover {
    background-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}
body.dark .project-card .stack-for-project {
    background-color: rgba(255, 255, 255, 0.06);
}
body.dark .project-card .stack-for-project:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.card-buttons button { font-size: 1rem; }
.card-buttons { position: absolute; bottom: 10px; right: 10px; }
p.about { font-size: var(--font-small); margin-bottom: 1rem; }

.card-buttons .btn-link {
    padding: 0.5rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 0.5rem;
}
.card-buttons .btn-link:hover {
    transform: scale(1.15) rotate(5deg);
    background: rgba(0, 0, 0, 0.05);
}
body.dark .card-buttons .btn-link:hover {
    background: rgba(255, 255, 255, 0.1);
}
.card-buttons .btn-link img { width: 3em; transition: filter 0.3s ease; }
.project-card.dark .btn-link img { filter: invert(1) brightness(1.2); }

.swiper-button-prev,
.swiper-button-next {
    --swiper-navigation-color: var(--text-light) !important;
    transition: opacity 0.2s ease;
}
.swiper-button-prev:hover,
.swiper-button-next:hover { opacity: 0.7; }
.swiper-button-prev.dark,
.swiper-button-next.dark {
    --swiper-navigation-color: var(--text-dark) !important;
}

/* ===== TOUCH / MOBILE ===== */
@media (hover: none) and (pointer: coarse) {
    .project-card p.about {
        font-size: clamp(0.75rem, 3vw, 0.9rem) !important;
        line-height: 1.4 !important;
        margin-bottom: 0.5rem !important;
    }
    .project-card {
        flex-direction: column;
        width: 90%; height: 95%;
        overflow: hidden; padding: 1rem;
        border-radius: 20px;
    }
    .project-card.dark { background: #111118; }
    .project-card .project-text { color: var(--text-light); }
    .project-card.dark .project-text { color: var(--text-dark); }
    .project-card .project-img {
        width: 100%; aspect-ratio: 1 / 1;
        flex-shrink: 0; overflow: hidden;
        display: flex; align-items: center; justify-content: center;
    }
    .project-card .project-img img {
        width: 100%; height: 100%;
        object-fit: cover; border-radius: 10px;
    }
    .project-card h2 {
        font-size: clamp(1.1rem, 4.5vw, 1.4rem) !important;
        margin: 0 0 0.4rem 0 !important;
    }
    .project-card .stacks-for-project {
        display: flex !important; gap: 0.2rem;
        margin-top: 0.3rem; margin-bottom: 0.5rem;
    }
    .project-card .stack-for-project {
        padding: 0.3rem 0.5rem; font-size: 0.7rem;
    }
    .project-card .project-info {
        display: flex; flex-direction: column;
        padding: 1rem 0.5rem; flex: 1;
        overflow-y: auto; width: 100%;
    }
    .project-main-info { margin-bottom: auto; }
    .card-frame { display: flex; flex-direction: column; }
    #stack_container { -webkit-overflow-scrolling: touch; }
    .swiper-button-prev,
    .swiper-button-next { display: none !important; }
}

@media (max-width: 1024px) {
    .swiper { width: 90vw; }
    .project-card { width: 90%; height: 75%; }
}

@media (max-width: 800px) {
    .sidebar { width: 200px; padding: 1.5rem 1rem; }
    .main-content { margin-left: 200px; width: calc(100vw - 200px); }
    .sidebar-btn span { font-size: 0.875rem; }
    .sidebar-nav { gap: 0.5rem; }
    .sidebar-footer { gap: 1.5rem; }
    .contacts-title { font-size: 0.75rem; }
    .contact-link { width: 35px; height: 35px; }
    .contact-link svg { width: 20px; height: 20px; }
}

@media (max-width: 600px) {
    html, body {
        overflow-x: hidden; overflow-y: hidden;
        height: 100vh; height: 100dvh;
        width: 100vw; position: fixed;
        touch-action: manipulation;
    }
    .sidebar { width: 60px; padding: 0.75rem 0.5rem; }
    .sidebar-header { margin-bottom: 1.5rem; }
    .sidebar-logo-btn .logo { width: 28px; height: 22px; }
    .sidebar-btn {
        padding: 0.625rem; justify-content: center;
        flex-direction: column; gap: 0.25rem; min-height: 44px;
    }
    .sidebar-btn span { display: none; }
    .sidebar-btn svg { width: 22px; height: 22px; }
    .sidebar-footer { gap: 0.75rem; padding-top: 0.75rem; }
    .contacts-title { display: none; }
    .sidebar-contacts { gap: 0.5rem; }
    .contact-links {
        flex-direction: column; gap: 0.5rem; align-items: center;
    }
    .contact-link {
        width: 36px; height: 36px;
        min-height: 44px; min-width: 44px;
        display: flex; align-items: center; justify-content: center;
    }
    .contact-link svg { width: 20px; height: 20px; }
    .sidebar-theme-btn { padding: 0.5rem; min-height: 60px; }
    .sidebar-theme-btn svg,
    .theme-icon,
    .theme-icon-dark {
        width: 36px !important; height: 65px !important;
        right: auto !important; left: -5px !important;
    }
    .sidebar-copyright { display: none; }
    .main-content { margin-left: 60px; width: calc(100vw - 60px); }
    .horizontal-scroll-container { overflow-x: hidden; scroll-snap-type: none; }
    .scroll-section { padding: 0.75rem; display: none; }
    .scroll-section.active { display: flex; }
    #stack .stack_block {
        transform: none !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
    }
    #stack .stack_block.dark {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    }
    #stack .stack_block:hover {
        transform: translateY(-5px) scale(1.03) !important;
    }
    #welcome .text { font-size: clamp(2rem, 8vw, 4.25rem); }
    #projects {
        width: 92% !important; margin: 0 4% !important;
        height: 100% !important; display: flex !important;
        align-items: center !important; justify-content: center !important;
    }
    #projects .content {
        width: 100% !important; height: 100% !important;
        display: flex !important; align-items: center !important;
        justify-content: center !important;
    }
    .swiper { width: 100% !important; height: 100% !important; }
    .swiper-wrapper { width: 100% !important; height: 100% !important; }
    .swiper-slide {
        display: flex !important; align-items: center !important;
        justify-content: center !important;
        width: 100% !important; height: 100% !important;
        opacity: 1 !important; visibility: visible !important;
    }
    .project-card {
        width: 90% !important; height: 95% !important;
        flex-direction: column; padding: 1rem;
        overflow: hidden; border-radius: 20px;
        background: #fff !important;
        opacity: 1 !important; visibility: visible !important;
    }
    .project-card.dark { background: #111118 !important; }
    .project-card .project-text { color: var(--text-light); }
    .project-card.dark .project-text { color: var(--text-dark); }
    .project-card .stack-for-project { background-color: rgba(0, 0, 0, 0.05); }
    .project-card.dark .stack-for-project { background-color: rgba(255, 255, 255, 0.06); }
    .project-card .project-img {
        width: 100% !important; aspect-ratio: 1 / 1 !important;
        flex-shrink: 0; overflow: hidden;
        display: flex !important; align-items: center; justify-content: center;
    }
    .project-card .project-img img {
        width: 100% !important; height: 100% !important;
        object-fit: cover; border-radius: 10px;
        display: block !important; opacity: 1 !important;
    }
    .project-card .project-info {
        display: flex !important; flex-direction: column;
        padding: 1rem 0.5rem; flex: 1;
        overflow-y: auto; width: 100% !important;
    }
    .project-card .project-main-info { flex: 1; }
    .project-card h2 {
        font-size: clamp(1.1rem, 4.5vw, 1.4rem) !important;
        margin: 0 0 0.4rem 0 !important;
        display: block !important; opacity: 1 !important;
    }
    .project-card p {
        font-size: clamp(0.75rem, 3vw, 0.9rem) !important;
        margin-bottom: 0.5rem !important; line-height: 1.4 !important;
        display: block !important; opacity: 1 !important;
    }
    .project-card .stacks-for-project {
        margin-top: 0.3rem !important; margin-bottom: 0.5rem !important;
        gap: 0.2rem !important; display: flex !important; flex-wrap: wrap;
    }
    .project-card .stack-for-project {
        padding: 0.3rem 0.5rem !important; font-size: 0.7rem !important;
        display: block !important;
    }
    .card-buttons {
        position: static; margin-top: auto;
        display: flex; justify-content: flex-end;
        width: 100%; padding-top: 0.5rem;
    }
    .card-buttons .btn-link img { width: 2.5em; }
    .project-card.dark .btn-link img { filter: invert(1) brightness(1.2); }
    footer .btn { padding: 0.75rem 1.25rem; }
}

.hidden { display: none; }

::selection {
    background-color: #333;
    color: var(--secondary-light);
}

@keyframes fadeOutAndUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-100px); }
}
@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(100px); }
    100% { opacity: 1; transform: translateY(0); }
}
