/* ==========================================================================
   Nuvola Costituzione — Frontend Styles
   Namespace: lbnc-   |   BEM convention
   References Elementor global CSS variables with safe fallbacks.
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────────────────
   Container / Design tokens
   ────────────────────────────────────────────────────────────────────────── */

.lbnc-container {
    /* Typography tokens mapped from Elementor globals */
    --lbnc-font-heading: var(--e-global-typography-primary-font-family, "Roboto Condensed");
    --lbnc-font-heading-weight: var(--e-global-typography-primary-font-weight, 600);
    --lbnc-font-body: var(--e-global-typography-text-font-family, "Roboto");
    --lbnc-font-body-weight: var(--e-global-typography-text-font-weight, 400);

    /* Color tokens mapped from Elementor globals */
    --lbnc-color-primary: var(--e-global-color-primary, #047DCC);
    --lbnc-color-secondary: var(--e-global-color-secondary, #090AA3);
    --lbnc-color-text: var(--e-global-color-text, #00002E);
    --lbnc-color-accent: var(--e-global-color-accent, #047DCC);
    --lbnc-color-white: var(--e-global-color-21704f7, #FFFFFF);

    /* Language colors (injected inline via PHP style attr) */
    /* --lbnc-lang-0-color, --lbnc-lang-1-color, --lbnc-lang-2-color */

    font-family: var(--lbnc-font-body);
    font-weight: var(--lbnc-font-body-weight);
    color: var(--lbnc-color-text);
    /* max-width: 960px; */
    margin: 0 auto;
    position: relative;
    overflow: hidden; /* clips sliding views */
}

/* ──────────────────────────────────────────────────────────────────────────
   Bubble Map (SVG)
   ────────────────────────────────────────────────────────────────────────── */

.lbnc-map__svg {
    display: block;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    height: auto;
}

.lbnc-map__center-text {
    font-family: var(--lbnc-font-heading);
    font-weight: var(--lbnc-font-heading-weight);
    font-size: 22px;
    letter-spacing: 1px;
    pointer-events: none; /* let click pass to <g> */
}

.lbnc-map__center-subtitle {
    font-family: var(--lbnc-font-body);
    font-weight: var(--lbnc-font-body-weight);
    font-size: 13px;
    opacity: 0.85;
    pointer-events: none;
}

/* Center bubble hover — invert from primary to secondary */
.lbnc-map__center.lbnc-map__bubble:hover ellipse,
.lbnc-map__center.lbnc-map__bubble:focus ellipse {
    fill: var(--lbnc-color-secondary);
}
.lbnc-map__center.lbnc-map__bubble:focus {
    outline: none;
}
.lbnc-map__center.lbnc-map__bubble:focus ellipse {
    stroke: var(--lbnc-color-white, #fff);
    stroke-width: 3;
}

.lbnc-map__bubble-text {
    font-family: var(--lbnc-font-heading);
    font-weight: var(--lbnc-font-heading-weight);
    pointer-events: none; /* let click pass to <g> */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hover / focus states */
.lbnc-map__bubble:hover ellipse,
.lbnc-map__bubble:focus ellipse {
    fill: var(--lbnc-color-primary);
    transition: fill 0.2s ease;
}
.lbnc-map__bubble:hover text,
.lbnc-map__bubble:focus text {
    fill: var(--lbnc-color-white, #fff);
    transition: fill 0.2s ease;
}
.lbnc-map__bubble:focus {
    outline: none;
}
.lbnc-map__bubble:focus ellipse {
    stroke: var(--lbnc-color-accent);
    stroke-width: 3;
}

/* Active / selected state */
.lbnc-map__bubble--active ellipse {
    fill: var(--lbnc-color-secondary);
}
.lbnc-map__bubble--active text {
    fill: var(--lbnc-color-white, #fff);
}

/* ──────────────────────────────────────────────────────────────────────────
   Timeline
   ────────────────────────────────────────────────────────────────────────── */

.lbnc-timeline {
    padding: 90px 0;
}

.lbnc-timeline__header {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 1280px;
    margin: 0 auto 32px auto;
}

.lbnc-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid var(--lbnc-color-primary);
    background: transparent;
    color: var(--lbnc-color-primary);
    font-family: var(--lbnc-font-heading);
    font-weight: var(--lbnc-font-heading-weight);
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.lbnc-back-btn:hover,
.lbnc-back-btn:focus {
    background: var(--lbnc-color-primary)!important;
    color: var(--lbnc-color-white, #fff);
    outline: none;
}

.lbnc-timeline__title {
    font-family: var(--lbnc-font-heading);
    font-weight: var(--lbnc-font-heading-weight);
    font-size: 28px;
    margin: 0;
    padding-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--lbnc-color-secondary);
}

/* ── Desktop: Horizontal timeline ── */

.lbnc-timeline__track {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 40px 24px 24px;
    -webkit-overflow-scrolling: touch;
}

/* The horizontal line */
.lbnc-timeline__track::before {
    content: '';
    position: absolute;
    top: 46px;
    left: 24px;
    right: 24px;
    height: 3px;
    background: var(--lbnc-color-primary);
    z-index: 0;
}

.lbnc-timeline__entry {
    position: relative;
    flex: 0 0 auto;
    min-width: 140px;
    max-width: 200px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px;
}

/* Dot on the line */
.lbnc-timeline__dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--lbnc-entry-color, var(--lbnc-color-primary));
    border: 3px solid var(--lbnc-color-white, #fff);
    box-shadow: 0 0 0 2px var(--lbnc-entry-color, var(--lbnc-color-primary));
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
    flex-shrink: 0;
}

/* Card */
.lbnc-timeline__card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    padding: 12px 14px;
    background: var(--lbnc-color-white, #fff);
    border-left: 4px solid var(--lbnc-entry-color, var(--lbnc-color-primary));
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
    border-top: none;
    border-right: none;
    border-bottom: none;
    font-size: 14px;
    min-height: 123px; /* equalize card heights */
}

#lbnc-container-1 button.lbnc-timeline__card:hover,
#lbnc-container-1 button.lbnc-timeline__card:focus {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    transform: translateY(-2px);
    outline: none;
    background-color: #047dcc2b; /* subtle hover effect */

}
#lbnc-container-1 button.lbnc-timeline__card:focus {
    outline: 2px solid var(--lbnc-color-accent);
    outline-offset: 2px;
}

.lbnc-timeline__year {
    font-family: var(--lbnc-font-heading);
    font-weight: var(--lbnc-font-heading-weight);
    font-size: 18px;
    color: var(--lbnc-entry-color, var(--lbnc-color-primary));
}



.lbnc-timeline__dict {
    font-family: var(--lbnc-font-body);
    font-size: 13px;
    color: var(--lbnc-color-text);
    opacity: 0.85;
}

.lbnc-timeline__lang-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--lbnc-color-white, #fff);
    background: var(--lbnc-entry-color, var(--lbnc-color-primary));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

/* ──────────────────────────────────────────────────────────────────────────
   Modal (<dialog>)
   ────────────────────────────────────────────────────────────────────────── */

.lbnc-modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    max-width: 640px;
    width: 90vw;
    max-height: 80vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    font-family: var(--lbnc-font-body, "Roboto", sans-serif);
    color: var(--lbnc-color-text, #00002E);
    overflow: hidden;
}

/* Backdrop */
.lbnc-modal::backdrop {
    background: rgba(0, 0, 46, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.lbnc-modal__inner {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.lbnc-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.lbnc-modal__word {
    font-family: var(--lbnc-font-heading, "Roboto Condensed", sans-serif);
    font-weight: var(--lbnc-font-heading-weight, 600);
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--lbnc-color-secondary, #090AA3);
}

#lbnc-container-1 button.lbnc-modal__close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: var(--lbnc-color-text, #00002E);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 22px;
}

#lbnc-container-1 button.lbnc-modal__close:hover,
#lbnc-container-1 button.lbnc-modal__close:focus {
    background: #0d0ea43d;
    outline: none;
}

.lbnc-modal__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    flex-wrap: wrap;
}

.lbnc-modal__dict {
    font-family: var(--lbnc-font-heading);
    font-weight: var(--lbnc-font-heading-weight);
    font-size: 16px;
}

.lbnc-modal__year {
    font-size: 15px;
    opacity: 0.7;
}

.lbnc-modal__lang-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--lbnc-color-white, #fff);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lbnc-modal__body {
    padding: 16px 24px 24px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.7;
}

.lbnc-modal__definition {
    font-size: 15px;
}
.lbnc-modal__definition p {
    margin: 0 0 12px;
}

.lbnc-modal__notes {
    margin-top: 12px;
    font-size: 13px;
    font-style: italic;
    opacity: 0.7;
}
.lbnc-modal__notes:empty {
    display: none;
}

.lbnc-modal__source {
    display: inline-block;
    margin-top: 12px;
    font-size: 13px;
    color: var(--lbnc-color-primary);
    text-decoration: none;
}
.lbnc-modal__source:hover {
    text-decoration: underline;
}
.lbnc-modal__source[href="#"],
.lbnc-modal__source:empty {
    display: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   Responsive — Mobile (<768px)
   ────────────────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {

    .lbnc-container {
        padding: 0 8px;
    }



    .lbnc-map__svg {
        height: calc(100vw * 1.5);
    }


    .lbnc-timeline {
        padding: 45px 0;
    }


    /* Timeline goes vertical */
    .lbnc-timeline__track {
        flex-direction: column;
        padding: 0 0 0 32px;
        overflow-x: visible;
    }

    .lbnc-timeline__track::before {
        top: 0;
        bottom: 0;
        left: 30px;
        right: auto;
        width: 3px;
        height: auto;
    }

    .lbnc-timeline__entry {
        flex-direction: row;
        align-items: flex-start;
        min-width: 0;
        max-width: none;
        width: 100%;
        padding: 0 0 24px;
        gap: 12px;
    }

    .lbnc-timeline__dot {
        margin-top: 14px;
        margin-bottom: 0;
        margin-left: -8px; /* center on line */
        flex-shrink: 0;
    }

    .lbnc-timeline__card {
        flex: 1;
        min-height: 44px; /* equalize card heights */
    }

    .lbnc-timeline__title {
        font-size: 22px;
    }

    /* Modal goes near-full-screen */
    /* .lbnc-modal {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        margin: 0;
    } */

    .lbnc-modal__inner {
        max-height: 100vh;
    }

    .lbnc-modal__body {
        padding: 16px;
        max-height: 50vh;
    }
}

/* ──────────────────────────────────────────────────────────────────────────
   View transition helper  (display/transform/opacity managed by JS)
   ────────────────────────────────────────────────────────────────────────── */

.lbnc-view {
    will-change: transform, opacity;
}
