/*
 * tpl_veilborn — Veilborn Chronicles (supernatural dark theme)
 * (C) 2026 ZoneVerse
 */

:root {
    --vb-void: #05040a;
    --vb-void-2: #0c0818;
    --vb-panel: rgba(18, 10, 32, 0.82);
    --vb-panel-solid: #140a24;
    --vb-border: rgba(167, 139, 250, 0.28);
    --vb-violet: #7c3aed;
    --vb-violet-2: #a78bfa;
    --vb-mist: #c084fc;
    --vb-glow: #22d3ee;
    --vb-glow-dim: rgba(34, 211, 238, 0.35);
    --vb-blood: #c41e3a;
    --vb-blood-bright: #ef4444;
    --vb-blood-hot: #ff2d2d;
    --vb-blood-dark: #5c0a12;
    --vb-blood-glow: rgba(220, 38, 38, 0.65);
    --vb-blood-mist: rgba(127, 10, 24, 0.42);
    --vb-text: #ede9fe;
    --vb-muted: #a5b4fc;
    --vb-shell: 1180px;
    --vb-glass: blur(14px);
}

* { box-sizing: border-box; }

html.vb-html, body.vb-body {
    height: 100%;
}

body.vb-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--vb-text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.65;
    background:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(124, 58, 237, 0.2), transparent 55%),
        radial-gradient(ellipse 55% 50% at 8% 15%, rgba(220, 38, 38, 0.38), transparent 52%),
        radial-gradient(ellipse 45% 40% at 92% 25%, rgba(196, 30, 58, 0.28), transparent 48%),
        radial-gradient(ellipse 50% 45% at 50% 100%, rgba(127, 10, 24, 0.32), transparent 55%),
        radial-gradient(ellipse 60% 50% at 100% 50%, rgba(34, 211, 238, 0.06), transparent 50%),
        radial-gradient(ellipse 50% 40% at 0% 80%, rgba(192, 132, 252, 0.1), transparent 45%),
        linear-gradient(180deg, #120810 0%, var(--vb-void) 100%);
    background-attachment: fixed;
}

.vb-veil-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.68;
}

.vb-veil-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 28%, rgba(220, 38, 38, 0.22) 0%, transparent 42%),
        radial-gradient(circle at 82% 68%, rgba(124, 58, 237, 0.14) 0%, transparent 38%),
        radial-gradient(circle at 50% 90%, rgba(127, 10, 24, 0.18) 0%, transparent 40%);
    animation: vb-drift 18s ease-in-out infinite alternate;
}

/* Permanent blood haze over the void */
.vb-blood-veil {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    background:
        radial-gradient(ellipse 90% 70% at 12% 20%, rgba(196, 30, 58, 0.42), transparent 58%),
        radial-gradient(ellipse 70% 55% at 88% 30%, rgba(127, 10, 24, 0.35), transparent 52%),
        radial-gradient(ellipse 80% 60% at 50% 110%, rgba(92, 10, 18, 0.48), transparent 55%),
        radial-gradient(ellipse 40% 35% at 70% 75%, rgba(220, 38, 38, 0.22), transparent 50%);
}

/* Always-visible corner blood splatters (decorative) */
.vb-blood-decor {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.vb-blood-decor__splat {
    position: absolute;
    width: min(44vw, 460px);
    height: auto;
    opacity: 0.42;
    filter: drop-shadow(0 0 28px rgba(255, 45, 45, 0.45)) drop-shadow(0 0 60px rgba(127, 10, 24, 0.35));
    animation: vb-blood-decor-pulse 8s ease-in-out infinite alternate;
}

.vb-blood-decor__splat--tl {
    top: -6%;
    left: -8%;
    transform: rotate(-18deg);
}

.vb-blood-decor__splat--tr {
    top: 4%;
    right: -10%;
    width: min(36vw, 380px);
    transform: rotate(22deg) scaleX(-1);
    animation-delay: -2.5s;
}

.vb-blood-decor__splat--bl {
    bottom: -8%;
    left: 2%;
    width: min(32vw, 340px);
    transform: rotate(12deg);
    animation-delay: -4s;
    opacity: 0.35;
}

.vb-blood-decor__splat--br {
    bottom: -10%;
    right: -6%;
    transform: rotate(168deg) scaleX(-1);
    animation-delay: -1.2s;
}

@keyframes vb-blood-decor-pulse {
    from { opacity: 0.32; transform: rotate(var(--vb-rot, -18deg)) scale(0.98); }
    to { opacity: 0.48; transform: rotate(var(--vb-rot, -18deg)) scale(1.03); }
}

.vb-blood-decor__splat--tr { --vb-rot: 22deg; }
.vb-blood-decor__splat--bl { --vb-rot: 12deg; }
.vb-blood-decor__splat--br { --vb-rot: 168deg; }

@keyframes vb-drift {
    from { opacity: 0.7; transform: scale(1); }
    to { opacity: 1; transform: scale(1.03); }
}

body.vb-body > *:not(.vb-veil-canvas):not(.vb-veil-glow):not(.vb-blood-veil):not(.vb-blood-decor):not(.vb-blood-splash):not(.vb-header):not(.vb-skip):not(.vb-overlays):not(.vb-cookie-banner):not(.vb-cookie-tab):not(#accessibilityIcon):not(#accessibilityMenu):not(._access-menu):not(._access-icon) {
    position: relative;
    z-index: 1;
}

a { color: var(--vb-mist); text-decoration: none; transition: color 0.15s, text-shadow 0.15s; }
a:hover { color: #f5f3ff; text-shadow: 0 0 12px var(--vb-glow-dim); }

img { max-width: 100%; height: auto; }

.vb-shell {
    width: 100%;
    max-width: var(--vb-shell);
    margin: 0 auto;
    padding: 0 1.25rem;
}

body.is-fluid .vb-shell { max-width: 100%; padding: 0 2rem; }

.vb-skip {
    position: absolute; left: -9999px; top: 0; z-index: 1000;
    background: var(--vb-violet); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
}
.vb-skip:focus { left: 0; }

/* Header */
.vb-header .vb-shell {
    padding-top: 0;
    padding-bottom: 0;
}

body.vb-body > .vb-header {
    position: sticky;
    top: 0;
    z-index: 100;
    align-self: stretch;
    width: 100%;
    margin: 0;
    background: linear-gradient(180deg, rgba(28, 8, 16, 0.97), rgba(12, 6, 14, 0.92));
    backdrop-filter: var(--vb-glass);
    -webkit-backdrop-filter: var(--vb-glass);
    border-bottom: 1px solid rgba(220, 38, 38, 0.35);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 48px rgba(220, 38, 38, 0.12), 0 0 40px rgba(124, 58, 237, 0.08);
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.vb-header.vb-header--pinned {
    background: linear-gradient(180deg, rgba(18, 4, 10, 0.98), rgba(8, 4, 10, 0.96));
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 56px rgba(220, 38, 38, 0.18), 0 0 48px rgba(124, 58, 237, 0.12);
}

.vb-header {
    position: sticky;
    top: 0;
    z-index: 100;
}

.vb-header-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    min-height: 56px;
    padding: 0.2rem 0;
}

.vb-brand-logo {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 0 14px rgba(192, 132, 252, 0.55));
    animation: vb-logo-pulse 4s ease-in-out infinite;
}

/* image-depth può aver avvolto il logo: forza dimensioni header come homepage */
.vb-brand .vb-depth-frame {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    vertical-align: middle;
}

.vb-brand .vb-depth-frame img,
.vb-brand img.vb-brand-logo {
    width: 44px !important;
    height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    object-fit: contain;
    transform: none;
}

@keyframes vb-logo-pulse {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.45)); }
    50% { filter: drop-shadow(0 0 22px rgba(239, 68, 68, 0.65)); }
}

.vb-brand {
    display: flex; align-items: center; gap: 0.75rem; color: var(--vb-text);
    flex-shrink: 0;
}

.vb-brand-text strong {
    display: block; font-size: 1.12rem; color: #f5f3ff;
    letter-spacing: 0.04em; text-shadow: 0 0 20px rgba(167, 139, 250, 0.35);
}

.vb-brand-text small {
    display: block; color: var(--vb-muted); font-size: 0.68rem;
    letter-spacing: 0.18em; text-transform: uppercase;
}

.vb-hero-pos { width: 100%; max-width: none; margin: 0; padding: 0; }

body.vb-page-portal,
body.vb-page-home {
    overflow-x: clip;
}

.vb-shell-main { flex: 1 0 auto; padding-top: 1.5rem; padding-bottom: 2.5rem; }

body.vb-page-portal .vb-shell-main,
body.vb-page-home .vb-shell-main {
    padding-top: 0;
}

.vb-main { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
.vb-main.has-left { grid-template-columns: 280px 1fr; }
.vb-main.has-right { grid-template-columns: 1fr 280px; }
.vb-main.has-both { grid-template-columns: 260px 1fr 260px; }
.vb-content-col { min-width: 0; }

/* Homepage full bleed */
.vb-page-home .vb-shell-main {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: none;
    width: 100%;
}

.vb-page-home .vb-component {
    padding: 0;
    max-width: none;
}

.vb-page-home .vb-header-bar {
    min-height: 52px;
    padding: 0.2rem 0;
}

/* Logo header: stessa dimensione ovunque (44px, come homepage) */

.vb-page-home .vb-component .veilborn-portal.vb-hero {
    margin: 0 calc(-1 * 1.25rem);
    border-radius: 0;
    min-height: calc(100vh - 72px - 120px);
    display: flex; flex-direction: column; justify-content: center;
}

body.is-fluid.vb-page-home .vb-component .veilborn-portal.vb-hero {
    margin: 0 calc(-1 * 2rem);
}

/* Glass panels */
.vb-aside { position: sticky; top: 90px; }

.moduletable, .vb-aside .card, .vb-content-top .card, .vb-content-bottom .card, .vb-bottom .card {
    background: var(--vb-panel);
    backdrop-filter: var(--vb-glass);
    border: 1px solid var(--vb-border);
    border-radius: 14px;
    padding: 1.1rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.moduletable > h3, .card > .card-header, .vb-aside h3 {
    color: var(--vb-mist); margin-top: 0; font-size: 1.05rem;
    border-bottom: 1px solid var(--vb-border); padding-bottom: 0.5rem; margin-bottom: 0.8rem;
}

.vb-bottom {
    border-top: 1px solid var(--vb-border);
    padding: 2rem 0 0.5rem;
    background: rgba(0, 0, 0, 0.25);
}

.vb-bottom-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; }

.vb-footer {
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(5, 4, 10, 0.95), #030208);
    border-top: 1px solid var(--vb-border);
    padding: 1.6rem 0 1.4rem;
    color: var(--vb-muted);
    text-align: center;
}

.vb-footer__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.vb-footer-nav,
.vb-footer-legal {
    width: 100%;
    display: flex;
    justify-content: center;
}

.vb-footer-nav .mod-menu:empty {
    display: none;
}

/* Joomla 5: ul.mod-menu (non un wrapper div + ul interno) */
.vb-footer-legal ul,
.vb-footer-nav ul.mod-menu,
.vb-footer-nav ul.mod-list,
.vb-footer-nav ul.vb-footer-menu,
.vb-footer .mod-menu ul,
.vb-footer .vb-footer-menu-wrap ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.45rem 1.75rem;
    max-width: 100%;
}

.vb-footer-nav li.nav-item,
.vb-footer-legal li {
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

.vb-footer-legal a,
.vb-footer-nav a,
.vb-footer .mod-menu a {
    display: inline-block;
    color: var(--vb-violet-2);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
}

.vb-footer-legal a:hover,
.vb-footer-nav a:hover,
.vb-footer .mod-menu a:hover {
    color: #fff;
}

.vb-footer-disclaimer {
    margin: 0;
    max-width: 52rem;
    font-size: 0.78rem;
    line-height: 1.55;
    color: rgba(196, 181, 253, 0.72);
}

.vb-footer a { color: var(--vb-violet-2); }
.vb-copy { margin: 0; font-size: 0.85rem; color: var(--vb-muted); }

/* Component overrides (Bootstrap + portal) */
.vb-component .card {
    background: var(--vb-panel);
    border: 1px solid var(--vb-border);
    color: var(--vb-text);
    backdrop-filter: var(--vb-glass);
}

.vb-component .card-header {
    background: rgba(124, 58, 237, 0.12);
    color: var(--vb-mist);
    border-bottom: 1px solid var(--vb-border);
}

.vb-component .list-group-item {
    background: transparent;
    color: var(--vb-text);
    border-color: rgba(255, 255, 255, 0.06);
}

.vb-component h1, .vb-component h2, .vb-component h3 {
    color: #f5f3ff;
    text-shadow: 0 0 24px rgba(167, 139, 250, 0.2);
}

.vb-component .text-muted { color: var(--vb-muted) !important; }

.vb-component .btn-primary {
    background: linear-gradient(135deg, var(--vb-violet), #5b21b6);
    border: 1px solid var(--vb-violet-2);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

.vb-component .btn-primary:hover {
    background: linear-gradient(135deg, #8b5cf6, var(--vb-violet));
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.5);
}

.vb-component .btn-outline-light {
    color: var(--vb-text);
    border-color: rgba(167, 139, 250, 0.45);
}

.vb-component .btn-outline-light:hover {
    background: rgba(124, 58, 237, 0.2);
    border-color: var(--vb-mist);
    color: #fff;
}

/* Hero homepage (portal) */
.veilborn-portal.vb-hero {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 4rem 2rem;
    background:
        url('../images/hero-veil.svg') center/cover no-repeat,
        radial-gradient(ellipse 80% 60% at 50% 40%, rgba(124, 58, 237, 0.35), transparent 70%),
        linear-gradient(160deg, #0f0820 0%, #1a0a32 40%, #05040a 100%) !important;
    border: none !important;
    box-shadow: inset 0 0 120px rgba(124, 58, 237, 0.15) !important;
}

.veilborn-portal.vb-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(5, 4, 10, 0.85));
    pointer-events: none;
}

.veilborn-portal.vb-hero > * { position: relative; z-index: 1; }

.veilborn-portal.vb-hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #f5f3ff, var(--vb-mist), var(--vb-glow));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: vb-shimmer 6s ease-in-out infinite;
}

@keyframes vb-shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}

.veilborn-portal.vb-hero .lead {
    font-size: 1.15rem;
    max-width: 640px;
    margin: 0 auto 1.5rem;
    color: var(--vb-muted);
}

.veilborn-portal.vb-hero .btn-lg {
    margin: 0.25rem;
    padding: 0.65rem 1.4rem;
}

.vb-nav-links { justify-content: center; }

@media (max-width: 992px) {
    .vb-main.has-left, .vb-main.has-right, .vb-main.has-both { grid-template-columns: 1fr; }
    .vb-aside { position: static; }
}

@media (max-width: 680px) {
    .vb-header-bar { gap: 0.5rem; }
}

.vb-body .jmodedit,
.vb-body .jmenuedit,
.vb-body [role="tooltip"],
.vb-body .mod-preview,
.vb-body .mod-preview-info,
.vb-body .mod-preview-wrapper,
.vb-body div[id^="tip-"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* Blood splash intro */
.vb-blood-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;
}

.vb-blood-splash--active {
    display: flex;
    animation: vb-blood-screen-in 0.35s ease-out forwards;
}

.vb-blood-splash--fade {
    animation: vb-blood-screen-out 2.2s ease-in forwards;
}

.vb-blood-splash__flash {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 42% 38%, rgba(255, 45, 45, 0.75) 0%, rgba(196, 30, 58, 0.45) 28%, transparent 62%),
        radial-gradient(circle at 50% 50%, rgba(127, 10, 24, 0.55) 0%, rgba(5, 4, 10, 0.92) 75%);
    opacity: 0;
    animation: vb-blood-flash 0.45s ease-out forwards;
}

.vb-blood-splash__splats {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.vb-blood-splat {
    position: absolute;
    background: center / contain no-repeat url('../images/blood-splash.svg');
    filter: drop-shadow(0 0 40px rgba(255, 45, 45, 0.75));
    opacity: 0;
    animation: vb-blood-splat-pop 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.vb-blood-splat--a {
    width: 62vmin;
    height: 62vmin;
    left: 4%;
    top: 8%;
    animation-delay: 0.05s;
}

.vb-blood-splat--b {
    width: 48vmin;
    height: 48vmin;
    right: 6%;
    top: 18%;
    animation-delay: 0.12s;
}

.vb-blood-splat--c {
    width: 44vmin;
    height: 44vmin;
    left: 30%;
    bottom: 4%;
    animation-delay: 0.18s;
}

.vb-blood-splash__img {
    position: relative;
    z-index: 2;
    width: min(110vw, 980px);
    height: auto;
    transform: scale(0.55);
    opacity: 0;
    animation: vb-blood-hit 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.06s forwards;
    filter: drop-shadow(0 0 80px rgba(255, 45, 45, 0.95)) drop-shadow(0 0 140px rgba(196, 30, 58, 0.65));
}

@keyframes vb-blood-screen-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes vb-blood-screen-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes vb-blood-flash {
    0% { opacity: 0; transform: scale(1.15); }
    25% { opacity: 1; }
    100% { opacity: 0.35; transform: scale(1); }
}

@keyframes vb-blood-splat-pop {
    0% { transform: scale(0.15); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scale(1); opacity: 0.85; }
}

@keyframes vb-blood-hit {
    0% { transform: scale(1.55); opacity: 0; }
    35% { transform: scale(0.92); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

body.vb-blood-intro {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .vb-blood-decor__splat {
        animation: none;
        opacity: 0.38;
    }
    .vb-blood-splash--active {
        display: flex;
        animation: none;
        opacity: 1;
    }
    .vb-blood-splash--fade {
        animation: vb-blood-screen-out 0.8s ease-in forwards;
    }
    .vb-blood-splash__flash,
    .vb-blood-splash__img,
    .vb-blood-splat {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Fixed overlays — fuori dal flusso layout (cookie, accessibilità Joomla) */
.vb-overlays {
    position: fixed !important;
    inset: 0;
    z-index: 99980;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: visible;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
}

/* Figli diretti di body usati come overlay: niente spazio sotto il footer (flex column) */
body.vb-body > .vb-overlays,
body.vb-body > #vb-cookie-banner,
body.vb-body > #vb-cookie-tab,
body.vb-body > #accessibilityIcon,
body.vb-body > #accessibilityMenu,
body.vb-body > ._access-icon,
body.vb-body > ._access-menu {
    flex: none !important;
    align-self: auto !important;
}

.vb-overlays > *,
.vb-overlays #accessibilityIcon,
.vb-overlays #accessibilityMenu,
.vb-overlays ._access-menu,
.vb-overlays ._access-icon {
    pointer-events: auto;
}

.vb-cookie-banner {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 99990 !important;
    margin: 0 !important;
    padding: 0.75rem clamp(0.75rem, 3vw, 1.25rem) calc(0.75rem + env(safe-area-inset-bottom, 0px));
    width: 100% !important;
    max-width: none !important;
    pointer-events: none;
}

.vb-cookie-banner.is-visible,
.vb-cookie-banner:not([hidden]) {
    pointer-events: auto;
}

#accessibilityIcon,
button#accessibilityIcon,
._access-icon {
    position: fixed !important;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    right: 16px !important;
    left: auto !important;
    top: auto !important;
    z-index: 99991 !important;
    margin: 0 !important;
    width: 48px !important;
    height: 48px !important;
}

html[dir="rtl"] #accessibilityIcon,
html[dir="rtl"] button#accessibilityIcon,
html[dir="rtl"] ._access-icon {
    right: auto !important;
    left: 16px !important;
}

.vb-cookie-open #accessibilityIcon,
.vb-cookie-open button#accessibilityIcon {
    bottom: calc(168px + env(safe-area-inset-bottom, 0px)) !important;
}

#accessibilityMenu,
._access-menu {
    z-index: 99992 !important;
}

.vb-cookie-tab {
    position: fixed !important;
    left: 0 !important;
    right: auto !important;
    z-index: 99989 !important;
}
