/* ============================================
   PORTFOLIO — Bento Grid Edge-to-Edge
   Colors: Noble Black #0A0A0A + Cloud Dancer #F0EDE5
   ============================================ */

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black: #0A0A0A;
    --black-light: #141414;
    --black-card: #1A1A1A;
    --black-hover: #222222;
    --cloud: #F0EDE5;
    --cloud-dim: #D4D0C8;
    --cloud-muted: rgba(240, 237, 229, 0.6);
    --accent: #F0EDE5;
    --gap: 4px;
    --radius: 12px;
    --transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html {
    font-size: 16px;
    scroll-behavior: auto; /* Lenis handles this */
}

html.lenis, html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

body {
    font-family: 'Space Grotesk', -apple-system, sans-serif;
    background: var(--black);
    color: var(--cloud);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Cursor === */
body {
    cursor: default;
}

a, button, .cell-project, .skills-list li, .contact-link, .social-link {
    cursor: pointer;
}

/* === Bento Grid — Main Layout === */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(120px, auto);
    gap: var(--gap);
    padding: var(--gap);
    min-height: 100vh;
    width: 100%;
}

/* === Bento Cell (base) === */
.bento-cell {
    background: var(--black-card);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    opacity: 0;
    transform: translateY(40px) translateZ(0);
    will-change: transform, opacity;
}

.bento-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Grid Placement === */
/* Row math: every row must = 12 columns */

/* Hero — big left block */
.cell-hero {
    grid-column: span 6;
    grid-row: span 4;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--black-card) 0%, var(--black-light) 100%);
}

/* Skills — right of hero */
.cell-skills {
    grid-column: span 6;
    grid-row: span 4;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: space-between;
}

/* Row: 7 + 5 = 12 ✓ */

/* Project cells */
.cell-project {
    grid-column: span 4;
    grid-row: span 3;
    cursor: pointer;
}

.cell-project.large {
    grid-column: span 8;
    grid-row: span 3;
}

/* Row: 8 + 4 = 12  or  4 + 8 = 12 ✓ */

/* About cell */
.cell-about {
    grid-column: span 5;
    grid-row: span 3;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Contact cell */
.cell-contact {
    grid-column: span 7;
    grid-row: span 3;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Social cells */
.cell-social {
    grid-column: span 1;
    grid-row: span 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: background 0.3s;
    overflow: visible;
}

/* Row: 5 + 5 + 1 + 1 = 12 ✓ */

.cell-social:hover {
    background: var(--black-hover);
}

/* === HERO Content === */
.hero-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--cloud-muted);
    margin-bottom: 1.5rem;
}

.hero-name {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -2px;
    margin-bottom: 3rem;
}

.hero-name [data-char] {
    display: inline-block;
    transition: transform 0.3s, color 0.3s;
}

.hero-name [data-char]:hover {
    transform: translateY(-8px) rotate(-5deg);
    color: var(--cloud-dim);
}

.hero-role {
    font-size: 1.15rem;
    color: var(--cloud-muted);
    font-weight: 400;
}

.has-avatar .hero-content {
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 0, 0, 0.5);
}

.has-avatar .hero-role {
    color: var(--cloud);
    font-weight: 500;
}

/* Hero avatar — full-bleed background */
.hero-avatar-bg {
    position: absolute;
    top: 5%;
    left: 18%;
    right: -5%;
    bottom: -5%;
    z-index: 3;
}

.hero-avatar-bg img {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 1;
    width: auto;
    height: 100%;
    -webkit-mask-image:
        linear-gradient(to bottom, transparent 0%, black 14%, black 100%),
        linear-gradient(to bottom, black 0%, black 68%, transparent 76%),
        linear-gradient(to right, transparent 0%, black 55%, black 45%, transparent 100%);
    -webkit-mask-composite: destination-in, source-over;
    mask-image:
        linear-gradient(to bottom, transparent 0%, black 14%, black 100%),
        linear-gradient(to bottom, black 0%, black 68%, transparent 76%),
        linear-gradient(to right, transparent 0%, black 55%, black 45%, transparent 100%);
    mask-composite: intersect, add;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cell-hero:hover .hero-avatar-bg img {
    transform: scale(1.05);
}

.hero-avatar-gradient {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.hero-avatar-gradient::before {
    content: '';
    position: absolute;
    top: -10%;
    left: 20%;
    right: -10%;
    bottom: -10%;
    background: conic-gradient(
        from 200deg at 55% 60%,
        rgba(139, 92, 246, 0.22) 0deg,
        rgba(56, 189, 248, 0.16) 130deg,
        rgba(251, 146, 60, 0.18) 260deg,
        rgba(139, 92, 246, 0.22) 360deg
    );
    filter: blur(55px);
    border-radius: 40%;
}

.hero-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding: 3rem;
}

/* Fallback when no avatar */
.cell-hero:not(.has-avatar) .hero-content {
    padding: 3rem;
}

.hero-scroll-hint {
    margin-top: 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--cloud-muted);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hero-scroll-hint .arrow {
    display: inline-block;
    animation: bounceDown 1.5s infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* === Skills Cell === */
.skills-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--cloud-muted);
    margin-bottom: 0.5rem;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
}

.skills-list li {
    padding: 6px 14px;
    background: var(--black-light);
    border: 1px solid rgba(240, 237, 229, 0.1);
    border-radius: 100px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    transition: background 0.3s, color 0.3s, transform 0.3s;
    cursor: default;
}

/* Skills Stats */
.skills-stats {
    display: flex;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(240, 237, 229, 0.08);
    margin-top: auto;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-item + .stat-item {
    padding-left: 1.25rem;
    margin-left: 1.25rem;
    border-left: 1px solid rgba(240, 237, 229, 0.08);
}

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cloud);
    line-height: 1;
}

.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--cloud-muted);
}

.skills-list li:hover {
    background: var(--cloud);
    color: var(--black);
    transform: translateY(-2px);
}

/* === CMS Logos === */
.cms-logos {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cms-logos-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--cloud-muted);
}

.cms-logos-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.cms-logos-row img {
    height: 40px;
    width: auto;
    max-width: none;
    opacity: 0.4;
    filter: grayscale(100%) brightness(3);
    transition: opacity 0.3s, filter 0.3s;
}

.cms-logos-row img[alt="WordPress"],
.cms-logos-row img[alt="Tilda"] {
    height: 68px;
}

.cms-logos-row img[alt="Drupal"] {
    height: 50px;
}

.cms-logos-row img:hover {
    opacity: 1;
    filter: grayscale(0%) brightness(1);
}

/* === Project Card === */
.project-card {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
    transform: translateZ(0);
}

.project-placeholder {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, var(--black-card) 0%, var(--black-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-placeholder-icon {
    font-size: 3rem;
    opacity: 0.15;
}

.cell-project:hover .project-image {
    transform: scale(1.06);
    filter: blur(4px) brightness(0.6);
}

/* === "Посмотреть" button on card hover === */
.project-view-btn {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.75);
    z-index: 4;
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.project-view-btn span {
    display: block;
    padding: 14px 34px;
    background: rgba(20, 20, 20, 0.75);
    border: 1px solid rgba(240, 237, 229, 0.28);
    border-radius: 100px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--cloud);
    white-space: nowrap;
}

.cell-project:hover .project-view-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.project-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    background: linear-gradient(transparent, rgba(10, 10, 10, 0.95));
    transform: translateY(calc(100% - 9rem));
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2;
}

.cell-project:hover .project-overlay {
    transform: translateY(0);
}

.project-type {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--cloud-muted);
    margin-bottom: 0.5rem;
}

.project-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.project-desc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--cloud-muted);
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.3s 0.1s;
}

.cell-project:hover .project-desc {
    opacity: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s;
}
.cell-project:hover .project-tags {
    opacity: 1;
}

.project-tags span {
    padding: 3px 10px;
    background: rgba(240, 237, 229, 0.1);
    border-radius: 100px;
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
}

/* === About Cell === */
.about-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--cloud-muted);
    margin-bottom: 1rem;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--cloud-dim);
}

/* === Contact Cell === */
.contact-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--cloud-muted);
}

.contact-icons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    flex: 1;
}

.contact-icon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    color: var(--cloud);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-icon-card:hover {
    transform: translateY(-8px) scale(1.05);
}

.contact-big-icon {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
    transition: filter 0.3s;
}

.contact-icon-card:hover .contact-big-icon {
    filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.7));
}

.contact-icon-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--cloud-muted);
    transition: color 0.3s;
}

.contact-icon-card:hover .contact-icon-label {
    color: var(--cloud);
}

.contact-request-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    color: var(--cloud-muted);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(240, 237, 229, 0.3);
    transition: color 0.3s, text-decoration-color 0.3s;
}

.contact-request-btn:hover {
    color: var(--cloud);
    text-decoration-color: rgba(240, 237, 229, 0.8);
}

/* === Social Cell === */
.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: all 0.3s;
}

.social-link svg {
    width: 32px;
    height: 32px;
    transition: transform 0.3s;
}

.social-link:hover svg {
    transform: scale(1.3);
}

/* PNG social icons (Telegram, Max Messenger) */
.social-icon-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s;
    transform: scale(1.15);
}

.social-link:hover .social-icon-img {
    transform: scale(1.28);
    filter: drop-shadow(0 14px 32px rgba(0, 0, 0, 0.7));
}

/* contact-icon-img removed */

/* === Project Page === */
.project-page {
    min-height: 100vh;
    padding: 0;
}

.project-hero {
    width: 100%;
    height: 70vh;
    position: relative;
    overflow: hidden;
}

.project-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4rem;
    background: linear-gradient(transparent, var(--black));
}

.project-hero-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -2px;
}

.project-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.project-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.project-meta-item {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.project-meta-label {
    color: var(--cloud-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.25rem;
}

.project-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--cloud-dim);
}

/* === Project Gallery === */
.project-gallery {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
}

.gallery-item {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 8px;
    cursor: zoom-in;
    background: var(--black-card);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* === Lightbox === */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.96);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    cursor: zoom-out;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background: var(--black-card);
    border: 1px solid rgba(240, 237, 229, 0.15);
    border-radius: 50%;
    color: var(--cloud);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.lightbox-close:hover {
    background: var(--black-hover);
}

.back-link {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 100;
    padding: 12px 24px;
    background: var(--black-card);
    border-radius: 100px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 1px;
    transition: all 0.3s;
    border: 1px solid rgba(240, 237, 229, 0.1);
}

.back-link:hover {
    background: var(--cloud);
    color: var(--black);
}


.upload-zone-sm p { font-size: 0.75rem !important; }

/* === Footer === */
.footer {
    text-align: center;
    padding: 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--cloud-muted);
    letter-spacing: 2px;
}

/* === Loading Screen === */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--black);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s, visibility 0.6s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.loader-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 4px;
    color: var(--cloud);
}

.loader-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    color: var(--cloud-muted);
}

.loader-accent {
    font-style: italic;
    font-weight: 500;
    color: var(--cloud);
    background: linear-gradient(
        90deg,
        var(--cloud) 0%,
        var(--cloud) 25%,
        #ff6b6b 35%,
        #ffd93d 45%,
        #6bcb77 50%,
        #4d96ff 55%,
        #9b59b6 65%,
        var(--cloud) 75%,
        var(--cloud) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loader-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--cloud);
    animation: loadBar 1.2s ease-out forwards;
}

@keyframes loadBar {
    from { width: 0%; }
    to { width: 100%; }
}

/* === Responsive === */

/* Tablet */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .cell-hero {
        grid-column: span 6;
        grid-row: span 3;
    }

    .cell-skills {
        grid-column: span 6;
        grid-row: span 2;
    }

    .cell-project,
    .cell-project.large {
        grid-column: span 3;
        grid-row: span 3;
    }

    .cell-about {
        grid-column: span 2;
        grid-row: span 2;
    }

    .cell-contact {
        grid-column: span 4;
        grid-row: span 3;
        padding: 1.75rem;
    }

    .contact-icons {
        gap: 1.5rem;
    }

    .contact-big-icon {
        width: 78px;
        height: 78px;
    }
}

/* Mobile */
@media (max-width: 640px) {
    :root {
        --gap: 3px;
        --radius: 8px;
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cell-hero {
        grid-column: span 2;
        grid-row: span 3;
    }

    .hero-content {
        padding: 2rem;
        padding-top: 55%;
        justify-content: flex-start;
    }

    .hero-avatar-bg {
        top: -5%;
        left: 5%;
        right: -10%;
        bottom: 10%;
    }

    .cell-skills {
        grid-column: span 2;
        grid-row: span 2;
        padding: 1.5rem;
    }

    .cell-project,
    .cell-project.large {
        grid-column: span 2;
        grid-row: span 3;
    }

    .cell-about {
        grid-column: span 2;
        grid-row: span 2;
        padding: 1.5rem;
    }

    .cell-contact {
        grid-column: span 2;
        grid-row: span 3;
        padding: 1.5rem;
    }

    .contact-icons {
        gap: 1rem;
    }

    .contact-big-icon {
        width: 64px;
        height: 64px;
    }

    .contact-icon-label {
        font-size: 0.6rem;
        letter-spacing: 1.5px;
    }

    .hero-name {
        font-size: 2.2rem;
        letter-spacing: -1px;
        margin-bottom: 0.75rem;
    }

    .hero-label {
        margin-bottom: 0.75rem;
    }

    .hero-role {
        font-size: 0.95rem;
    }

    .hero-scroll-hint {
        margin-top: 1rem;
    }

    .project-overlay {
        transform: translateY(0);
        padding: 1.25rem;
        background: linear-gradient(transparent 0%, rgba(10, 10, 10, 0.95) 30%);
    }

    .project-desc {
        opacity: 1;
        font-size: 0.68rem;
        line-height: 1.4;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .project-title {
        font-size: 0.95rem;
        margin-bottom: 0.3rem;
    }

    .project-type {
        font-size: 0.55rem;
        margin-bottom: 0.3rem;
    }

    .project-tags span {
        font-size: 0.55rem;
        padding: 3px 8px;
    }

    .project-view-btn {
        display: none;
    }
}

/* === Project Page Mobile === */
@media (max-width: 640px) {
    .project-hero {
        height: 45vh;
    }

    .project-hero-overlay {
        padding: 1.5rem;
    }

    .project-hero-title {
        font-size: 1.5rem;
        letter-spacing: -1px;
    }

    .project-content {
        padding: 2rem 1.25rem;
    }

    .project-meta {
        gap: 1rem;
    }

    .project-meta-item {
        font-size: 0.72rem;
    }

    .project-body {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .project-gallery {
        padding: 0 1.25rem 2rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .gallery-item {
        aspect-ratio: 16 / 9;
        border-radius: 10px;
        position: relative;
        cursor: pointer;
    }

    .gallery-item::after {
        content: "Открыть ↗";
        position: absolute;
        top: 8px;
        right: 8px;
        font-family: "JetBrains Mono", monospace;
        font-size: 0.48rem;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: rgba(240,237,229,0.75);
        background: rgba(10,10,10,0.6);
        backdrop-filter: blur(4px);
        padding: 4px 8px;
        border-radius: 6px;
        z-index: 2;
        pointer-events: none;
    }

    .footer {
        padding: 1.5rem 1rem;
        font-size: 0.75rem;
    }
}

/* === Noise texture overlay (lightweight PNG-based) === */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.04;
    background: repeating-conic-gradient(rgba(240,237,229,0.03) 0% 25%, transparent 0% 50%) 0 0 / 4px 4px;
}

/* === Selection === */
::selection {
    background: var(--cloud);
    color: var(--black);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--black);
}

::-webkit-scrollbar-thumb {
    background: var(--black-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cloud-muted);
}

/* ============================================
   Project Screenshots — Bento Grid
   ============================================ */

/* Fixed viewport height — all 4 cards visible without page scroll */
.ss-bento {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(10, 1fr);
    height: 82vh;
    min-height: 520px;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 1rem;
}

/* === Layout: Full (desktop + mobile) === */
.layout-full .ss-card-desktop { grid-column: 1 / 8; grid-row: 1 / 11; }
.layout-full .ss-card-mobile  { grid-column: 8 / 13; grid-row: 1 / 11; }
.layout-full.has-logo .ss-card-logo       { grid-column: 8 / 11; grid-row: 1 / 3; }
.layout-full.has-favicon .ss-card-favicon  { grid-column: 11 / 13; grid-row: 1 / 3; }
.layout-full.has-logo .ss-card-mobile,
.layout-full.has-favicon .ss-card-mobile   { grid-row: 3 / 11; }
.layout-full.has-logo:not(.has-favicon) .ss-card-logo { grid-column: 8 / 13; }
.layout-full:not(.has-logo).has-favicon .ss-card-favicon { grid-column: 8 / 13; }

/* === Layout: Desktop only === */
.layout-desktop .ss-card-desktop { grid-column: 1 / 13; grid-row: 1 / 11; }
.layout-desktop.has-logo .ss-card-desktop,
.layout-desktop.has-favicon .ss-card-desktop { grid-column: 1 / 10; }
.layout-desktop.has-logo .ss-card-logo       { grid-column: 10 / 13; grid-row: 1 / 6; }
.layout-desktop.has-favicon .ss-card-favicon  { grid-column: 10 / 13; grid-row: 6 / 11; }
.layout-desktop.has-logo:not(.has-favicon) .ss-card-logo { grid-row: 1 / 11; }
.layout-desktop:not(.has-logo).has-favicon .ss-card-favicon { grid-row: 1 / 11; }

/* === Layout: Mobile only === */
.layout-mobile .ss-card-mobile { grid-column: 3 / 11; grid-row: 1 / 11; }
.layout-mobile.has-logo .ss-card-mobile { grid-column: 4 / 10; }
.layout-mobile.has-logo .ss-card-logo      { grid-column: 1 / 4; grid-row: 3 / 9; }
.layout-mobile.has-favicon .ss-card-mobile { grid-column: 4 / 10; }
.layout-mobile.has-favicon .ss-card-favicon { grid-column: 10 / 13; grid-row: 3 / 9; }

/* === Layout: Meta only (no screenshots) === */
.layout-meta { height: 40vh; min-height: 300px; }
.layout-meta .ss-card-logo    { grid-column: 3 / 7; grid-row: 1 / 11; }
.layout-meta .ss-card-favicon { grid-column: 7 / 11; grid-row: 2 / 10; }
.layout-meta:not(.has-favicon) .ss-card-logo { grid-column: 4 / 10; }
.layout-meta:not(.has-logo) .ss-card-favicon { grid-column: 4 / 10; }

/* Mobile card label */
.ss-card-mobile > .ss-label { text-align: center; padding: 0 0 0.3rem; }

.ss-card {
    background: var(--black-card);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s;
    position: relative;
}

.ss-card:hover { border-color: rgba(255,255,255,0.13); }

/* Hide labels on compact logo/favicon cards */
/* Logo & favicon labels — compact */
.ss-card-logo .ss-label, .ss-card-favicon .ss-label {
    padding: 0.45rem 0.8rem 0.2rem;
    font-size: 0.52rem;
}

.ss-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--cloud-muted);
    padding: 0.9rem 1.1rem 0.4rem;
    flex-shrink: 0;
}

/* Vertical scroll hint — desktop (absolute, right edge) */
.ss-scroll-label {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    z-index: 8;
}

/* Text part — vertical */
.ss-sl-text {
    writing-mode: vertical-rl;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(240,237,229,0.45);
    white-space: nowrap;
}

/* Arrow — stays horizontal so ↓ points DOWN */
.ss-sl-arrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: rgba(240,237,229,0.45);
    line-height: 1;
}

/* Mobile: label is a flex sibling inside ss-iphone-wrap — override absolute */
.ss-card-mobile .ss-scroll-label {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    align-self: center;
}

/* === DESKTOP === */
.ss-card-desktop { overflow: visible; }

/* Desktop: scroll label — absolute слева по центру, поверх браузера (z-index выше browser) */
.ss-card-desktop .ss-scroll-label {
    position: absolute;
    left: -20px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}


.ss-browser { display: flex; flex-direction: column; height: 100%; position: relative; z-index: 0; overflow: hidden; border-radius: 13px; }

.ss-browser-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 34px;
    padding: 0 14px;
    background: #161616;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.ss-browser-dots {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 15px 0 0 #ffbd2e, 30px 0 0 #28c840;
    flex-shrink: 0;
    margin-right: 16px;
}

.ss-browser-url {
    flex: 1;
    height: 19px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    color: rgba(240,237,229,0.3);
    line-height: 19px;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ss-desktop-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: ns-resize;
    background: #0a0a0a;
}

/* Scroll image: base */
.ss-scroll-img {
    width: 100%;
    height: auto;
    display: block;
    position: absolute;
    top: 0; left: 0;
    will-change: transform;
    pointer-events: none;
}

/* Desktop: zoom in so content is readable */
.ss-desktop-viewport .ss-scroll-img { width: 160%; }

.ss-scroll-hint {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(240,237,229,0.28);
    pointer-events: none;
    transition: opacity 0.4s;
    z-index: 5;
}

.ss-desktop-viewport.scrolled .ss-scroll-hint,
.ss-iphone-viewport.scrolled .ss-scroll-hint { opacity: 0; }

/* === LOGO — compact, image fills card === */
.ss-card-logo { cursor: zoom-in; }

.ss-logo-inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    min-height: 0;
}

.ss-logo-inner img {
    max-width: 150px;
    max-height: calc(100% - 1rem);
    width: auto; height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.6));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ss-card-logo:hover .ss-logo-inner img { transform: scale(1.1); }

/* === FAVICON — compact, image fills card === */
.ss-card-favicon { cursor: zoom-in; }

.ss-favicon-inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    min-height: 0;
}

.ss-favicon-inner img {
    max-width: 72px;
    max-height: calc(100% - 0.8rem);
    width: auto; height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

/* === MOBILE — PNG overlay, fills grid cell height === */
.ss-card-mobile {
    overflow: visible;
    background: transparent;
    border-color: transparent;
}

.ss-card-mobile:hover { border-color: transparent; }

/* Flex wrap: allows phone container to fill height */
.ss-iphone-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    gap: 8px;
    min-height: 0;
}

/* Phone container: height from grid cell, width from aspect-ratio */
.ss-phone-container {
    height: 100%;
    aspect-ratio: 365 / 750;
    max-width: 100%;
    position: relative;
}

/* Screenshot fills phone container */
.ss-iphone-viewport {
    position: absolute;
    inset: 1.5px;          /* 1.5px gap so screenshot never bleeds past overlay border */
    overflow: hidden;
    cursor: ns-resize;
    z-index: 1;
    border-radius: 12%;    /* match iPhone screen corner radius */
}

/* PNG overlay: sits on top, phone frame drawn in PNG */
.ss-phone-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    z-index: 2;
    pointer-events: none;
    user-select: none;
    display: block;
}


/* === Request Modal === */
/* === Request Modal (techy) === */
.request-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.request-overlay.active { display: flex; }

.request-modal {
    background: linear-gradient(135deg, #111 0%, #1A1A1A 100%);
    border: 1px solid rgba(240,237,229,0.06);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    margin: 1rem;
    position: relative;
    animation: reqSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 80px rgba(240,237,229,0.02);
}
@keyframes reqSlideIn {
    from { transform: translateY(30px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.request-close {
    position: absolute;
    top: 1.2rem; right: 1.4rem;
    background: none; border: none;
    color: var(--cloud-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
}
.request-close:hover { color: var(--cloud); transform: rotate(90deg); }

.request-header { margin-bottom: 1.8rem; }

.request-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: #44ff88;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 0.6rem;
}

.request-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--cloud);
    margin-bottom: 0.4rem;
    letter-spacing: -0.5px;
}

.request-subtitle {
    font-size: 0.8rem;
    color: var(--cloud-muted);
    font-weight: 400;
}

.request-field {
    margin-bottom: 1.4rem;
}
.request-field label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: #44ff88;
    letter-spacing: 1px;
    margin-bottom: 0.6rem;
}
.req-required {
    color: #ff4444;
    font-size: 0.6rem;
    margin-left: 4px;
}

.request-field input,
.request-field textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(240,237,229,0.08);
    border-radius: 10px;
    color: var(--cloud);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.request-field input:focus,
.request-field textarea:focus {
    border-color: rgba(68,255,136,0.4);
    box-shadow: 0 0 0 3px rgba(68,255,136,0.06);
}
.request-field input.valid {
    border-color: rgba(68,255,136,0.5);
}
.request-field input.invalid {
    border-color: rgba(255,68,68,0.5);
}
.request-field textarea { resize: vertical; min-height: 80px; }

/* Budget Chips */
.budget-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.budget-chip {
    padding: 8px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(240,237,229,0.1);
    border-radius: 20px;
    color: var(--cloud-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}
.budget-chip:hover {
    border-color: rgba(240,237,229,0.3);
    color: var(--cloud);
    background: rgba(255,255,255,0.06);
}
.budget-chip.active {
    background: var(--cloud);
    color: #0A0A0A;
    border-color: var(--cloud);
    font-weight: 500;
}

/* Validation hints */
.req-hint {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    margin-top: 0.4rem;
    height: 1em;
    transition: color 0.3s;
}
.req-hint.valid { color: #44ff88; }
.req-hint.invalid { color: #ff4444; }

/* Submit button */
.request-submit {
    width: 100%;
    padding: 14px;
    background: var(--cloud);
    color: #0A0A0A;
    border: none;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
}
.request-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(240,237,229,0.15);
}
.request-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.req-btn-arrow {
    transition: transform 0.3s;
}
.request-submit:hover .req-btn-arrow {
    transform: translateX(4px);
}

/* Status messages */
#reqStatus {
    text-align: center;
    margin-top: 0.8rem;
    font-size: 0.85rem;
}
.req-success { color: #44ff88; }
.req-error { color: #ff4444; }

/* Admin */
.upload-zone-sm { min-height: 80px !important; padding: 1rem !important; }
.upload-zone-sm p { font-size: 0.75rem !important; }

/* ── Responsive: tablet (≤1000px) ── */
@media (max-width: 1000px) {
    .ss-bento {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-auto-rows: unset;
        height: auto;
        min-height: unset;
        gap: 6px;
        padding: 0 1.25rem 1rem;
    }

    /* All cards: compact preview tiles */
    .ss-bento .ss-card {
        height: 120px;
        cursor: pointer;
        border-radius: 10px;
    }

    /* All cards full width — !important to override layout-specific selectors */
    .ss-bento .ss-card-desktop,
    .ss-bento .ss-card-mobile,
    .ss-bento .ss-card-logo,
    .ss-bento .ss-card-favicon { grid-column: 1 / -1 !important; grid-row: auto !important; }

    /* Hide all mockup chrome */
    .ss-browser-bar,
    .ss-phone-overlay,
    .ss-scroll-label,
    .ss-scroll-hint { display: none !important; }

    /* Screenshots as cover thumbnails */
    .ss-scroll-img {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
        object-position: top center;
    }

    .ss-desktop-viewport,
    .ss-iphone-viewport {
        position: relative;
        inset: unset;
        height: 100%;
        overflow: hidden !important;
        cursor: pointer;
        border-radius: 0;
        touch-action: manipulation;
    }

    .ss-browser {
        height: 100%;
        border-radius: 0;
    }

    .ss-iphone-wrap {
        height: 100%;
        padding: 0;
        gap: 0;
    }

    .ss-phone-container {
        width: 100%;
        height: 100%;
        aspect-ratio: unset;
    }

    /* Label at bottom with gradient */
    .ss-card .ss-label {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        padding: 20px 10px 8px;
        background: linear-gradient(transparent, rgba(10,10,10,0.85));
        z-index: 5;
        font-size: 0.52rem;
        letter-spacing: 2px;
    }

    /* Mobile label — left-align like others */
    .ss-card-mobile > .ss-label { text-align: left; }

    /* Open badge */
    .ss-card::after {
        content: 'Открыть ↗';
        position: absolute;
        top: 8px;
        right: 8px;
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.48rem;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: rgba(240,237,229,0.75);
        background: rgba(10,10,10,0.6);
        backdrop-filter: blur(4px);
        padding: 4px 8px;
        border-radius: 6px;
        z-index: 6;
        pointer-events: none;
    }

    /* Logo/favicon inner */
    .ss-logo-inner, .ss-favicon-inner {
        height: 100%;
    }
    .ss-logo-inner img { max-width: 70px; max-height: 80px; }
    .ss-favicon-inner img { max-width: 44px; max-height: 44px; }
}

/* === Screenshot Viewer (telegra.ph style) === */
.ss-viewer {
    position: fixed;
    inset: 0;
    background: var(--black);
    z-index: 10001;
    display: none;
    flex-direction: column;
}
.ss-viewer.active { display: flex; }

.ss-viewer-close {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px 20px;
    background: rgba(10,10,10,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-bottom: 1px solid rgba(240,237,229,0.08);
    color: var(--cloud);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-align: left;
    cursor: pointer;
    flex-shrink: 0;
}

.ss-viewer-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ss-viewer-scroll img {
    width: 100%;
    height: auto;
    display: block;
}
