/* ============================================
   PERSIO DELLO SBARBA - Photography Website
   Minimalist B&W Design
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Inter:wght@300;400;500&display=swap');

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    background-color: #0a0a0a;
    color: #e0e0e0;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    letter-spacing: 0.08em;
    color: #f0f0f0;
}

h1 {
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

h2 {
    font-size: 2rem;
    letter-spacing: 0.12em;
}

h3 {
    font-size: 1.4rem;
    letter-spacing: 0.1em;
}

a {
    color: #b0b0b0;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ffffff;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    text-align: center;
    padding: 4rem 2rem 2rem;
    border-bottom: 1px solid #1a1a1a;
}

.site-header h1 {
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.site-header .subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    color: #888;
    font-size: 1.1rem;
    letter-spacing: 0.15em;
}

/* Navigation */
.site-nav {
    text-align: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid #1a1a1a;
}

.site-nav a {
    margin: 0 1.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 400;
}

.site-nav a.active {
    color: #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.3rem;
}

/* ============================================
   HOMEPAGE - Collection List
   ============================================ */
.collections-list {
    padding: 4rem 0;
}

.collection-card {
    display: block;
    padding: 3rem 0;
    border-bottom: 1px solid #1a1a1a;
    transition: background-color 0.3s ease;
}

.collection-card:first-child {
    border-top: 1px solid #1a1a1a;
}

.collection-card:hover {
    background-color: #111;
}

.collection-card h2 {
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.collection-card .collection-meta {
    color: #666;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.collection-card .collection-excerpt {
    color: #999;
    font-size: 0.95rem;
    max-width: 700px;
    line-height: 1.7;
}

/* ============================================
   COLLECTION PAGE
   ============================================ */
.collection-header {
    text-align: center;
    padding: 4rem 2rem 3rem;
}

.collection-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.collection-header .collection-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: #888;
    font-size: 1rem;
    letter-spacing: 0.1em;
}

/* Presentation Text */
.presentation {
    padding: 2rem 0 4rem;
}

.presentation p {
    font-size: 0.95rem;
    color: #c0c0c0;
    margin-bottom: 1.5rem;
    text-align: justify;
    hyphens: auto;
}

.presentation-toggle {
    display: block;
    text-align: center;
    padding: 1rem 2rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    letter-spacing: 0.1em;
    color: #888;
    border: 1px solid #333;
    cursor: pointer;
    transition: all 0.3s ease;
    background: none;
    width: 100%;
    margin-bottom: 2rem;
}

.presentation-toggle:hover {
    color: #fff;
    border-color: #666;
}

.presentation-text {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.6s ease;
}

.presentation-text.open {
    max-height: 5000px;
}

/* ============================================
   PHOTO GRID
   ============================================ */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 2rem 0;
}

.photo-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    background-color: #111;
    transition: opacity 0.5s ease;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease, filter 0.5s ease, brightness 0.5s ease;
}

/* Protezione immagini: overlay trasparente anti-download */
.photo-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.lightbox-img-container {
    position: relative;
}

.lightbox-img-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Blocca selezione e drag su immagini */
img {
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.photo-item, .lightbox-img-container {
    pointer-events: auto;
}

/* Quando il mouse entra nella griglia, TUTTE le foto si oscurano... */
.photo-grid:hover .photo-item {
    opacity: 0.15 !important;
}

/* ...tranne quella in hover che resta luminosa e si ingrandisce */
.photo-grid:hover .photo-item:hover {
    opacity: 1 !important;
}

.photo-grid:hover .photo-item:hover {
    z-index: 10;
    overflow: visible;
}

.photo-item:hover img {
    transform: scale(1.25);
    outline: 15px solid #ffffff;
}

.photo-item .photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay .photo-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: #f0f0f0;
    letter-spacing: 0.08em;
}

.photo-overlay .photo-year {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.2rem;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.97);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox.active {
    display: flex;
}

.lightbox-img-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 2rem;
}

.lightbox-img-container img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    user-select: none;
    transition: opacity 0.25s ease;
    -webkit-touch-callout: none;
}

.lightbox-info {
    text-align: center;
    padding: 1rem 2rem 2rem;
    width: 100%;
}

.lightbox-info .lightbox-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: #f0f0f0;
    letter-spacing: 0.1em;
    margin-bottom: 0.3rem;
}

.lightbox-info .lightbox-details {
    font-size: 0.8rem;
    color: #777;
    letter-spacing: 0.05em;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    z-index: 1001;
}

.lightbox-close:hover {
    color: #fff;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: #444;
    cursor: pointer;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 1rem;
    z-index: 1001;
    user-select: none;
}

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

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-counter {
    position: absolute;
    top: 1.5rem;
    left: 2rem;
    font-size: 0.8rem;
    color: #555;
    letter-spacing: 0.05em;
}

/* ============================================
   IMAGE DATA LIST
   ============================================ */
.image-data {
    padding: 3rem 0;
    border-top: 1px solid #1a1a1a;
}

.image-data h3 {
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 2rem;
    color: #888;
}

.image-data-list {
    list-style: none;
    columns: 2;
    column-gap: 3rem;
}

.image-data-list li {
    padding: 0.4rem 0;
    font-size: 0.8rem;
    color: #777;
    break-inside: avoid;
    border-bottom: 1px solid #111;
}

.image-data-list li strong {
    color: #bbb;
    font-weight: 400;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    text-align: center;
    padding: 3rem 2rem;
    border-top: 1px solid #1a1a1a;
    color: #444;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

/* ============================================
   PULSANTE GALLERIA MOBILE
   ============================================ */
.mobile-gallery-button-wrapper {
    display: none; /* nascosto su desktop */
    padding: 2rem 0 1rem;
    text-align: center;
}

.mobile-gallery-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.5rem 2.5rem;
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border: 1px solid #333;
    color: #e0e0e0;
    font-family: 'Cormorant Garamond', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 90%;
    max-width: 400px;
}

.mobile-gallery-button:active,
.mobile-gallery-button:focus {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border-color: #555;
    outline: none;
}

.mobile-gallery-button .mgb-icon {
    font-size: 1.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.mobile-gallery-button .mgb-text {
    font-size: 1.3rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #f0f0f0;
}

.mobile-gallery-button .mgb-count {
    font-size: 0.75rem;
    color: #666;
    letter-spacing: 0.1em;
    font-family: 'Inter', sans-serif;
}

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

/* Tablet landscape */
@media (max-width: 1024px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet portrait / Large phones */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    /* Su smartphone/tablet nascondi la griglia e mostra il bottone galleria */
    .photo-grid {
        display: none !important;
    }

    .mobile-gallery-button-wrapper {
        display: block !important;
    }

    h1 {
        font-size: 1.8rem;
        letter-spacing: 0.12em;
    }

    h2 {
        font-size: 1.5rem;
    }

    .site-header {
        padding: 2.5rem 1.2rem 1.2rem;
    }

    .site-header h1 {
        font-size: 1.6rem;
    }

    .site-header .subtitle {
        font-size: 0.95rem;
    }

    .site-nav {
        padding: 1rem 0;
    }

    .collection-header {
        padding: 2.5rem 1.2rem 2rem;
    }

    .collection-header h1 {
        font-size: 1.5rem;
    }

    .collection-card {
        padding: 2rem 0;
    }

    .collection-card h2 {
        font-size: 1.4rem;
    }

    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 3px;
    }

    .photo-item {
        aspect-ratio: 1/1;
    }

    .photo-overlay {
        padding: 1rem 0.8rem 0.8rem;
    }

    .photo-overlay .photo-title {
        font-size: 0.85rem;
    }

    .image-data-list {
        columns: 1;
    }

    .container, .container-narrow {
        padding: 0 1.2rem;
    }

    .presentation p {
        font-size: 0.9rem;
        text-align: left;
        hyphens: none;
    }

    .presentation-toggle {
        font-size: 0.9rem;
        padding: 0.8rem 1.5rem;
    }

    /* Lightbox mobile */
    .lightbox-img-container {
        padding: 1rem;
    }

    .lightbox-img-container img {
        max-height: 70vh;
    }

    .lightbox-nav {
        font-size: 2rem;
        padding: 0.8rem;
    }

    .lightbox-prev {
        left: 0.3rem;
    }

    .lightbox-next {
        right: 0.3rem;
    }

    .lightbox-close {
        top: 0.8rem;
        right: 1rem;
        font-size: 1.8rem;
    }

    .lightbox-counter {
        top: 0.8rem;
        left: 1rem;
        font-size: 0.75rem;
    }

    .lightbox-info {
        padding: 0.8rem 1rem 1.5rem;
    }

    .lightbox-info .lightbox-title {
        font-size: 1.2rem;
    }

    .lightbox-info .lightbox-details {
        font-size: 0.7rem;
    }

    .site-footer {
        padding: 2rem 1.2rem;
    }

    /* Admin mobile */
    .admin-container {
        padding: 1.2rem;
    }

    .section-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
}

/* Smartphones */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .site-header {
        padding: 2rem 1rem 1rem;
    }

    .site-header h1 {
        font-size: 1.4rem;
        letter-spacing: 0.1em;
    }

    .site-nav a {
        margin: 0 0.6rem;
        font-size: 0.7rem;
    }

    .collection-header {
        padding: 2rem 1rem 1.5rem;
    }

    .collection-header h1 {
        font-size: 1.3rem;
    }

    .photo-grid {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .photo-item {
        aspect-ratio: 4/3;
    }

    .photo-overlay .photo-title {
        font-size: 0.9rem;
    }

    .container, .container-narrow {
        padding: 0 1rem;
    }

    .collection-card {
        padding: 1.5rem 0;
    }

    .collection-card h2 {
        font-size: 1.2rem;
    }

    .collection-card .collection-excerpt {
        font-size: 0.85rem;
    }

    .image-data {
        padding: 2rem 0;
    }

    .image-data h3 {
        font-size: 1.1rem;
        margin-bottom: 1.2rem;
    }

    .image-data-list li {
        font-size: 0.75rem;
    }

    /* Lightbox smartphone: frecce nascoste, usa swipe */
    .lightbox-nav {
        display: none;
    }

    .lightbox-img-container {
        padding: 0.5rem;
    }

    .lightbox-img-container img {
        max-height: 65vh;
    }

    .lightbox-info .lightbox-title {
        font-size: 1rem;
    }

    .lightbox-info .lightbox-details {
        font-size: 0.65rem;
        line-height: 1.5;
    }

    .lightbox-close {
        top: 0.5rem;
        right: 0.8rem;
        font-size: 1.5rem;
    }

    .lightbox-counter {
        top: 0.5rem;
        left: 0.8rem;
    }

    /* Admin smartphone */
    .admin-header h1 {
        font-size: 1.2rem;
    }

    .login-form {
        margin: 2rem auto;
    }

    .btn {
        padding: 0.7rem 2rem;
        font-size: 0.9rem;
    }
}

/* Small smartphones */
@media (max-width: 360px) {
    .site-header h1 {
        font-size: 1.2rem;
        letter-spacing: 0.08em;
    }

    .collection-header h1 {
        font-size: 1.1rem;
    }

    .site-nav a {
        margin: 0 0.4rem;
        font-size: 0.65rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Mostra sempre overlay su touch */
    .photo-item .photo-overlay {
        opacity: 1;
        background: linear-gradient(transparent 40%, rgba(0,0,0,0.75));
    }

    /* Bottoni più grandi per touch */
    .lightbox-close {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .lightbox-nav {
        min-width: 44px;
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
    }

    /* Link navigazione più ampi */
    .site-nav a {
        padding: 0.5rem 0.3rem;
    }

    .collection-card {
        padding: 2rem 0.5rem;
    }
}

/* Landscape orientation on phones */
@media (max-height: 500px) and (orientation: landscape) {
    .lightbox-img-container {
        padding: 0.3rem;
    }

    .lightbox-img-container img {
        max-height: 75vh;
    }

    .lightbox-info {
        padding: 0.3rem 1rem 0.5rem;
    }

    .lightbox-info .lightbox-title {
        font-size: 0.9rem;
    }

    .lightbox-info .lightbox-details {
        display: none;
    }

    .lightbox-close {
        top: 0.3rem;
        right: 0.5rem;
    }

    .lightbox-counter {
        top: 0.3rem;
        left: 0.5rem;
    }
}

/* ============================================
   ADMIN STYLES
   ============================================ */
.admin-body {
    background-color: #111;
    min-height: 100vh;
}

.admin-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 1px solid #222;
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 1.5rem;
    letter-spacing: 0.15em;
}

/* Login Form */
.login-form {
    max-width: 400px;
    margin: 4rem auto;
    text-align: center;
}

.login-form h2 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: #1a1a1a;
    border: 1px solid #333;
    color: #e0e0e0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 300;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #666;
}

.form-group input[type="file"] {
    padding: 0.6rem;
    cursor: pointer;
}

.btn {
    display: inline-block;
    padding: 0.8rem 2.5rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #444;
    background: none;
    color: #ccc;
}

.btn:hover {
    background-color: #f0f0f0;
    color: #0a0a0a;
    border-color: #f0f0f0;
}

.btn-primary {
    background-color: #f0f0f0;
    color: #0a0a0a;
    border-color: #f0f0f0;
}

.btn-primary:hover {
    background-color: #fff;
}

.btn-danger {
    border-color: #662222;
    color: #cc4444;
}

.btn-danger:hover {
    background-color: #cc4444;
    color: #fff;
    border-color: #cc4444;
}

/* Dashboard */
.section-list {
    list-style: none;
}

.section-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 0;
    border-bottom: 1px solid #1a1a1a;
}

.section-item .section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    color: #e0e0e0;
    letter-spacing: 0.08em;
}

.section-item .section-count {
    font-size: 0.8rem;
    color: #666;
}

.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-success {
    background-color: #0a1a0a;
    border: 1px solid #2a4a2a;
    color: #6a9a6a;
}

.alert-error {
    background-color: #1a0a0a;
    border: 1px solid #4a2a2a;
    color: #cc6666;
}

/* Progress */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #1a1a1a;
    margin: 1rem 0;
    display: none;
}

.progress-bar .progress {
    height: 100%;
    background-color: #f0f0f0;
    width: 0%;
    transition: width 0.3s ease;
}

/* Back link */
.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    font-size: 0.85rem;
    color: #666;
    letter-spacing: 0.05em;
}

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