/**
 * Niop Theme — main.css
 * CSS aggiuntivo e overrides specifici dell'applicazione
 * Gli stili base sono in style.css
 */

/* =============================================
   CSS CRITICO ABOVE-THE-FOLD
   Stilizzazione dell'header e dell'hero per il
   primo rendering senza FOUC (Flash of Unstyled Content)
   ============================================= */

/* Loader iniziale — nasconde flash */
body {
    visibility: visible;
}

/* =============================================
   WORDPRESS SPECIFICI — Admin bar
   ============================================= */
.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

/* =============================================
   ALIGNMENTS GUTENBERG
   ============================================= */
.entry-content .alignwide {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.entry-content .alignfull {
    max-width: 100%;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
}

.entry-content .alignleft {
    float: left;
    margin-right: 2rem;
    margin-bottom: 1rem;
    max-width: 360px;
}

.entry-content .alignright {
    float: right;
    margin-left: 2rem;
    margin-bottom: 1rem;
    max-width: 360px;
}

.entry-content .aligncenter {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* =============================================
   WORDPRESS NAVIGATION
   ============================================= */
.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 3rem;
}

.nav-links a,
.nav-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links .current {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #ffffff;
}

/* =============================================
   PULSANTI WORDPRESS COMMENT / FORM
   ============================================= */
input[type="submit"],
button[type="submit"] {
    background: var(--color-accent);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.85rem 2rem;
    font-size: var(--fs-sm);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

input[type="submit"]:hover,
button[type="submit"]:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
}

/* =============================================
   GALLERY WORDPRESS NATIVA
   ============================================= */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.gallery-item {
    overflow: hidden;
    border-radius: var(--border-radius);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* =============================================
   STILI AGGIUNTIVI PER TIPOGRAFIA BODY
   ============================================= */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: var(--fs-sm);
}

.entry-content th {
    background: var(--color-bg-alt);
    color: var(--color-text);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
}

.entry-content td {
    color: var(--color-text-muted);
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
}

.entry-content tr:nth-child(even) td {
    background: rgba(255,255,255,0.02);
}

.entry-content code {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.15rem 0.4rem;
    font-size: 0.85em;
    font-family: 'Courier New', Courier, monospace;
    color: var(--color-accent);
}

.entry-content pre {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
}

.entry-content pre code {
    border: none;
    background: none;
    padding: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* =============================================
   ACCESSO RAPIDO TASTIERA
   ============================================= */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* =============================================
   LOADING STATE
   ============================================= */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* =============================================
   OVERRIDES FAQ LAYOUT MOBILE
   ============================================= */
@media (max-width: 768px) {
    #faq .container > div {
        grid-template-columns: 1fr !important;
        gap: var(--space-lg) !important;
    }
}

/* =============================================
   PAGINA 404
   ============================================= */
.error-404 {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: var(--space-xxl) 0;
}

/* Numero 404 gigante in background */
.error-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(12rem, 30vw, 22rem);
    font-weight: 900;
    line-height: 1;
    color: var(--color-accent-dim);
    letter-spacing: -0.05em;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}
