/* ================================================
   RESET & BASE
   ================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(123, 47, 247, 0.45) transparent;
}

body {
    font-family: 'VT323', monospace;
    color: #fff;
    background: #000;
    overflow-x: hidden;
}

/* ================================================
   GLOBAL VIDEO BACKGROUND
   Wrapper is position:fixed. Video is absolute inside.
   This pattern avoids iOS Safari bugs with fixed videos.
   ================================================ */
.global-video-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    overflow: hidden;
    pointer-events: none;
}
.global-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

/* ================================================
   SCROLLBAR
   ================================================ */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(123, 47, 247, 0.45);
    border-radius: 3px;
}

/* ================================================
   NAVBAR
   position: fixed — does NOT affect document flow,
   so no reflow/trembling on hide/show.
   Gradient dark bg for readability over bright video.
   14px font, full white, text-shadow for contrast.
   ================================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 40px;
    height: 52px;
    background: transparent;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    /* Smooth hide/show without layout shift */
    transition: opacity 0.4s ease;
    /* GPU layer to prevent reflow */
    will-change: opacity;
    transform: translateZ(0);
}

.navbar.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Brand logo */
.nav-brand {
    position: absolute;
    left: 40px;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.nav-brand:hover {
    opacity: 0.7;
}

.nav-logo {
    height: 54px;
    width: auto;
    image-rendering: pixelated;
}

/* Nav links container */
.nav-links {
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav-link {
    position: relative;
    font-family: 'Press Start 2P', cursive;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 4px 0 6px;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #b44dff;
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover {
    color: #fff;
}

.nav-link:hover::after {
    width: 100%;
    left: 0;
}

/* ================================================
   SECTIONS — Full viewport height
   ================================================ */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================================================
   SECTION 1: HOME
   ================================================ */
#home {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 20vh;
    gap: 40px;
}

/* ---- Hero title (PNG image) ---- */
.title-container {
    position: relative;
    display: inline-block;
    overflow: hidden;
    -webkit-animation: heroAppear 0.8s ease 0.2s both;
    animation: heroAppear 0.8s ease 0.2s both;
    /* Clip shine to letter shapes */
    -webkit-mask-image: url('assets/images/title.png');
    mask-image: url('assets/images/title.png');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.title-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 20%,
        rgba(255, 255, 255, 0.25) 35%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0.25) 65%,
        transparent 80%
    );
    -webkit-transform: skewX(-15deg);
    transform: skewX(-15deg);
    -webkit-animation: shine 6s ease-in-out infinite;
    animation: shine 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shine {
    0%   { left: -100%; opacity: 0; }
    10%  { opacity: 1; }
    60%  { left: 150%; opacity: 1; }
    70%  { opacity: 0; }
    100% { opacity: 0; left: 150%; }
}

.hero-title {
    width: clamp(300px, 60vw, 650px);
    height: auto;
    display: block;
    /* Crisp pixel rendering */
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
    /* Subtle drop shadow */
    filter: drop-shadow(0 4px 12px rgba(40, 10, 80, 0.4));
    /* Prevent drag/select */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
}

@keyframes heroAppear {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.scroll-indicator {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 1;
    -webkit-animation: bounce 2s infinite ease-in-out;
    animation: bounce 2s infinite ease-in-out;
    cursor: pointer;
    transition: opacity 0.5s ease;
}

.scroll-indicator.hidden-indicator {
    opacity: 0;
    pointer-events: none;
}

.scroll-arrow {
    width: 36px;
    height: 36px;
    color: #ffffff;
    filter: drop-shadow(0 0 16px rgba(255, 255, 255, 1)) drop-shadow(0 2px 6px rgba(0,0,0,0.9));
    transition: filter 0.3s ease;
}

.scroll-indicator:hover .scroll-arrow {
    filter: drop-shadow(0 0 18px rgba(255, 255, 255, 1)) drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-5px);
    }
    60% {
        transform: translateX(-50%) translateY(-3px);
    }
}

/* ================================================
   SECTION 2: SKILLS — Retro arcade panel
   ================================================ */
.skills-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ---- Retro panel with double-border depth ---- */
.retro-panel {
    position: relative;
    background: rgba(12, 8, 32, 0.9);
    /* Double border effect: outer dark, inner via box-shadow */
    border: 6px solid #2a1c50;
    border-radius: 8px;
    padding: 36px 40px 40px;
    max-width: 920px;
    width: 100%;
    box-shadow:
        /* Inner light border */
        inset 0 0 0 3px rgba(140, 100, 220, 0.35),
        /* Outer glow */
        0 0 0 2px rgba(60, 35, 120, 0.5),
        0 0 40px rgba(80, 40, 160, 0.15),
        inset 0 0 60px rgba(60, 30, 120, 0.06);
}

/* Top gradient decorative line */
.retro-panel::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(180, 140, 255, 0.4), transparent);
    z-index: 1;
}

/* Bottom gradient decorative line */
.retro-panel::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(120, 80, 200, 0.25), transparent);
    z-index: 1;
}

/* ---- Pixel corner decorations (squares) ---- */
.corner-deco {
    position: absolute;
    width: 10px;
    height: 10px;
    z-index: 2;
}

.corner-deco::before,
.corner-deco::after {
    content: '';
    position: absolute;
    background: #7b52c4;
}

/* Each corner: two small squares stacked */
.corner-deco::before {
    width: 6px;
    height: 6px;
}

.corner-deco::after {
    width: 4px;
    height: 4px;
}

.corner-tl { top: 6px; left: 6px; }
.corner-tl::before { top: 0; left: 0; }
.corner-tl::after { top: 7px; left: 7px; }

.corner-tr { top: 6px; right: 6px; }
.corner-tr::before { top: 0; right: 0; }
.corner-tr::after { top: 7px; right: 7px; }

.corner-bl { bottom: 6px; left: 6px; }
.corner-bl::before { bottom: 0; left: 0; }
.corner-bl::after { bottom: 7px; left: 7px; }

.corner-br { bottom: 6px; right: 6px; }
.corner-br::before { bottom: 0; right: 0; }
.corner-br::after { bottom: 7px; right: 7px; }

/* ---- Panel title ---- */
.panel-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(18px, 3vw, 28px);
    text-align: center;
    color: #fff;
    margin-bottom: 32px;
    text-shadow:
        2px 2px 0 #5a3490,
        0 0 16px rgba(140, 100, 255, 0.25);
    letter-spacing: 2px;
}

/* ---- Cards grid (6 columns) ---- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

/* Top row: 3 cards, each spans 2 cols */
.retro-card:nth-child(1) { grid-column: 1 / 3; }
.retro-card:nth-child(2) { grid-column: 3 / 5; }
.retro-card:nth-child(3) { grid-column: 5 / 7; }

/* Bottom row: 2 cards centered */
.retro-card:nth-child(4) { grid-column: 2 / 4; }
.retro-card:nth-child(5) { grid-column: 4 / 6; }

/* ---- Individual card ---- */
.retro-card {
    background: rgba(20, 14, 50, 0.92);
    border: 3px solid #5a3e8e;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    /* Inner border for depth */
    box-shadow: inset 0 0 0 1px rgba(120, 80, 200, 0.2);
    /* Scroll animation: hidden */
    opacity: 0;
    transform: translateY(24px);
}

.retro-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays */
.retro-card:nth-child(1) { transition-delay: 0.05s; }
.retro-card:nth-child(2) { transition-delay: 0.12s; }
.retro-card:nth-child(3) { transition-delay: 0.19s; }
.retro-card:nth-child(4) { transition-delay: 0.26s; }
.retro-card:nth-child(5) { transition-delay: 0.33s; }

/* Card hover */
.retro-card:hover {
    transform: translateY(-4px);
    border-color: #8b62d4;
    box-shadow:
        inset 0 0 0 1px rgba(140, 100, 230, 0.3),
        0 6px 24px rgba(100, 50, 200, 0.25);
}

/* ---- Card title bar — prominent retro window ---- */
.card-titlebar {
    font-family: 'Press Start 2P', cursive;
    font-size: 7px;
    color: rgba(255, 255, 255, 0.8);
    background: linear-gradient(180deg, #6a4ea0, #4a3280);
    padding: 8px 12px;
    border-bottom: 3px solid #3a2468;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Subtle inner highlight */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---- Card body ---- */
.card-body {
    padding: 18px 14px 20px;
    text-align: center;
}

/* ---- Logo placeholder ---- */
.card-logo-placeholder {
    width: 100%;
    height: 140px; /* Altezza nettamente aumentata per far risaltare loghi grandi */
    margin: 0 auto 18px; /* Leggermente più margine inferiore */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    overflow: hidden;
}

.skill-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Mantiene le proporzioni */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4)); /* Piccolo tocco per distinguerlo */
}

.card-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 9px;
    color: #e0d4f5;
    margin-bottom: 10px;
    line-height: 1.6;
}

.card-desc {
    font-family: 'VT323', monospace;
    font-size: 17px;
    color: #b0a0cc;
    line-height: 1.25;
}

/* ================================================
   SECTION 3: PROJECTS — Retro arcade panel
   ================================================ */
.projects-panel {
    max-width: 1100px;
    padding: 40px 44px 48px;
}

.project-card {
    background: rgba(20, 14, 50, 0.92);
    border: 3px solid #5a3e8e;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(120, 80, 200, 0.2);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.project-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Project sections ---- */
.project-section {
    padding: 28px 32px;
}

.project-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(140, 100, 220, 0.3), transparent);
    margin: 0 32px;
}

.section-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 11px;
    color: #b48dff;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(180, 140, 255, 0.2);
}

.project-section-row {
    display: flex;
    gap: 32px;
    align-items: center;
}

.project-section-row.reverse {
    flex-direction: row-reverse;
}

.project-preview {
    flex-shrink: 0;
    width: 52%;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #3a2468;
}

.project-screenshot {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
    transition: filter 0.2s ease;
}

.project-screenshot:hover {
    filter: brightness(1.1);
}

/* ---- Lightbox ---- */
.lightbox {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-img {
    max-width: 85vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-img {
    transform: scale(1);
}

.project-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.project-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #e0d4f5;
    line-height: 1.6;
}

.project-desc {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: #b0a0cc;
    line-height: 1.4;
}

/* ---- Feature list ---- */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b62d4;
    flex-shrink: 0;
}

.feature-dot.dot-green { background: #34d399; }
.feature-dot.dot-purple { background: #a855f7; }
.feature-dot.dot-gold { background: #f0a020; }

.feature-text {
    font-family: 'VT323', monospace;
    font-size: 17px;
    color: #c0b0e0;
    line-height: 1.3;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tag {
    font-family: 'Press Start 2P', cursive;
    font-size: 7px;
    color: #c0b0e0;
    background: rgba(100, 60, 180, 0.25);
    border: 1px solid rgba(140, 100, 220, 0.3);
    border-radius: 4px;
    padding: 5px 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.project-link {
    display: inline-block;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #1a1030;
    background: linear-gradient(90deg, #f0a020, #f7c948);
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    align-self: flex-start;
}

.project-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 166, 35, 0.35);
}

/* ================================================
   SECTION 4: CONTACT — iPad with Gmail
   ================================================ */
.contact-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ---- Wrapper: pencil + iPad side by side ---- */
.ipad-wrapper {
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.ipad-wrapper.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Apple Pencil (vertical, left) ---- */
.apple-pencil {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: -3px;
    z-index: 2;
}
.pencil-cap {
    width: 12px;
    height: 14px;
    background: linear-gradient(90deg, #e0e0e0, #f0f0f0, #d5d5d5);
    border-radius: 6px 6px 0 0;
}
.pencil-body {
    width: 12px;
    height: 280px;
    background: linear-gradient(90deg, #e8e8e8 0%, #fff 30%, #f5f5f5 70%, #d8d8d8 100%);
    border-radius: 6px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.3);
}
.pencil-tip {
    width: 8px;
    height: 16px;
    background: linear-gradient(90deg, #aaa, #c0c0c0);
    -webkit-clip-path: polygon(20% 0%, 80% 0%, 50% 100%);
    clip-path: polygon(20% 0%, 80% 0%, 50% 100%);
}

/* ---- iPad chassis ---- */
.ipad {
    background: #2c2c32;
    border-radius: 20px;
    padding: 14px;
    max-width: 620px;
    width: 100%;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.6),
        0 0 0 1px rgba(100,100,110,0.3);
}

/* Screen — white fills the entire rounded area, no gaps */
.ipad-screen {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Camera — on the bezel, not screen */
.ipad-cam {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3a3a42;
    border: 1px solid #444;
    z-index: 5;
}

/* ---- Gmail Toolbar ---- */
.gmail-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.gmail-menu {
    display: flex;
    align-items: center;
    padding: 4px;
}
.gmail-logo { flex-shrink: 0; }
.gmail-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eaf1fb;
    border-radius: 8px;
    padding: 8px 14px;
}
.gmail-search span {
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 14px;
    color: #5f6368;
}

/* ---- Gmail Compose ---- */
.gmail-compose {
    margin: 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    overflow: hidden;
    flex-shrink: 0;
}
.compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #404040;
    color: #fff;
}
.compose-title {
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
}
.compose-actions { display: flex; gap: 12px; }
.compose-btn {
    font-size: 14px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.compose-btn:hover { opacity: 1; }

/* ---- Form (Gmail style) ---- */
.contact-form { padding: 0; }
.gmail-field {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid #e0e0e0;
}
.gmail-field label {
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 14px;
    color: #5f6368;
    min-width: 55px;
    flex-shrink: 0;
}
.gmail-field input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 16px;
    color: #202124;
    background: transparent;
    padding: 4px 8px;
    /* iOS: prevent zoom on focus */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}
.gmail-field input::placeholder { color: #bbb; }
.gmail-body { padding: 16px; }
.gmail-body textarea {
    width: 100%;
    border: none;
    outline: none;
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 16px;
    color: #202124;
    background: transparent;
    resize: none;
    min-height: 120px;
    /* iOS: prevent zoom on focus */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}
.gmail-body textarea::placeholder { color: #bbb; }

/* ---- Send button ---- */
.compose-footer {
    padding: 12px 16px;
    display: flex;
    align-items: center;
}
.gmail-send {
    background: #0b57d0;
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 8px 24px;
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.gmail-send:hover {
    background: #0842a0;
    box-shadow: 0 2px 8px rgba(11,87,208,0.3);
}
.gmail-send:active { background: #063489; }

/* ---- Banner with IG overlay ---- */
.banner-wrapper {
    position: relative;
    flex-shrink: 0;
    margin: 0 16px 16px;
}
.phone-banner {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    image-rendering: pixelated;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
.banner-ig {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
.banner-ig:hover {
    transform: translate(-50%, -50%) scale(1.15);
}
.instagram-icon {
    filter: drop-shadow(0 0 6px rgba(220,39,67,0.5));
}

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

/* ≤768px */
@media (max-width: 768px) {
    .navbar {
        padding: 0 20px;
        height: 46px;
    }

    .nav-logo {
        height: 28px;
    }

    .nav-links {
        gap: 24px;
    }

    .nav-brand {
        left: 20px;
    }

    .nav-link {
        font-size: 10px;
        letter-spacing: 2px;
    }

    .retro-panel {
        padding: 24px 16px 28px;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .retro-card:nth-child(1),
    .retro-card:nth-child(2),
    .retro-card:nth-child(3),
    .retro-card:nth-child(4),
    .retro-card:nth-child(5) {
        grid-column: auto;
    }

    .panel-title {
        font-size: 16px;
        margin-bottom: 20px;
    }

    .project-section-row,
    .project-section-row.reverse {
        flex-direction: column;
    }

    .project-preview {
        width: 100%;
    }

    .project-section {
        padding: 20px;
    }

    .ipad {
        max-width: 440px;
    }

    .pencil-body {
        height: 220px;
    }

    .hero-title {
        width: clamp(220px, 55vw, 400px);
    }
}

/* ≤480px */
@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .retro-card:nth-child(1),
    .retro-card:nth-child(2),
    .retro-card:nth-child(3),
    .retro-card:nth-child(4),
    .retro-card:nth-child(5) {
        grid-column: auto;
    }

    .apple-pencil {
        display: none;
    }

    .ipad {
        max-width: 100%;
    }

    .project-name {
        font-size: 11px;
    }

    .hero-title {
        width: clamp(180px, 70vw, 300px);
    }

    #home {
        gap: 30px;
    }
}

/* ================================================
   INTRO CINEMATIC OVERLAY
   ================================================ */
#intro-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#intro-overlay.done {
    opacity: 0;
    pointer-events: none;
    -webkit-transition: opacity 2s ease-in-out;
    transition: opacity 2s ease-in-out;
}
#intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================================================
   CAR HOTSPOT — clickable area on hero car door
   ================================================ */
.car-hotspot {
    position: fixed;
    left: 20%;
    bottom: 8%;
    width: 32%;
    height: 35%;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-decoration: none;
    border: none;
    border-radius: 0;
    -webkit-transition: opacity 0.4s ease;
    transition: opacity 0.4s ease;
}
.car-outline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 4;
    filter: brightness(0) invert(1);
    image-rendering: pixelated;
}
.car-outline.visible {
    opacity: 0.5;
}
.car-marker {
    position: absolute;
    top: 15px;
    left: 40%;
    transform: translateX(-50%);
    pointer-events: none;
    -webkit-animation: markerFloat 2s ease-in-out infinite;
    animation: markerFloat 2s ease-in-out infinite;
}
.car-marker-icon {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 34px solid rgba(150, 80, 220, 0.9);
    filter: drop-shadow(0 0 6px rgba(150, 80, 220, 0.4));
}
@keyframes markerFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-10px); }
}
.car-hotspot.scrolled-away {
    opacity: 0;
    pointer-events: none;
}
.car-hotspot:hover .car-marker-icon {
    border-top-color: rgba(180, 100, 255, 1);
    filter: drop-shadow(0 0 10px rgba(150, 80, 220, 0.6));
}
.car-hotspot-hint {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.3s ease-out;
    pointer-events: none;
    white-space: nowrap;
}
.gta-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 32px;
    padding: 0 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 0 12px rgba(150, 80, 220, 0.5), inset 0 0 6px rgba(150, 80, 220, 0.2);
}
.gta-prompt-text {
    font-family: 'VT323', monospace;
    font-size: 26px;
    color: #fff;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.4), 0 0 24px rgba(150, 80, 220, 0.5), 0 2px 4px rgba(0, 0, 0, 0.9);
}
.car-hotspot:hover .car-hotspot-hint {
    opacity: 1;
}
/* Touch devices & small screens: always visible with breathing animation */
.touch-device .car-hotspot-hint,
.mobile-hint-visible .car-hotspot-hint {
    opacity: 1;
    bottom: -10px;
    transform: translateX(-75%);
    animation: gtaBreath 2.5s ease-in-out infinite;
}
.touch-device .gta-prompt-text,
.mobile-hint-visible .gta-prompt-text {
    font-size: 20px;
    letter-spacing: 2px;
}
.touch-device .gta-key,
.mobile-hint-visible .gta-key {
    min-width: 36px;
    height: 28px;
    font-size: 16px;
}
.touch-device .scroll-arrow {
    width: 30px;
    height: 30px;
}
@media (max-height: 500px) {
    .scroll-arrow {
        width: 18px;
        height: 18px;
    }
    .car-hotspot-hint {
        opacity: 1 !important;
        bottom: -6px;
        transform: translateX(-75%);
        animation: gtaBreath 2.5s ease-in-out infinite;
        gap: 6px;
    }
    .gta-prompt-text {
        font-size: 12px;
        letter-spacing: 1px;
    }
    .gta-key {
        min-width: 24px;
        height: 18px;
        font-size: 10px;
        padding: 0 4px;
        border-width: 1.5px;
    }
}
@media (max-width: 768px) {
    .scroll-arrow {
        width: 22px;
        height: 22px;
    }
    .car-hotspot-hint {
        opacity: 1 !important;
        bottom: -10px;
        transform: translateX(-75%);
        animation: gtaBreath 2.5s ease-in-out infinite;
    }
    .gta-prompt-text {
        font-size: 15px;
        letter-spacing: 1px;
    }
    .gta-key {
        min-width: 30px;
        height: 22px;
        font-size: 12px;
        padding: 0 5px;
    }
}
@keyframes gtaBreath {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

/* ================================================
   CONTACT SCENE — GTA-style cutscene overlay
   ================================================ */
.contact-scene {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 5000;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.contact-scene.active {
    display: flex;
    animation: sceneFadeIn 0.5s ease-out;
}
@keyframes sceneFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.contact-scene-bg,
.contact-scene-video {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}
.contact-scene-video {
    opacity: 0;
    transition: opacity 0.3s;
}
.contact-scene.ringing .contact-scene-video,
.contact-scene.showing-form .contact-scene-video {
    opacity: 1;
}
.contact-scene.ringing .contact-scene-bg,
.contact-scene.showing-form .contact-scene-bg {
    opacity: 0;
}

.phone-hotspot {
    position: absolute;
    left: 38%;
    top: 45%;
    width: 24%;
    height: 30%;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    padding: 0;
}
.contact-scene.ringing .phone-hotspot,
.contact-scene.showing-form .phone-hotspot {
    display: none;
}

.contact-scene-caption {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'VT323', monospace;
    font-size: 36px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 14px 28px;
    border-radius: 6px;
    letter-spacing: 4px;
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.4), 0 0 30px rgba(255, 50, 180, 0.4);
    z-index: 15;
    text-align: center;
    white-space: nowrap;
    -webkit-animation: captionFloat 2s ease-in-out infinite;
    animation: captionFloat 2s ease-in-out infinite;
}
@keyframes captionFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-4px); }
}
.caption-arrow {
    display: inline-block;
    margin-left: 8px;
    color: #ff32b4;
    -webkit-animation: arrowBounce 1s ease-in-out infinite;
    animation: arrowBounce 1s ease-in-out infinite;
}
@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(4px); }
}
.contact-scene.ringing .contact-scene-caption,
.contact-scene.showing-form .contact-scene-caption {
    display: none;
}

.contact-scene-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    z-index: 20;
    font-family: system-ui, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.contact-scene-close:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 50, 180, 0.25);
    transform: scale(1.1);
}

.gmail-container {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 12;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease-in-out;
    max-width: 580px;
    width: 40%;
}
.contact-scene.showing-form .gmail-container {
    opacity: 1;
    pointer-events: auto;
}
.gmail-container .ipad-wrapper {
    opacity: 1;
    transform: none;
}

@media (max-width: 600px) {
    .contact-scene-caption { font-size: 10px; padding: 10px 14px; }
    .contact-scene-close { width: 36px; height: 36px; font-size: 16px; top: 12px; right: 12px; }
}

/* ================================================
   ROTATE SCREEN OVERLAY — mobile portrait only
   ================================================ */
.rotate-screen {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}
.rotate-icon {
    width: 60px;
    height: 90px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    position: relative;
    -webkit-animation: rotateDevice 2.5s ease-in-out infinite;
    animation: rotateDevice 2.5s ease-in-out infinite;
}
.rotate-icon::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}
.rotate-icon::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}
@-webkit-keyframes rotateDevice {
    0%   { -webkit-transform: rotate(0deg); opacity: 1; }
    30%  { -webkit-transform: rotate(0deg); opacity: 1; }
    50%  { -webkit-transform: rotate(-90deg); opacity: 0.6; }
    70%  { -webkit-transform: rotate(-90deg); opacity: 1; }
    100% { -webkit-transform: rotate(0deg); opacity: 1; }
}
@keyframes rotateDevice {
    0%   { transform: rotate(0deg); opacity: 1; }
    30%  { transform: rotate(0deg); opacity: 1; }
    50%  { transform: rotate(-90deg); opacity: 0.6; }
    70%  { transform: rotate(-90deg); opacity: 1; }
    100% { transform: rotate(0deg); opacity: 1; }
}
.rotate-text {
    font-family: 'VT323', monospace;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 3px;
    text-align: center;
    padding: 0 30px;
    line-height: 1.6;
}

@media (max-width: 932px) and (orientation: portrait) {
    .rotate-screen { display: flex; }
}

/* ================================================
   MOBILE LANDSCAPE — smaller elements
   ================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .global-video-bg {
        object-fit: cover;
        object-position: center center;
    }
    .hero-title {
        width: clamp(100px, 25vw, 160px);
    }
    .scroll-arrow {
        width: 28px;
        height: 28px;
    }
    .scroll-indicator {
        bottom: 6px;
    }
    .car-marker-icon {
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 16px solid rgba(150, 80, 220, 0.9);
    }
    .gta-prompt-text {
        font-size: 16px;
        letter-spacing: 1px;
    }
    .gta-key {
        min-width: 30px;
        height: 24px;
        font-size: 13px;
    }
    .car-hotspot {
        bottom: 5%;
    }
    .contact-scene-caption {
        font-size: 20px;
        padding: 6px 14px;
        top: 38%;
    }
    .gmail-container {
        max-width: 280px;
        width: 35%;
        right: 10%;
        top: 48%;
        transform: translateY(-50%) scale(0.65);
        transform-origin: center center;
    }
    .gmail-search {
        display: none;
    }
}
