/* ============================================================
   VARIABILI TEMA — Light & Dark
   ============================================================ */
:root,
[data-theme="light"] {
    --bg:           #f8f9fc;
    --bg-alt:       #f0f2f8;
    --surface:      #ffffff;
    --surface-2:    #f4f5f9;
    --border:       #e2e5ef;
    --text:         #0f1117;
    --text-muted:   #6b7280;
    --text-light:   #9ca3af;
    --primary:      #4f46e5;
    --primary-hover:#4338ca;
    --primary-light:#eef2ff;
    --accent:       #06b6d4;
    --success:      #10b981;
    --success-bg:   #d1fae5;
    --error:        #ef4444;
    --error-bg:     #fee2e2;
    --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.10);
    --radius:       12px;
    --radius-sm:    8px;
    --radius-lg:    20px;
}

[data-theme="dark"] {
    --bg:           #0d0f16;
    --bg-alt:       #111420;
    --surface:      #161927;
    --surface-2:    #1c2033;
    --border:       #252a3d;
    --text:         #e8eaf0;
    --text-muted:   #8b92a9;
    --text-light:   #555e7a;
    --primary:      #6366f1;
    --primary-hover:#818cf8;
    --primary-light:#1e2040;
    --accent:       #22d3ee;
    --success:      #34d399;
    --success-bg:   #064e3b;
    --error:        #f87171;
    --error-bg:     #7f1d1d;
    --shadow:       0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.4);
}

/* ── Palette Rosso ─────────────────────────────────────────── */
[data-palette="red"][data-theme="light"] {
    --primary:       #dc2626;
    --primary-hover: #b91c1c;
    --primary-light: #fee2e2;
    --accent:        #f97316;
}
[data-palette="red"][data-theme="dark"] {
    --primary:       #ef4444;
    --primary-hover: #f87171;
    --primary-light: #450a0a;
    --accent:        #fb923c;
}
/* ── Palette Verde ─────────────────────────────────────────── */
[data-palette="green"][data-theme="light"] {
    --primary:       #059669;
    --primary-hover: #047857;
    --primary-light: #d1fae5;
    --accent:        #0ea5e9;
}
[data-palette="green"][data-theme="dark"] {
    --primary:       #34d399;
    --primary-hover: #6ee7b7;
    --primary-light: #064e3b;
    --accent:        #38bdf8;
}
/* ── Palette Arancione ─────────────────────────────────────── */
[data-palette="orange"][data-theme="light"] {
    --primary:       #ea580c;
    --primary-hover: #c2410c;
    --primary-light: #fff7ed;
    --accent:        #eab308;
}
[data-palette="orange"][data-theme="dark"] {
    --primary:       #fb923c;
    --primary-hover: #fdba74;
    --primary-light: #431407;
    --accent:        #fbbf24;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    transition: background .3s ease, color .3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.main { flex: 1; }

/* ============================================================
   HEADER / NAV
   ============================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background .3s;
}

.nav {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 64px;
}

.nav-logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    margin-right: auto;
    white-space: nowrap;
}
.logo-bracket { color: var(--primary); }

.nav-links {
    display: flex;
    list-style: none;
    gap: 4px;
}

.nav-link {
    display: block;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all .2s;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--primary); background: var(--primary-light); }

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    cursor: pointer;
    color: var(--text-muted);
    transition: all .2s;
    flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--primary); }

[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="dark"]  .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: block; }

.nav-burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all .3s;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    padding: 80px 0 60px;
    overflow: hidden;
}

.hero .container {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 64px;
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--success-bg);
    color: var(--success);
    border-radius: 100px;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 24px;
}
.hero-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

.hero-title {
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 480px;
    margin-bottom: 36px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.stat { text-align: center; }
.stat-number {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}
.stat-label {
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* Code card */
.hero-visual { display: flex; justify-content: center; align-items: center; }

.code-card {
    width: 100%;
    max-width: 460px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.code-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.code-card-title {
    margin-left: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .8rem;
    color: var(--text-muted);
}

.code-block {
    margin: 0;
    padding: 24px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: .82rem;
    line-height: 1.8;
}

.code-keyword { color: #f472b6; }
.code-package { color: var(--accent); }
.code-string  { color: #86efac; }
.code-func    { color: #fbbf24; }
.code-comment { color: var(--text-light); font-style: italic; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79,70,229,.35);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   SEZIONI
   ============================================================ */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }

.section-header { text-align: center; margin-bottom: 56px; }

.section-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
}

.section-cta { text-align: center; margin-top: 48px; }

/* ============================================================
   SKILL CARDS
   ============================================================ */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.skill-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: all .25s;
    box-shadow: var(--shadow);
}
.skill-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }

.skill-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: .85rem;
}
.skill-go     { background: #00acd730; color: #00acd7; }
.skill-db     { background: #e8730030; color: #e87300; }
.skill-docker { background: #2496ed30; color: #2496ed; font-size: 1.3rem; }
.skill-api    { background: #f59e0b30; color: #d97706; }
.skill-redis  { background: #dc262630; color: #dc2626; font-size: 1.1rem; }
.skill-git    { background: #f9731630; color: #f97316; }
.skill-php    { background: #8892bf30; color: #8892bf; }
.skill-js     { background: #f7df1e30; color: #b8a000; }
.skill-css    { background: #264de430; color: #264de4; }
.skill-xojo   { background: #009b7730; color: #009b77; }
.skill-ddev   { background: #4caf5030; color: #388e3c; }
.skill-vb     { background: #00339930; color: #003399; }

.skill-name { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 10px; }

.skill-bar { height: 4px; background: var(--border); border-radius: 100px; overflow: hidden; }
.skill-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 100px; transition: width 1s ease; }

/* ============================================================
   PROJECT CARDS
   ============================================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}
.projects-grid-full {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: all .25s;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.project-card-img {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
}
.project-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.project-card:hover .project-card-img img { transform: scale(1.04); }
.project-badge-img {
    position: absolute;
    top: 10px;
    right: 10px;
}
.project-card-body {
    padding: 22px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}
.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.project-card:hover::before { opacity: .04; }
.project-card.featured { border-color: var(--primary); }

.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 22px 0;
}
.project-card-body {
    padding: 14px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.project-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.project-badge {
    padding: 3px 10px;
    background: var(--primary);
    color: #fff;
    border-radius: 100px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.project-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.project-desc {
    font-size: .88rem;
    color: var(--text-muted);
    line-height: 1.6;
    flex: 1;
}

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

.tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: .73rem;
    font-weight: 500;
    color: var(--text-muted);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 4px;
    transition: gap .2s;
}
.project-link:hover { gap: 10px; color: var(--primary-hover); }

/* Filter */
.projects-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}
.filter-btn {
    padding: 8px 20px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Empty state */
.empty-state { text-align: center; padding: 80px 0; color: var(--text-muted); }
.empty-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.3rem; margin-bottom: 8px; color: var(--text); }

/* ============================================================
   PAGE HERO
   ============================================================ */
.page-hero {
    padding: 72px 0 48px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.page-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 12px;
}
.page-subtitle { font-size: 1rem; color: var(--text-muted); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 64px;
    align-items: start;
}

.about-visual { display: flex; flex-direction: column; gap: 24px; align-items: center; }

.avatar-wrapper { position: relative; display: inline-block; }
.avatar {
    width: 140px;
    height: 140px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    position: relative;
    z-index: 1;
}
.avatar-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed var(--primary);
    opacity: .4;
    animation: rotate 20s linear infinite;
}
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.about-contact-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow);
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .88rem;
    color: var(--text-muted);
}
.contact-item svg { color: var(--primary); flex-shrink: 0; }

.about-content { padding-top: 8px; }
.about-heading { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 20px; }
.about-text { color: var(--text-muted); margin-bottom: 16px; font-size: .95rem; }
.about-actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 20px;
    padding-bottom: 40px;
    position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 24px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--bg-alt);
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.timeline-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.timeline-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.timeline-period { font-size: .8rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.timeline-company { font-size: .8rem; font-weight: 600; color: var(--primary); }
.timeline-role { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.timeline-desc { font-size: .88rem; color: var(--text-muted); margin-bottom: 12px; }
.timeline-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 64px;
    align-items: start;
}

.contact-info-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; }
.contact-info-text { color: var(--text-muted); font-size: .95rem; margin-bottom: 32px; }

.contact-methods { display: flex; flex-direction: column; gap: 16px; }
.contact-method {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}
.contact-method-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}
.contact-method-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.contact-method-value { font-size: .9rem; font-weight: 600; color: var(--text); }

/* Form */
.contact-form-wrapper { display: flex; flex-direction: column; gap: 0; }

.contact-form { display: flex; flex-direction: column; gap: 20px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label { font-size: .85rem; font-weight: 600; color: var(--text); }

.form-input, .form-textarea {
    padding: 12px 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: .9rem;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    outline: none;
}
.form-input:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-light); }
.form-textarea { resize: vertical; min-height: 140px; }

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 24px;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error   { background: var(--error-bg);   color: var(--error); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 28px 0;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.footer-copy { font-size: .85rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.footer-links a:hover { color: var(--primary); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .hero .container { grid-template-columns: 1fr; gap: 48px; }
    .hero-visual { order: -1; }
    .code-card { max-width: 100%; }
    .about-grid { grid-template-columns: 1fr; }
    .about-visual { flex-direction: row; align-items: flex-start; }
    .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 64px 0 0 0;
        background: var(--surface);
        padding: 24px;
        gap: 8px;
        z-index: 99;
        border-top: 1px solid var(--border);
    }
    .nav-burger { display: flex; }
    .form-row { grid-template-columns: 1fr; }
    .about-visual { flex-direction: column; align-items: center; }
    .hero-stats { flex-wrap: wrap; gap: 16px; }
    .stat-divider { display: none; }
    .projects-grid { grid-template-columns: 1fr; }
    .timeline-item { grid-template-columns: 20px 1fr; gap: 14px; }
}

/* ============================================================
   PROJECT DETAIL
   ============================================================ */
.detail-layout {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 56px;
    align-items: start;
}

.detail-gallery { display: flex; flex-direction: column; gap: 10px; }

.gallery-main {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: zoom-in;
    max-height: 240px;
}
.gallery-main--video { max-height: none; }

.gallery-main img {
    width: 100%;
    height: 100%;
    max-height: 240px;
    object-fit: cover;
    display: block;
    transition: transform .25s;
}
.gallery-main:hover img { transform: scale(1.03); }

.gallery-main-video {
    width: 100%;
    max-height: 380px;
    display: block;
    object-fit: contain;
    background: #000;
    pointer-events: none;
}

.gallery-video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.18);
    transition: background .2s;
}
.gallery-main:hover .gallery-video-overlay { background: rgba(0,0,0,.36); }

.gallery-video-play {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    box-shadow: 0 4px 24px rgba(0,0,0,.35);
    transition: transform .2s;
}
.gallery-main:hover .gallery-video-play { transform: scale(1.08); }

.gallery-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gallery-thumb-wrap {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: border-color .2s, transform .2s;
    opacity: .65;
    flex-shrink: 0;
}
.gallery-thumb-wrap:hover, .gallery-thumb-wrap.active {
    border-color: var(--primary);
    opacity: 1;
    transform: translateY(-2px);
}
.gallery-thumb {
    width: 56px;
    height: 42px;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.gallery-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.4);
}

.detail-content { padding-top: 4px; }
.detail-section { margin-bottom: 32px; }

.detail-heading {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--text);
}

.detail-text {
    font-size: .95rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: lbFadeIn .2s ease;
}
.lightbox.open { display: flex; }
@keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-img {
    max-width: 70vw;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
    cursor: default;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 28px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }

@media (max-width: 900px) {
    .detail-layout { grid-template-columns: 1fr; }
    .lightbox-img { max-width: 92vw; max-height: 80vh; }
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */

/* Login page */
.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.admin-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
}

.admin-login-logo {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.admin-login-subtitle {
    text-align: center;
    font-size: .88rem;
    color: var(--text-muted);
    margin-bottom: 36px;
}

/* Admin layout */
.admin-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-wrapper {
    display: flex;
    flex: 1;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    margin-bottom: 32px;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all .2s;
}

.admin-nav-link:hover { background: var(--surface-2); color: var(--text); }
.admin-nav-link.active { background: var(--primary-light); color: var(--primary); }

.admin-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.admin-logout { color: var(--error) !important; }
.admin-logout:hover { background: var(--error-bg) !important; }

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    min-height: 100vh;
}

.admin-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.admin-topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.admin-content {
    padding: 32px;
    flex: 1;
}

/* Admin table */
.admin-table-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.admin-table th {
    background: var(--surface-2);
    padding: 12px 16px;
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface-2); }

.admin-table .cell-id { width: 48px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: .8rem; }
.admin-table .cell-actions { width: 140px; text-align: right; }

/* Buttons sm & danger */
.btn-sm {
    padding: 6px 14px;
    font-size: .8rem;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background: var(--error-bg);
    color: var(--error);
    border-color: transparent;
}
.btn-danger:hover {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--primary);
}

/* Admin form */
.admin-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 720px;
    box-shadow: var(--shadow);
}

.admin-form { display: flex; flex-direction: column; gap: 20px; }
.admin-form-actions { display: flex; gap: 12px; padding-top: 8px; }

/* Badge featured */
.badge-featured {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary);
    color: #fff;
    border-radius: 100px;
    font-size: .72rem;
    font-weight: 700;
}
.badge-normal {
    display: inline-block;
    padding: 2px 8px;
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: 100px;
    font-size: .72rem;
}

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.admin-page-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

@media (max-width: 768px) {
    .admin-sidebar { display: none; }
    .admin-content { padding: 20px; }
    .admin-table .cell-actions { width: auto; }
}
