/* Homepress — Single post block styles (tutto-in-uno: reset + layout + blocchi)
   ---------------------------------------------------------------------
   Vars (con defaults sensati):
     --hp-author-box-bg      : sfondo box autore
     --hp-author-box-text    : colore nome autore
     --hp-author-box-role    : colore ruolo/qualifica
     --hp-author-box-rows    : numero righe short bio visibili prima del collapse
*/

/* ============ Reset difensivo (era reset.css) ============
   Risolve: img/figure/iframe/table/pre/code che debordano oltre il container
   quando WP/editor inietta style="width:Xpx" inline (caso classico: [caption]). */
.hp-single .entry-content img,
.hp-single .featured-image img,
.hp-single .wp-caption img,
.hp-single figure img {
    max-width: 100% !important;
    height: auto !important;
}
.hp-single .entry-content figure,
.hp-single .entry-content .wp-caption,
.hp-single .entry-content .wp-block-image,
.hp-single .entry-content .gallery-item {
    max-width: 100% !important;
}
.hp-single .entry-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.hp-single .entry-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}
.hp-single .entry-content pre,
.hp-single .entry-content code {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-word;
}
.hp-single .entry-content iframe,
.hp-single .entry-content embed,
.hp-single .entry-content video,
.hp-single .entry-content object {
    max-width: 100%;
}
/* Hide GP entry-meta nativo: hp-author-box + hp-post-dateshare lo sostituiscono. */
.hp-single .entry-header > .entry-meta,
.hp-single .entry-header .posted-on,
.hp-single .entry-header .byline {
    display: none !important;
}

/* ============ Override font-display GP icon font (era in homepage.css) ============ */
@font-face {
    font-family: 'GeneratePress';
    font-display: swap;
}

/* ============ CSS vars Homepress (era in homepage.css :root) ============ */
:root {
    --hp-accent: var(--accent, #1e73be);
    --hp-hot: #e91e63;
    --hp-hot-soft: #ffe3ec;
    --hp-text: #1a1a1f;
    --hp-muted: #4b5563;
    --hp-card-bg: #ffffff;
    --hp-card-border: #eceef2;
    --hp-shadow: 0 1px 2px rgba(17,24,39,.04), 0 4px 12px rgba(17,24,39,.06);
    --hp-shadow-hover: 0 2px 6px rgba(17,24,39,.06), 0 14px 28px rgba(17,24,39,.10);
    --hp-radius: 12px;
}

/* ============ SINGLE POST layout slot order (era in homepage.css 377-394) ============ */
.hp-single .inside-article {
    display: flex;
    flex-direction: column;
}
.hp-single .inside-article > .hp-breadcrumb      { order: 1; }
.hp-single .inside-article > .hp-post-cap        { order: 5; }
.hp-single .inside-article > .entry-header       { order: var(--hp-post-title-order, 20); }
.hp-single .inside-article > .hp-post-meta       { order: var(--hp-post-meta-order, 30); }
.hp-single .inside-article > .featured-image,
.hp-single .inside-article > .post-image         { order: var(--hp-post-image-order, 40); }
.hp-single .inside-article > .entry-content      { order: 60; }
.hp-single .inside-article > .entry-meta,
.hp-single .inside-article > footer.entry-meta   { order: 80; }

/* ============ Cappello cat/tag sopra il titolo ============ */
.hp-post-cap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
    align-items: center;
}
.hp-post-cap .hp-badge,
.hp-post-cap .hp-pill-tag {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--hp-radius);
}

/* ============ Pill base + variants ============ */
.hp-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--hp-radius);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    background: #f3f4f6;
    color: var(--hp-text);
    line-height: 1;
    transition: background .15s ease;
}
.hp-pill:hover { background: #e5e7eb; }
.hp-pill-tag { color: var(--hp-muted); }
.hp-pill-tag-prefix {
    display: inline-flex;
    align-items: center;
    color: var(--hp-muted);
    font-weight: 700;
    margin-right: 2px;
    user-select: none;
}

/* ============ Fondo articolo: terms (cat/tag footer) ============ */
.hp-post-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 28px 0 12px;
    padding: 14px 0;
    border-top: 1px solid var(--hp-card-border);
    border-bottom: 1px solid var(--hp-card-border);
}
.hp-post-foot-cat,
.hp-post-foot-tag {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.hp-post-foot-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--hp-muted);
    margin-right: 4px;
}

/* ============ Breadcrumb Homepress nativo ============ */
.hp-breadcrumb {
    font-size: 0.85em;
    line-height: 1.5;
    padding: 10px 16px;
    margin: 0 0 16px;
    border-radius: var(--hp-radius);
    background: #f5f5f4;
    color: #57534e;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.hp-breadcrumb-link { color: #44403c; text-decoration: none; }
.hp-breadcrumb-link:hover { text-decoration: underline; }
.hp-breadcrumb-sep { opacity: .6; user-select: none; }
.hp-breadcrumb-current { font-weight: 600; color: var(--hp-text); opacity: .9; }
.hp-breadcrumb.hp-breadcrumb-plain {
    background: transparent;
    border-radius: 0;
    padding: 0 0 8px;
    margin: 0 0 18px;
    border-bottom: 1px solid var(--hp-card-border);
    font-size: 0.82em;
}

/* ============ Disclaimer affiliazioni ============ */
.hp-post-disclaimer {
    background: var(--hp-disclaimer-bg, #fff8e6);
    border-left: 4px solid var(--hp-disclaimer-border, #d97706);
    border-radius: 0 var(--hp-radius) var(--hp-radius) 0;
    padding: 14px 18px;
    margin: 16px 0 12px;
    font-size: 0.85em;
    color: var(--hp-disclaimer-text, #78350f);
    line-height: 1.6;
}
.hp-post-disclaimer p { margin: 0; }
.hp-post-disclaimer p + p { margin-top: 4px; }
.hp-post-disclaimer a { color: inherit; font-weight: 600; }

/* ============ Spacing compatto featured image → content ============ */
.hp-single .inside-article .featured-image,
.hp-single .inside-article .post-image,
.hp-single .inside-article > .featured-image,
.hp-single .inside-article > .post-image {
    margin-bottom: 0.6em !important;
}
.hp-single .entry-content {
    margin-top: 0.4em !important;
}
.hp-single .entry-content > *:first-child {
    margin-top: 0 !important;
}

/* ============ SUBTITLE ============ */
.hp-post-subtitle {
    margin: 0.5em 0 1em !important;
    font-size: clamp(1.05rem, 0.5vw + 0.95rem, 1.25rem);
    line-height: 1.5;
    color: #4b5563; /* grigio neutro, WCAG AA */
    font-weight: 400;
    font-style: normal;
}

/* ============ DATE + SHARE ============ */
.hp-post-dateshare {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0.9em 0 1.2em;
    padding: 0.6em 0;
    border-top: 1px solid rgba(0,0,0,0.06);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 0.9rem;
    color: #4b5563;
}
.hp-post-dateshare-date {
    margin: 0 !important;
    line-height: 1.3;
}
.hp-post-dateshare-label {
    color: #6b7280;
    margin-right: 2px;
}
.hp-post-dateshare time {
    color: inherit;
    font-weight: 500;
}

/* Bottone Condividi: icona nuda, trasparente, line-height=0 così non allunga il container */
.hp-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: transparent !important;
    border: 0;
    color: #4b5563;
    cursor: pointer;
    line-height: 0;
    vertical-align: middle;
    transition: color 0.15s ease;
}
.hp-share-btn:hover,
.hp-share-btn:focus {
    color: #111827;
    background: transparent !important;
    outline: none;
}
.hp-share-btn svg { display: block; }
.hp-share-btn.hp-share-copied {
    position: relative;
}
.hp-share-btn.hp-share-copied::after {
    content: 'Copiato!';
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    font-size: 0.72rem;
    color: #059669;
    font-weight: 600;
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

/* ============ BOX AUTORE (avatar piccolo, titolo MAIUSCOLO accent, + top-right) ============ */
.hp-author-box {
    --hp-author-box-bg: transparent;
    --hp-author-box-text: #111;
    /* Magenta scuro WCAG-AA friendly (contrasto 5.12:1 su bianco). Il --hp-hot del tema è
       #e91e63 che fallisce AA per testo piccolo. */
    --hp-author-box-role: #c2185b;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0.8em 0 0.6em;
    padding: 0;
    background: var(--hp-author-box-bg);
}
.hp-author-box-avatar {
    flex-shrink: 0;
    margin: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #f3f4f6;
}
.hp-author-box-avatar img,
.hp-author-box-avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}
.hp-author-box-info {
    flex: 1;
    min-width: 0;
    padding-right: 36px; /* spazio per il bottone + absolute */
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.hp-author-box-name {
    font-weight: 700 !important;
    color: var(--hp-author-box-text) !important;
    text-decoration: none !important;
    font-size: 0.95rem;
    line-height: 1.25;
}
.hp-author-box-name:hover { text-decoration: underline !important; }
.hp-author-box-role {
    margin: 0 !important;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hp-author-box-role);
    line-height: 1.3;
    font-weight: 600;
}

/* Bio collapsed: bottone + in alto a destra del box, indipendente dalla posizione
   della bio (che compare sotto nome/titolo quando aperta). */
.hp-author-box-bio-wrap {
    /* position: static — lasciato nel flow per far crescere il box quando aperto */
    margin-top: 0;
}
.hp-author-box-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.18);
    background: transparent;
    cursor: pointer;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.hp-author-box-toggle::-webkit-details-marker { display: none; }
.hp-author-box-toggle::marker { content: ''; }
.hp-author-box-toggle::before {
    content: '';
    width: 10px;
    height: 10px;
    background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
    background-size: 100% 2px, 2px 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: #666;
    transition: transform 0.2s ease;
}
.hp-author-box-bio-wrap[open] .hp-author-box-toggle::before {
    /* nascondi la linea verticale → resta solo la linea orizzontale = "−" */
    background-size: 100% 2px, 0 0;
}
.hp-author-box-toggle:hover {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.3);
}

.hp-author-box-bio {
    margin-top: 8px;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #374151;
}
.hp-author-box-bio p {
    margin: 0 0 0.5em !important;
}
.hp-author-box-bio p:last-child { margin-bottom: 0 !important; }
.hp-author-box-bio a { color: inherit; text-decoration: underline; }

/* Riga titolo + social (inline accanto al titolo) */
.hp-author-box-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

/* Social icons (piccoli inline accanto al titolo) */
.hp-author-box-social {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}
.hp-author-box-social li { margin: 0 !important; padding: 0 !important; }
.hp-author-box-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #c2185b; /* magenta WCAG-AA friendly */
    background: transparent;
    text-decoration: none !important;
    transition: color 0.15s, background 0.15s;
}
.hp-author-box-social a:hover {
    color: #ad1457;
    background: rgba(0,0,0,0.04);
}
.hp-author-box-social svg { width: 14px; height: 14px; }

/* Mobile */
@media (max-width: 480px) {
    .hp-author-box { gap: 10px; }
    .hp-author-box-avatar { width: 36px; height: 36px; }
    .hp-author-box-name { font-size: 0.9rem; }
    .hp-author-box-role { font-size: 0.7rem; }
}
