/* =====================================================================
   Portale WebApp Verri – docente.verri.edu.it / studente.verri.edu.it
   Usato solo dalle home (inc/portal.php). Le sottopagine usano main.css.
   ===================================================================== */

:root {
    color-scheme: light;
    --brand-1: #1d4ed8;
    --brand-2: #7c3aed;
    --brand-3: #06b6d4;
    --hero-1: #1d4ed8;
    --hero-2: #6d28d9;
    --bg: #f4f6fb;
    --bg-2: #eaeef8;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-strong: #ffffff;
    --surface-muted: #f1f4fa;
    --text: #0f1b2d;
    --text-soft: #56657a;
    --border: rgba(15, 27, 45, 0.09);
    --border-strong: rgba(15, 27, 45, 0.16);
    --accent: var(--brand-1);
    --ring: color-mix(in srgb, var(--brand-1) 45%, transparent);
    --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06), 0 2px 8px rgba(15, 27, 45, 0.05);
    --shadow: 0 2px 4px rgba(15, 27, 45, 0.04), 0 12px 32px rgba(15, 27, 45, 0.09);
    --shadow-lg: 0 24px 60px rgba(15, 27, 45, 0.18);
    --radius: 22px;
    --radius-sm: 14px;
    --header-height: 34px;
    --footer-height: 34px;
    --dock-h: 0px;
    --page-width: 1240px;
    --font: "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "SF Pro Display", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --ticker-accent: var(--brand-1);
    --ticker-text: var(--text);
    --ticker-title-text: #ffffff;
}

.role-studente {
    --brand-1: #0f766e;
    --brand-2: #2563eb;
    --brand-3: #f59e0b;
    --hero-1: #0f766e;
    --hero-2: #1d4ed8;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #070b16;
    --bg-2: #0c1222;
    --surface: rgba(20, 27, 45, 0.72);
    --surface-strong: #111829;
    --surface-muted: #172036;
    --text: #e9eefb;
    --text-soft: #9aa7c0;
    --border: rgba(160, 180, 230, 0.11);
    --border-strong: rgba(160, 180, 230, 0.2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --ticker-text: var(--text);
}
:root[data-theme="dark"].role-docente { --brand-1: #5b8cff; --brand-2: #a78bfa; --brand-3: #22d3ee; }
:root[data-theme="dark"].role-studente { --brand-1: #2dd4bf; --brand-2: #60a5fa; --brand-3: #fbbf24; }
:root[data-theme="dark"] { --accent: color-mix(in srgb, var(--brand-1) 85%, white); }

* { box-sizing: border-box; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(var(--header-height) + 18px) 0 calc(var(--footer-height) + var(--dock-h) + 28px);
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--accent); }

.p-sr {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.p-skip {
    position: fixed; top: -60px; left: 12px; z-index: 100;
    padding: 10px 16px; border-radius: 10px;
    background: var(--brand-1); color: #fff; font-weight: 700; text-decoration: none;
    transition: top .2s;
}
.p-skip:focus { top: calc(var(--header-height) + 8px); }

.p-ico {
    width: 1em; height: 1em; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Sfondo "aurora" ---------- */
.p-aurora {
    position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
    background:
        radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--brand-2) 10%, transparent), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, color-mix(in srgb, var(--brand-1) 10%, transparent), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.p-aurora span {
    position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
    filter: blur(80px); opacity: .22;
    animation: p-drift 26s ease-in-out infinite alternate;
}
.p-aurora span:nth-child(1) { background: var(--brand-1); top: -18vmax; left: -10vmax; }
.p-aurora span:nth-child(2) { background: var(--brand-2); top: 10vmax; right: -16vmax; animation-duration: 32s; animation-delay: -8s; }
.p-aurora span:nth-child(3) { background: var(--brand-3); bottom: -24vmax; left: 30vw; opacity: .14; animation-duration: 38s; animation-delay: -14s; }
[data-theme="dark"] .p-aurora span { opacity: .18; }
[data-theme="dark"] .p-hero { box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06); }

@keyframes p-drift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
    100% { transform: translate3d(-4vmax, 7vmax, 0) scale(.94); }
}

/* ---------- Ticker in alto / in basso ---------- */
.header, .footer {
    position: fixed; left: 0; width: 100%; z-index: 40;
    background: var(--surface-strong);
    box-shadow: var(--shadow-sm);
}
.header { top: 0; }
.footer { bottom: var(--dock-h); }
.breakingNews { height: var(--header-height); border-width: 0 !important; border-radius: 0; }
.breakingNews > .bn-title { background: linear-gradient(120deg, var(--brand-1), var(--brand-2)) !important; }
.breakingNews > .bn-title > span { border-left-color: var(--brand-2) !important; }
.breakingNews > .bn-title > h2 {
    font-family: var(--font-display); font-weight: 700; letter-spacing: .02em;
    font-size: 14px !important; text-transform: uppercase;
}
.breakingNews > ul > li > a { font-family: var(--font); }
.breakingNews > ul > li > a > span { color: var(--brand-1) !important; font-weight: 700; }
[data-theme="dark"] .breakingNews > ul > li > a > span { color: var(--accent) !important; }

/* ---------- Layout ---------- */
.p-main {
    width: min(var(--page-width), calc(100% - 32px));
    margin: 0 auto;
    position: relative;
}

/* ---------- Hero ---------- */
.p-hero {
    position: relative;
    border-radius: calc(var(--radius) + 8px);
    overflow: hidden;
    color: #fff;
    isolation: isolate;
    box-shadow: var(--shadow-lg);
    animation: p-rise .7s var(--ease) both;
}
.p-hero-bg {
    position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(600px 300px at 85% 20%, color-mix(in srgb, var(--brand-3) 45%, transparent), transparent 70%),
        radial-gradient(500px 400px at 10% 110%, color-mix(in srgb, var(--hero-2) 80%, transparent), transparent 70%),
        linear-gradient(125deg, var(--hero-1) 0%, var(--hero-2) 100%);
    background-size: 140% 140%;
    animation: p-hero-shift 18s ease-in-out infinite alternate;
}
.p-hero-bg::after {
    content: ""; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
    background-size: 34px 34px;
    -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 10%, transparent 70%);
            mask-image: radial-gradient(ellipse at 70% 40%, #000 10%, transparent 70%);
}
@keyframes p-hero-shift {
    from { background-position: 0% 0%; }
    to   { background-position: 100% 100%; }
}
.p-hero-body {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 24px;
    padding: clamp(22px, 4vw, 44px) clamp(22px, 4.5vw, 52px);
}
.p-kicker {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 0 14px; padding: 6px 12px 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    backdrop-filter: blur(8px);
    font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.p-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, .7);
    animation: p-pulse 2.2s infinite;
}
@keyframes p-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); }
    70%  { box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.p-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2rem, 5.2vw, 3.6rem);
    line-height: 1.02;
    font-weight: 800;
    letter-spacing: -.03em;
    color: #fff;
    text-wrap: balance;
}
.p-title-role {
    display: block;
    background: linear-gradient(90deg, #fff 0%, color-mix(in srgb, var(--brand-3) 45%, #fff) 60%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: p-shine 6s linear infinite;
}
@keyframes p-shine { to { background-position: 200% center; } }
.p-lead {
    margin: 12px 0 0;
    max-width: 46ch;
    font-size: clamp(.95rem, 1.6vw, 1.08rem);
    color: rgba(255,255,255,.86);
}
.p-clock {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px;
    margin-top: 20px;
}
.p-time {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.4vw, 2.3rem);
    font-weight: 700; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.p-date {
    font-size: .95rem; color: rgba(255,255,255,.82);
    text-transform: capitalize;
}

.p-hero-art {
    position: relative;
    width: clamp(150px, 20vw, 220px);
    aspect-ratio: 1;
    display: grid; place-items: center;
}
.p-portrait {
    position: relative; z-index: 1;
    width: 74%; height: auto; aspect-ratio: 1; object-fit: cover;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,.85);
    box-shadow: 0 18px 40px rgba(0,0,0,.35);
    animation: p-float 7s ease-in-out infinite;
}
@keyframes p-float {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50%      { transform: translateY(-8px) rotate(1.5deg); }
}
.p-orbit, .p-orbit span { position: absolute; inset: 0; border-radius: 50%; }
.p-orbit span { border: 1px dashed rgba(255,255,255,.35); animation: p-spin 40s linear infinite; }
.p-orbit span:nth-child(2) { inset: 9%; border-style: solid; border-color: rgba(255,255,255,.18); animation-duration: 26s; animation-direction: reverse; }
.p-orbit span:nth-child(3) { inset: -6%; border: 0; animation-duration: 14s; }
.p-orbit span:nth-child(3)::before,
.p-orbit span:nth-child(1)::before {
    content: ""; position: absolute; top: 50%; left: -5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: color-mix(in srgb, var(--brand-3) 70%, #fff);
    box-shadow: 0 0 16px 4px color-mix(in srgb, var(--brand-3) 60%, transparent);
}
.p-orbit span:nth-child(1)::before { top: 8%; left: 78%; width: 7px; height: 7px; background: #fff; }
@keyframes p-spin { to { transform: rotate(360deg); } }
.p-badge {
    position: absolute; z-index: 2; bottom: 2%; left: 50%;
    transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.95);
    color: var(--hero-1);
    font-weight: 800; font-size: .82rem; white-space: nowrap;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
}
.p-badge .p-ico { font-size: 1.05rem; }

/* ---------- Toolbar: ricerca + tab ---------- */
.p-toolbar {
    position: sticky;
    top: calc(var(--header-height) + 10px);
    z-index: 30;
    display: flex; align-items: center; gap: 12px;
    margin: 18px 0 6px;
    padding: 8px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: saturate(1.6) blur(18px);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    animation: p-rise .7s .08s var(--ease) both;
}
.p-search {
    flex: 1 1 280px; min-width: 0;
    position: relative;
    display: flex; align-items: center; gap: 10px;
    height: 46px; padding: 0 12px 0 16px;
    border-radius: 14px;
    background: var(--surface-muted);
    border: 1px solid transparent;
    color: var(--text-soft);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.p-search:focus-within {
    background: var(--surface-strong);
    border-color: var(--brand-1);
    box-shadow: 0 0 0 4px var(--ring);
}
.p-search > .p-ico { font-size: 1.15rem; }
.p-search input {
    flex: 1; min-width: 0; height: 100%;
    border: 0; outline: 0; background: transparent;
    color: var(--text); font: inherit; font-size: 1rem;
}
.p-search input::placeholder { color: var(--text-soft); opacity: .85; }
.p-search input::-webkit-search-cancel-button { display: none; }
.p-kbd {
    font: 600 .75rem/1 var(--font);
    padding: 4px 7px; border-radius: 6px;
    border: 1px solid var(--border-strong);
    color: var(--text-soft);
}
.p-search-clear {
    display: none; place-items: center;
    width: 28px; height: 28px; padding: 0;
    border: 0; border-radius: 50%;
    background: var(--border); color: var(--text);
    cursor: pointer;
}
.p-search.has-value .p-search-clear { display: grid; }
.p-search.has-value .p-kbd { display: none; }

.p-tabs {
    position: relative;
    display: flex; gap: 2px;
    padding: 4px;
    border-radius: 14px;
    background: var(--surface-muted);
}
.p-tab {
    position: relative; z-index: 1;
    display: inline-flex; align-items: center; gap: 7px;
    height: 38px; padding: 0 14px;
    border: 0; border-radius: 10px;
    background: transparent;
    color: var(--text-soft);
    font: 600 .9rem/1 var(--font);
    cursor: pointer;
    transition: color .25s;
    white-space: nowrap;
}
.p-tab .p-ico { font-size: 1.05rem; }
.p-tab:hover { color: var(--text); }
.p-tab.active { color: #fff; }
.p-tab-ink {
    position: absolute; z-index: 0; top: 4px; left: 0;
    height: 38px; width: 0;
    border-radius: 10px;
    background: linear-gradient(120deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-1) 40%, transparent);
    transition: transform .45s var(--ease), width .45s var(--ease), opacity .2s;
    opacity: 0;
}
.p-tab:focus-visible, .p-dock-item:focus-visible, .p-tile:focus-visible,
.p-switch:focus-visible, .p-select:focus-visible, .frame-back:focus-visible, .p-chip:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

/* ---------- Sezioni ---------- */
.p-section { display: none; padding-top: 18px; }
.p-section.active { display: block; animation: p-fade .45s var(--ease) both; }
.p-section[hidden] { display: none !important; }
.p-section-title {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 16px;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.6vw, 1.75rem);
    font-weight: 800; letter-spacing: -.02em;
    color: var(--text);
}
.p-section-title .p-ico {
    width: 38px; height: 38px; padding: 8px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 8px 18px color-mix(in srgb, var(--brand-1) 35%, transparent);
}
.p-block-title {
    display: flex; align-items: center; gap: 8px;
    margin: 26px 0 12px;
    font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
    color: var(--text-soft);
}
.p-card > .p-block-title { margin-top: 0; }
.p-block-title .p-ico { font-size: 1.05rem; color: var(--brand-1); }
[data-theme="dark"] .p-block-title .p-ico { color: var(--accent); }

@keyframes p-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes p-rise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- Card servizi ---------- */
.p-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.p-grid--featured { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.p-tile {
    --c1: #3b82f6; --c2: #1d4ed8;
    position: relative;
    display: flex; align-items: center; gap: 14px;
    min-height: 86px;
    padding: 16px 16px 16px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    isolation: isolate;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
    animation: p-tile-in .55s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 45ms + 60ms);
    -webkit-tap-highlight-color: transparent;
}
@keyframes p-tile-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.p-tile::before {
    /* bagliore che segue il puntatore */
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--c1) 22%, transparent), transparent 65%);
    opacity: 0; transition: opacity .3s;
}
.p-tile::after {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 70%, transparent), transparent 45%, color-mix(in srgb, var(--c2) 50%, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity .3s;
}
.p-tile:hover, .p-tile:focus-visible {
    transform: translateY(-4px);
    border-color: transparent;
    box-shadow: 0 18px 40px color-mix(in srgb, var(--c2) 22%, transparent), var(--shadow);
}
.p-tile:hover::before, .p-tile:hover::after, .p-tile:focus-visible::after { opacity: 1; }
.p-tile:active { transform: translateY(-1px) scale(.985); transition-duration: .1s; }

.p-tile-icon {
    position: relative;
    display: grid; place-items: center;
    width: 52px; height: 52px; flex-shrink: 0;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(140deg, var(--c1), var(--c2));
    box-shadow: 0 8px 18px color-mix(in srgb, var(--c2) 38%, transparent), inset 0 1px 0 rgba(255,255,255,.35);
    transition: transform .45s var(--ease);
}
.p-tile-icon .p-ico { font-size: 1.55rem; stroke-width: 1.9; }
.p-tile:hover .p-tile-icon { transform: rotate(-6deg) scale(1.07); }

.p-tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.p-tile-title {
    font-family: var(--font-display);
    font-weight: 750; font-size: 1.04rem; letter-spacing: -.01em; line-height: 1.2;
}
.p-tile-sub {
    font-size: .84rem; color: var(--text-soft); line-height: 1.3;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.p-tile-go {
    display: grid; place-items: center;
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 50%;
    color: var(--text-soft);
    background: var(--surface-muted);
    transition: transform .35s var(--ease), background .35s, color .35s;
}
.p-tile-go .p-ico { font-size: .95rem; }
.p-tile:hover .p-tile-go {
    color: #fff;
    background: var(--c2);
    transform: translateX(3px);
}

/* card in evidenza */
.p-tile--lg {
    min-height: 132px;
    padding: 22px;
    color: #fff;
    border: 0;
    background:
        radial-gradient(300px 160px at 100% 0%, rgba(255,255,255,.28), transparent 70%),
        linear-gradient(135deg, var(--c1), var(--c2));
    box-shadow: 0 16px 36px color-mix(in srgb, var(--c2) 35%, transparent);
}
.p-tile--lg .p-tile-icon {
    width: 62px; height: 62px; border-radius: 18px;
    background: rgba(255,255,255,.2);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
    backdrop-filter: blur(6px);
}
.p-tile--lg .p-tile-icon .p-ico { font-size: 1.8rem; }
.p-tile--lg .p-tile-title { font-size: 1.28rem; }
.p-tile--lg .p-tile-sub { color: rgba(255,255,255,.85); }
.p-tile--lg .p-tile-go { background: rgba(255,255,255,.2); color: #fff; }
.p-tile--lg:hover .p-tile-go { background: #fff; color: var(--c2); }
.p-tile--lg::before { background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.25), transparent 60%); }
.p-tile--lg::after { display: none; }
.p-tile--lg::selection { background: transparent; }

/* palette card */
.p-c-blue    { --c1: #60a5fa; --c2: #2563eb; }
.p-c-indigo  { --c1: #818cf8; --c2: #4f46e5; }
.p-c-violet  { --c1: #a78bfa; --c2: #7c3aed; }
.p-c-pink    { --c1: #f472b6; --c2: #db2777; }
.p-c-red     { --c1: #fb7185; --c2: #e11d48; }
.p-c-orange  { --c1: #fb923c; --c2: #ea580c; }
.p-c-amber   { --c1: #fbbf24; --c2: #d97706; }
.p-c-green   { --c1: #4ade80; --c2: #16a34a; }
.p-c-emerald { --c1: #34d399; --c2: #059669; }
.p-c-teal    { --c1: #2dd4bf; --c2: #0d9488; }
.p-c-cyan    { --c1: #22d3ee; --c2: #0891b2; }
.p-c-sky     { --c1: #38bdf8; --c2: #0284c7; }
.p-c-slate   { --c1: #94a3b8; --c2: #475569; }

/* ---------- Pannelli ---------- */
.p-card {
    margin-top: 18px;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: p-fade .5s .15s var(--ease) both;
}
.p-weather .weatherwidget-io { display: block; border-radius: 16px; overflow: hidden; }
.p-calendar-frame {
    border-radius: 16px; overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
}
.p-calendar-frame iframe { display: block; width: 100%; height: min(720px, 75vh); border: 0; }

.p-feeds {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.p-feeds .p-card { margin-top: 18px; }
.p-feed-list { list-style: none; margin: 0; padding: 0; }
.p-feed-list li {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 6px;
    border-top: 1px solid var(--border);
}
.p-feed-list li:first-child { border-top: 0; }
.p-feed-date {
    display: grid; place-items: center;
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 12px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; line-height: 1.05;
}
.p-feed-date b { display: block; font-size: 1.05rem; color: var(--text); letter-spacing: 0; }
.p-feed-list a {
    color: var(--text); text-decoration: none; font-size: .92rem; line-height: 1.35;
    transition: color .2s;
}
.p-feed-list a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.p-chat { padding: 0; overflow: hidden; }
.p-chat-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.p-chat-head div { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.p-chat-head span { font-size: .85rem; color: var(--text-soft); }
.p-chat-avatar {
    display: grid; place-items: center;
    width: 42px; height: 42px; border-radius: 14px; color: #fff;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}
.p-chat-avatar .p-ico { font-size: 1.35rem; }
.p-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: 999px;
    background: var(--surface-muted); color: var(--text);
    font-size: .82rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.p-chip:hover { background: var(--border); }
.p-chat-frame {
    display: block; width: 100%; border: 0;
    min-height: 480px;
    height: calc(100dvh - var(--header-height) - var(--footer-height) - var(--dock-h) - 260px);
}

/* ---------- Impostazioni ---------- */
.p-settings { padding: 6px 0; }
.p-setting {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}
.p-setting:first-child { border-top: 0; }
.p-setting-label { display: flex; align-items: center; gap: 14px; min-width: 0; }
.p-setting-label > .p-ico {
    width: 38px; height: 38px; padding: 9px; border-radius: 12px;
    color: var(--brand-1); background: color-mix(in srgb, var(--brand-1) 12%, transparent);
}
[data-theme="dark"] .p-setting-label > .p-ico { color: var(--accent); }
.p-setting-label div { display: flex; flex-direction: column; line-height: 1.3; }
.p-setting-label span { font-size: .84rem; color: var(--text-soft); }
.p-switch {
    position: relative; flex-shrink: 0;
    width: 52px; height: 30px; padding: 0;
    border: 0; border-radius: 999px;
    background: var(--border-strong);
    cursor: pointer;
    transition: background .3s;
}
.p-switch span {
    position: absolute; top: 3px; left: 3px;
    width: 24px; height: 24px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    transition: transform .35s var(--ease);
}
.p-switch[aria-checked="true"] { background: linear-gradient(120deg, var(--brand-1), var(--brand-2)); }
.p-switch[aria-checked="true"] span { transform: translateX(22px); }
.p-select {
    padding: 9px 34px 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface-strong) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356657a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
    -webkit-appearance: none; appearance: none;
    color: var(--text); font: 600 .9rem var(--font);
    cursor: pointer;
}
.p-about { text-align: center; color: var(--text-soft); font-size: .82rem; margin: 22px 0 0; }

/* ---------- Ricerca ---------- */
.p-empty {
    padding: 40px 20px; text-align: center;
    color: var(--text-soft);
    border: 2px dashed var(--border-strong); border-radius: var(--radius);
}
body.is-searching .p-section:not(.p-results) { display: none !important; }
body.is-searching .p-results { display: block; }
body.is-searching .p-tab.active { color: var(--text-soft); }
body.is-searching .p-tab-ink { opacity: 0 !important; }

/* ---------- Frame interno (sottopagine) ---------- */
.frame-bar {
    display: none; align-items: center; gap: 12px;
    margin: 4px 0 12px;
}
.frame-bar.active { display: flex; animation: p-fade .35s var(--ease) both; }
.frame-back {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px 10px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text);
    font: 700 .9rem/1 var(--font);
    box-shadow: var(--shadow-sm);
    cursor: pointer; flex-shrink: 0;
    transition: transform .2s, box-shadow .2s;
}
.frame-back .p-ico { font-size: 1.05rem; color: var(--brand-1); }
.frame-back:hover { transform: translateX(-2px); box-shadow: var(--shadow); }
.frame-bar-title {
    font-family: var(--font-display); font-weight: 800; font-size: 1.1rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#app-frame {
    display: none; width: 100%; min-height: 400px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}
#app-frame.active { display: block; animation: p-fade .4s var(--ease) both; }
body.frame-open .p-hero, body.frame-open .p-toolbar { display: none; }
body.frame-open { padding-top: calc(var(--header-height) + 12px); }
.frame-restoring #sections-wrapper, .frame-restoring .p-hero, .frame-restoring .p-toolbar { display: none !important; }

/* ---------- Dock mobile ---------- */
.p-dock { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .p-toolbar { flex-wrap: wrap; }
    .p-tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
    .p-tabs::-webkit-scrollbar { display: none; }
    .p-tab { flex: 1 0 auto; justify-content: center; }
}

@media (max-width: 700px) {
    :root { --header-height: 30px; --footer-height: 30px; --dock-h: calc(68px + env(safe-area-inset-bottom, 0px)); }
    body { font-size: 15px; padding-top: calc(var(--header-height) + 12px); }
    .p-main { width: calc(100% - 24px); }

    .p-hero { border-radius: var(--radius); }
    .p-hero-body { grid-template-columns: 1fr auto; gap: 12px; padding: 20px 18px 18px; }
    .p-kicker { font-size: .66rem; margin-bottom: 10px; padding: 5px 10px 5px 8px; white-space: nowrap; }
    .p-kicker-city { display: none; }
    .p-title { font-size: clamp(1.6rem, 8vw, 2.2rem); }
    .p-lead { display: none; }
    .p-clock { margin-top: 10px; gap: 0 10px; }
    .p-time { font-size: 1.5rem; }
    .p-date { font-size: .82rem; }
    .p-hero-art { width: 104px; }
    .p-portrait { border-width: 3px; }
    .p-badge { font-size: .68rem; padding: 5px 9px; bottom: -4%; }
    .p-badge .p-ico { display: none; }

    .p-toolbar { top: calc(var(--header-height) + 8px); margin: 12px 0 0; padding: 6px; border-radius: 18px; }
    .p-search { height: 44px; }
    .p-kbd { display: none; }
    .p-tabs { display: none; }

    .p-section { padding-top: 14px; }
    .p-section-title { font-size: 1.3rem; margin-bottom: 12px; }
    .p-section-title .p-ico { width: 34px; height: 34px; padding: 7px; border-radius: 11px; }

    .p-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .p-grid--featured { grid-template-columns: 1fr; }
    .p-tile {
        flex-direction: column; align-items: flex-start; gap: 12px;
        min-height: 128px; padding: 14px;
        border-radius: 20px;
    }
    .p-tile-icon { width: 46px; height: 46px; border-radius: 14px; }
    .p-tile-icon .p-ico { font-size: 1.35rem; }
    .p-tile-title { font-size: .98rem; }
    .p-tile-sub { font-size: .78rem; }
    .p-tile-go { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; }
    .p-tile-go .p-ico { font-size: .8rem; }
    .p-tile--lg { flex-direction: row; align-items: center; min-height: 96px; padding: 18px; }
    .p-tile--lg .p-tile-go { position: static; width: 32px; height: 32px; }
    .p-tile--lg .p-tile-icon { width: 54px; height: 54px; }
    .p-tile--lg .p-tile-title { font-size: 1.15rem; }

    .p-card { padding: 16px; }
    .p-feeds { grid-template-columns: 1fr; }
    .p-chat { padding: 0; }
    .p-chat-head .p-chip { display: none; }
    .p-chat-frame { min-height: 420px; height: calc(100dvh - var(--header-height) - var(--footer-height) - var(--dock-h) - 200px); }
    .p-setting { padding: 14px 16px; }

    .p-dock {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        height: var(--dock-h);
        padding: 6px 6px env(safe-area-inset-bottom, 0px);
        background: var(--surface);
        backdrop-filter: saturate(1.8) blur(20px);
        -webkit-backdrop-filter: saturate(1.8) blur(20px);
        border-top: 1px solid var(--border);
        box-shadow: 0 -8px 30px rgba(15, 27, 45, .08);
    }
    .p-dock-item {
        position: relative; flex: 1;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        border: 0; background: transparent;
        color: var(--text-soft);
        font: 600 10.5px/1 var(--font);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: color .25s;
    }
    .p-dock-item .p-ico { font-size: 23px; transition: transform .35s var(--ease); }
    .p-dock-item::before {
        content: ""; position: absolute; top: 2px; left: 50%;
        width: 48px; height: 32px; margin-left: -24px;
        border-radius: 12px;
        background: color-mix(in srgb, var(--brand-1) 14%, transparent);
        transform: scale(.4); opacity: 0;
        transition: transform .35s var(--ease), opacity .25s;
    }
    .p-dock-item.active { color: var(--brand-1); }
    [data-theme="dark"] .p-dock-item.active { color: var(--accent); }
    .p-dock-item.active::before { transform: scale(1); opacity: 1; }
    .p-dock-item.active .p-ico { transform: translateY(-1px); }
    .p-dock-item.is-home .p-ico {
        width: 46px; height: 46px; padding: 11px;
        margin-top: -24px;
        border-radius: 50%;
        color: #fff;
        background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
        box-shadow: 0 10px 22px color-mix(in srgb, var(--brand-1) 45%, transparent), 0 0 0 5px var(--bg);
    }
    .p-dock-item.is-home::before { display: none; }
    .p-dock-item.is-home.active .p-ico { transform: translateY(-3px) scale(1.04); }
}

@media (max-width: 380px) {
    .p-grid { grid-template-columns: 1fr; }
    .p-tile { flex-direction: row; align-items: center; min-height: 76px; }
    .p-tile-go { position: static; }
}

/* ---------- Movimento ridotto ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.no-motion *, .no-motion *::before, .no-motion *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
}

/* =====================================================================
   Landing – webapp.verri.edu.it (index.php): scelta Docente / Studente
   ===================================================================== */
body.p-landing {
    padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100dvh;
}
.p-landing-main {
    width: min(1080px, calc(100% - 32px));
    padding: clamp(36px, 7vh, 72px) 0 32px;
    text-align: center;
}
.p-theme-fab {
    position: fixed; top: 16px; right: 16px; z-index: 20;
    display: grid; place-items: center;
    width: 44px; height: 44px; padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .3s var(--ease);
}
.p-theme-fab:hover { transform: rotate(-18deg) scale(1.06); }
.p-theme-fab .p-ico { font-size: 1.2rem; }
.p-theme-fab .i-sun, [data-theme="dark"] .p-theme-fab .i-moon { display: none; }
[data-theme="dark"] .p-theme-fab .i-sun { display: block; }

.p-landing-head { animation: p-rise .7s var(--ease) both; }
.p-landing-portrait {
    position: relative;
    width: clamp(150px, 16vw, 184px); aspect-ratio: 1;
    margin: 0 auto 18px;
    display: grid; place-items: center;
}
.p-landing-portrait .p-orbit span { border-color: color-mix(in srgb, var(--brand-1) 35%, transparent); }
.p-landing-portrait .p-orbit span:nth-child(2) { border-color: color-mix(in srgb, var(--brand-2) 25%, transparent); }
.p-landing-portrait .p-portrait { width: 80%; border-color: var(--surface-strong); }
.p-landing .p-kicker {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-soft);
}
.p-landing-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 7.5vw, 4.8rem);
    font-weight: 850; line-height: 1.02; letter-spacing: -.04em;
    color: var(--text);
}
.p-w {
    background-size: 200% auto;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: p-shine 7s linear infinite;
}
.p-w-doc { background-image: linear-gradient(90deg, #2563eb, #7c3aed, #2563eb); }
.p-w-stu { background-image: linear-gradient(90deg, #0d9488, #2563eb, #0d9488); animation-delay: -3.5s; }
[data-theme="dark"] .p-w-doc { background-image: linear-gradient(90deg, #7aa2ff, #c4b5fd, #7aa2ff); }
[data-theme="dark"] .p-w-stu { background-image: linear-gradient(90deg, #5eead4, #93c5fd, #5eead4); }
.p-w-o { color: var(--text-soft); font-weight: 500; font-style: italic; }
.p-landing-lead {
    margin: 16px auto 0; max-width: 48ch;
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-soft);
}

.p-roles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(14px, 2.5vw, 26px);
    margin-top: clamp(28px, 5vh, 48px);
    perspective: 1200px;
    text-align: left;
}
.p-role {
    --rx: 0deg; --ry: 0deg;
    position: relative;
    display: flex; flex-direction: column;
    padding: clamp(22px, 3vw, 32px);
    border-radius: 30px;
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    isolation: isolate;
    transform: rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform .5s var(--ease), box-shadow .4s var(--ease);
    animation: p-tile-in .7s var(--ease) both;
    animation-delay: calc(var(--i) * 120ms + 150ms);
    -webkit-tap-highlight-color: transparent;
}
.p-role--docente {
    background:
        radial-gradient(420px 260px at 100% 0%, rgba(34, 211, 238, .45), transparent 70%),
        linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%);
    box-shadow: 0 24px 50px rgba(79, 70, 229, .32);
}
.p-role--studente {
    background:
        radial-gradient(420px 260px at 100% 0%, rgba(251, 191, 36, .45), transparent 70%),
        linear-gradient(135deg, #0f766e 0%, #1d4ed8 100%);
    box-shadow: 0 24px 50px rgba(13, 148, 136, .32);
}
.p-role::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background-image:
        linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 30px 30px;
    -webkit-mask-image: radial-gradient(ellipse at 80% 10%, #000 5%, transparent 60%);
            mask-image: radial-gradient(ellipse at 80% 10%, #000 5%, transparent 60%);
}
.p-role-glow {
    position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 30%), rgba(255,255,255,.22), transparent 60%);
    opacity: 0; transition: opacity .3s;
}
.p-role:hover { box-shadow: 0 34px 70px rgba(15, 27, 45, .35); }
.p-role:hover .p-role-glow { opacity: 1; }
.p-role:active { transform: scale(.985); transition-duration: .12s; }
.p-role:focus-visible { outline: 4px solid var(--ring); outline-offset: 4px; }

.p-role-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.p-role-avatar img {
    display: block;
    width: clamp(84px, 11vw, 120px); height: auto;
    filter: drop-shadow(0 14px 18px rgba(0,0,0,.25));
    transition: transform .6s var(--ease);
}
.p-role:hover .p-role-avatar img { transform: translateY(-6px) rotate(-4deg) scale(1.04); }
.p-role-kicker {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.25);
    font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.p-role-name {
    margin-top: 18px;
    font-family: var(--font-display);
    font-size: clamp(2rem, 4.4vw, 2.9rem);
    font-weight: 850; letter-spacing: -.03em; line-height: 1;
}
.p-role-text {
    margin-top: 10px;
    font-size: clamp(.93rem, 1.5vw, 1.02rem);
    line-height: 1.45;
    color: rgba(255,255,255,.88);
    max-width: 40ch;
}
.p-role-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.p-role-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 11px; border-radius: 12px;
    background: rgba(255,255,255,.14);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    font-size: .82rem; font-weight: 600;
}
.p-role-chip .p-ico { font-size: .95rem; }
.p-role-cta {
    display: inline-flex; align-items: center; gap: 10px;
    align-self: flex-start;
    margin-top: 24px;
    padding: 13px 22px;
    border-radius: 999px;
    background: #fff;
    color: #0f1b2d;
    font-weight: 800; font-size: 1rem;
    box-shadow: 0 10px 24px rgba(0,0,0,.2);
    transition: gap .35s var(--ease), padding .35s var(--ease);
}
.p-role--docente .p-role-cta { color: #3730a3; }
.p-role--studente .p-role-cta { color: #0f766e; }
.p-role:hover .p-role-cta { gap: 16px; padding-right: 18px; }
.p-role-last {
    position: absolute; top: 18px; right: 18px;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px; border-radius: 999px;
    background: #fff; color: #0f1b2d;
    font-size: .74rem; font-weight: 800;
    box-shadow: 0 8px 18px rgba(0,0,0,.2);
    animation: p-fade .5s .8s var(--ease) both;
}
.p-role-last[hidden] { display: none; }
.p-role.is-last .p-role-kicker { visibility: hidden; }

.p-landing-note {
    display: inline-flex; align-items: center; gap: 10px;
    margin: 28px auto 0;
    padding: 12px 18px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: .92rem; text-align: left;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    animation: p-fade .6s .5s var(--ease) both;
}
.p-landing-note .p-ico { font-size: 1.3rem; color: var(--brand-1); }
[data-theme="dark"] .p-landing-note .p-ico { color: var(--accent); }
.p-landing-note strong { color: var(--text); }

.p-share { margin-top: 30px; animation: p-fade .6s .6s var(--ease) both; }
.p-share-title {
    margin: 0 0 12px;
    font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: var(--text-soft);
}
.p-share-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.p-share-btn {
    display: grid; place-items: center;
    width: 50px; height: 50px; padding: 0;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .35s var(--ease), background .3s, color .3s, box-shadow .3s;
}
.p-share-btn .p-ico { font-size: 1.3rem; }
.p-share-btn:hover { transform: translateY(-4px); color: #fff; box-shadow: var(--shadow); }
.p-share-facebook:hover { background: #1877f2; }
.p-share-send:hover { background: #229ed9; }
.p-share-xlogo:hover { background: #111; }
.p-share-whatsapp:hover { background: #25d366; }
.p-share-native:hover { background: var(--brand-1); }
.p-share-btn:focus-visible, .p-theme-fab:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.p-share-btn[hidden] { display: none; }

.p-landing-foot {
    display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 10px;
    margin-top: 34px;
    font-size: .85rem; color: var(--text-soft);
}
.p-landing-foot a { color: var(--text-soft); text-decoration: none; font-weight: 600; }
.p-landing-foot a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 760px) {
    .p-roles { grid-template-columns: 1fr; }
    .p-role { border-radius: 26px; }
    .p-role-name { margin-top: 10px; }
    .p-landing-portrait { width: 128px; margin-bottom: 14px; }
    .p-landing .p-kicker { font-size: .66rem; }
    .p-landing-note { font-size: .86rem; }
}
@media (hover: none) {
    .p-role { transform: none; }
}
@media (max-width: 480px) {
    .p-landing-foot > span[aria-hidden] { display: none; }
    .p-landing-foot { gap: 6px 18px; }
}

/* Landing – domande frequenti */
.p-faq { margin: 34px auto 0; max-width: 760px; text-align: left; animation: p-fade .6s .55s var(--ease) both; }
.p-faq .p-share-title { text-align: center; }
.p-faq-item {
    margin-top: 10px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: box-shadow .3s, border-color .3s;
}
.p-faq-item[open] { box-shadow: var(--shadow); border-color: var(--border-strong); }
.p-faq-item summary {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 16px 18px;
    font-weight: 700; color: var(--text);
    cursor: pointer; list-style: none;
}
.p-faq-item summary::-webkit-details-marker { display: none; }
.p-faq-item summary:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 16px; }
.p-faq-ico { font-size: 1.1rem; color: var(--brand-1); transform: rotate(90deg); transition: transform .35s var(--ease); }
[data-theme="dark"] .p-faq-ico { color: var(--accent); }
.p-faq-item[open] .p-faq-ico { transform: rotate(-90deg); }
.p-faq-item p { margin: 0; padding: 0 18px 18px; color: var(--text-soft); line-height: 1.6; }

/* =====================================================================
   Esperienza d'uso 2026-11-24: preferiti, recenti, toast, installazione,
   frame con avanzamento, barra compatta, transizioni tra sezioni
   ===================================================================== */

/* Card con pulsante preferito (il bottone sta fuori dal link) */
.p-tile-wrap { position: relative; display: flex; min-width: 0; }
.p-tile-wrap > .p-tile { flex: 1; min-width: 0; padding-right: 56px; }
.p-tile-go { position: absolute; right: 12px; bottom: 12px; width: 30px; height: 30px; }
.p-tile:hover .p-tile-go { transform: translateX(3px); }
.p-fav {
    position: absolute; top: 10px; right: 12px; z-index: 2;
    display: grid; place-items: center;
    width: 30px; height: 30px; padding: 0;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    opacity: .5;
    transition: opacity .25s, transform .3s var(--ease), color .25s, background .25s;
    -webkit-tap-highlight-color: transparent;
}
.p-fav .p-ico { font-size: 1.05rem; }
.p-tile-wrap:hover .p-fav, .p-fav:focus-visible { opacity: 1; }
.p-fav:hover { background: var(--surface-muted); transform: scale(1.1); }
.p-fav[aria-pressed="true"] { opacity: 1; color: #f59e0b; }
.p-fav[aria-pressed="true"] .p-ico { fill: currentColor; }
.p-fav:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
.p-fav.pop { animation: p-pop .5s var(--ease); }
@keyframes p-pop { 0% { transform: scale(1); } 35% { transform: scale(1.45) rotate(-12deg); } 100% { transform: scale(1); } }
.p-tile-wrap:has(.p-tile--lg) .p-fav { color: rgba(255,255,255,.85); opacity: .8; }
.p-tile-wrap:has(.p-tile--lg) .p-fav:hover { background: rgba(255,255,255,.18); }
.p-tile-wrap:has(.p-tile--lg) .p-fav[aria-pressed="true"] { color: #fde68a; }
.p-tile--lg .p-tile-go { right: 18px; bottom: 18px; width: 34px; height: 34px; }
@media (hover: none) { .p-fav { opacity: .75; } }

/* Area personale in Home */
.p-personal { margin-bottom: 6px; }
.p-personal .p-block-title:first-child { margin-top: 4px; }
.p-favs .p-grid[hidden] { display: none; }
.p-favs-hint {
    display: flex; align-items: center; gap: 12px;
    margin: 0; padding: 14px 16px;
    border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
    color: var(--text-soft); font-size: .9rem;
}
.p-favs-hint .p-ico { font-size: 1.3rem; color: #f59e0b; flex-shrink: 0; }
.p-favs-hint[hidden] { display: none; }
.p-recent[hidden] { display: none; }
.p-recent-row {
    display: flex; gap: 10px;
    overflow-x: auto; scroll-snap-type: x proximity;
    padding: 2px 2px 8px; margin: 0 -2px;
    scrollbar-width: none;
}
.p-recent-row::-webkit-scrollbar { display: none; }
.p-recent-chip {
    --c1: #60a5fa; --c2: #2563eb;
    flex-shrink: 0; scroll-snap-align: start;
    display: inline-flex; align-items: center; gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text); text-decoration: none;
    font-weight: 650; font-size: .9rem; white-space: nowrap;
    transition: transform .3s var(--ease), box-shadow .3s;
    animation: p-tile-in .45s var(--ease) both;
}
.p-recent-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.p-recent-chip:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.p-recent-icon {
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 50%;
    color: #fff; background: linear-gradient(140deg, var(--c1), var(--c2));
}
.p-recent-icon .p-ico { font-size: 1rem; }

/* Ricerca: evidenziazione */
.p-results mark {
    background: color-mix(in srgb, var(--brand-3) 35%, transparent);
    color: inherit; border-radius: 4px; padding: 0 1px;
}

/* Barra compatta con logo */
.p-toolbar-logo {
    width: 0; height: 40px; flex-shrink: 0;
    border-radius: 50%;
    opacity: 0; transform: scale(.6);
    transition: width .35s var(--ease), opacity .3s, transform .35s var(--ease);
    box-shadow: 0 0 0 2px var(--surface-strong), 0 4px 10px rgba(0,0,0,.2);
}
.p-toolbar.is-stuck { box-shadow: var(--shadow-lg); }
.p-toolbar.is-stuck .p-toolbar-logo { width: 40px; opacity: 1; transform: none; margin-left: 4px; }
.p-kbd { white-space: nowrap; }

/* Frame: avanzamento e "nuova scheda" */
.frame-bar { position: relative; }
.frame-newtab { margin-left: auto; flex-shrink: 0; }
.frame-newtab .p-ico { font-size: .95rem; }
.frame-progress {
    position: absolute; left: 0; right: 0; bottom: -7px; height: 3px;
    border-radius: 3px; overflow: hidden; opacity: 0; transition: opacity .3s;
    background: color-mix(in srgb, var(--brand-1) 15%, transparent);
}
.frame-progress::before {
    content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--brand-1), var(--brand-2), var(--brand-3));
    animation: p-progress 1.1s ease-in-out infinite;
}
.frame-bar.is-loading .frame-progress { opacity: 1; }
@keyframes p-progress { from { left: -40%; } to { left: 100%; } }
.frame-bar.is-loading + #app-frame {
    background:
        linear-gradient(100deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%) 0 0 / 200% 100%,
        var(--surface-muted);
    animation: p-shimmer 1.3s linear infinite;
}
@keyframes p-shimmer { from { background-position: 150% 0, 0 0; } to { background-position: -50% 0, 0 0; } }

/* Pulsanti */
.p-btn {
    flex-shrink: 0;
    padding: 9px 18px; border: 0; border-radius: 999px;
    background: linear-gradient(120deg, var(--brand-1), var(--brand-2));
    color: #fff; font: 700 .9rem var(--font);
    cursor: pointer;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-1) 35%, transparent);
    transition: transform .25s var(--ease), box-shadow .25s;
}
.p-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px color-mix(in srgb, var(--brand-1) 40%, transparent); }
.p-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.p-btn--ghost { background: var(--surface-muted); color: var(--text); box-shadow: none; border: 1px solid var(--border-strong); }
.p-btn--ghost:hover { box-shadow: none; background: var(--border); }
.p-btn[hidden], .p-setting[hidden] { display: none; }

/* Scorciatoie da tastiera (solo dispositivi con tastiera/mouse) */
.p-shortcuts dl { margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.p-shortcuts dl div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.p-shortcuts dt { white-space: nowrap; color: var(--text-soft); font-size: .85rem; }
.p-shortcuts dd { margin: 0; font-size: .9rem; text-align: right; }
.p-shortcuts kbd, .p-kbd {
    display: inline-block; min-width: 22px; text-align: center;
    font: 700 .72rem/1 var(--font);
    padding: 4px 6px; border-radius: 6px;
    border: 1px solid var(--border-strong); border-bottom-width: 2px;
    background: var(--surface-strong); color: var(--text-soft);
}
@media (hover: none), (max-width: 700px) { .p-shortcuts { display: none; } }

/* Toast */
.p-toast {
    position: fixed; left: 50%; z-index: 80;
    bottom: calc(var(--footer-height) + var(--dock-h) + 18px);
    display: flex; align-items: center; gap: 14px;
    max-width: min(92vw, 460px);
    padding: 12px 12px 12px 18px;
    border-radius: 16px;
    background: #0f1b2d; color: #fff;
    box-shadow: 0 18px 40px rgba(0,0,0,.35);
    font-size: .92rem; font-weight: 600;
    transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
    transition: transform .4s var(--ease), opacity .3s;
}
[data-theme="dark"] .p-toast { background: #e9eefb; color: #0f1b2d; }
.p-toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.p-toast button {
    flex-shrink: 0; padding: 7px 12px; border: 0; border-radius: 10px;
    background: rgba(255,255,255,.14); color: inherit; font: 800 .85rem var(--font);
    cursor: pointer;
}
[data-theme="dark"] .p-toast button { background: rgba(15,27,45,.1); }
.p-toast button[hidden] { display: none; }

/* Banner di installazione */
.p-install {
    position: fixed; left: 50%; z-index: 70;
    bottom: calc(var(--footer-height) + var(--dock-h) + 16px);
    width: min(94vw, 520px);
    display: flex; align-items: center; gap: 14px;
    padding: 14px 14px 14px 16px;
    border-radius: 22px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, 140%); opacity: 0;
    transition: transform .55s var(--ease), opacity .4s;
}
.p-install.show { transform: translate(-50%, 0); opacity: 1; }
.p-install[hidden] { display: none; }
.p-install img { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 6px 14px rgba(0,0,0,.2); }
.p-install-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; line-height: 1.3; }
.p-install-text span { color: var(--text-soft); font-size: .85rem; }
.p-install-text .p-ico { font-size: 1rem; vertical-align: -3px; color: var(--accent); }
.p-install-close {
    flex-shrink: 0; display: grid; place-items: center;
    width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
    background: var(--surface-muted); color: var(--text-soft); cursor: pointer;
}

/* Calendario Google in tema scuro */
[data-theme="dark"] .p-calendar-frame { background: #111829; border-color: var(--border); }
[data-theme="dark"] .p-calendar-frame iframe { filter: invert(.9) hue-rotate(180deg) saturate(.85); }

/* Transizioni tra sezioni (View Transitions API) */
#sections-wrapper { view-transition-name: p-sections; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
::view-transition-old(p-sections) { animation: p-vt-out .22s ease both; }
::view-transition-new(p-sections) { animation: p-vt-in .38s var(--ease) both; }
[data-dir="next"]::view-transition-new(p-sections) { animation-name: p-vt-in-next; }
[data-dir="prev"]::view-transition-new(p-sections) { animation-name: p-vt-in-prev; }
@keyframes p-vt-out { to { opacity: 0; } }
@keyframes p-vt-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes p-vt-in-next { from { opacity: 0; transform: translateX(36px); } }
@keyframes p-vt-in-prev { from { opacity: 0; transform: translateX(-36px); } }
/* con la transizione le card non devono ripetere la propria entrata */
html:active-view-transition .p-tile { animation: none; }

@media (max-width: 700px) {
    .p-tile-wrap > .p-tile { padding-right: 14px; }
    .p-tile-go { top: auto; right: 10px; bottom: 10px; width: 26px; height: 26px; }
    .p-fav { top: 8px; right: 8px; width: 32px; height: 32px; }
    .p-tile--lg .p-tile-go { position: absolute; right: 14px; bottom: 14px; width: 30px; height: 30px; }
    .p-tile-wrap > .p-tile--lg { padding-right: 52px; }
    .frame-newtab span { display: none; }
    .frame-newtab { padding: 9px; }
    .p-toolbar.is-stuck .p-toolbar-logo { width: 36px; height: 36px; }
    .p-install { border-radius: 20px; padding: 12px; gap: 12px; }
    .p-install img { width: 44px; height: 44px; }
}
@media (max-width: 380px) {
    .p-tile-wrap > .p-tile { padding-right: 52px; }
    .p-tile-go { top: auto; bottom: 10px; }
}

/* Landing: riprendi l'ultima area */
.p-resume {
    display: inline-flex; align-items: center; gap: 10px;
    margin-top: 18px; padding: 10px 14px 10px 16px;
    border-radius: 999px;
    background: var(--surface-strong); color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-weight: 750; text-decoration: none;
    animation: p-fade .5s .5s var(--ease) both;
    transition: transform .3s var(--ease), box-shadow .3s;
}
.p-resume[hidden] { display: none; }
.p-resume:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.p-resume:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.p-resume .p-ico { color: var(--brand-1); transition: transform .3s var(--ease); }
[data-theme="dark"] .p-resume .p-ico { color: var(--accent); }
.p-resume:hover .p-ico { transform: translateX(4px); }
.p-resume-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.2); }
.p-role.is-pressed { transform: scale(.98); }

/* Lo swipe tra le sezioni non deve attivare il gesto "indietro" del browser */
html:has(.p-dock), html:has(.p-dock) body { overscroll-behavior-x: none; }

/* Correzioni dopo la verifica visiva */
.p-toast { width: max-content; }
body.install-open .p-toast { bottom: calc(var(--footer-height) + var(--dock-h) + 110px); }
@media (hover: none), (max-width: 700px) { .p-search .p-kbd { display: none; } }
@media (max-width: 700px) {
    .p-tile-wrap > .p-tile:not(.p-tile--lg) .p-tile-go { top: 14px; right: 46px; bottom: auto; }
    .p-toast { max-width: calc(100vw - 24px); font-size: .88rem; }
}
@media (max-width: 380px) {
    .p-tile-wrap > .p-tile:not(.p-tile--lg) .p-tile-go { top: 50%; right: 46px; transform: translateY(-50%); }
    .p-tile-wrap > .p-tile:not(.p-tile--lg) { padding-right: 82px; }
}

/* Frame in tema scuro: niente bordo bianco attorno alle sottopagine */
[data-theme="dark"] #app-frame { background: var(--bg); border-color: var(--border); }

/* Con un documento aperto il banner di installazione non deve coprirlo */
body.frame-open .p-install { display: none; }

/* Credit: realizzata da Smart School Italia */
.p-credit { margin: 28px 0 8px; text-align: center; }
.p-credit a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px 6px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft); text-decoration: none;
    font-size: .82rem;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    transition: color .25s, border-color .25s, box-shadow .25s, transform .25s var(--ease);
}
.p-credit img { display: block; width: 28px; height: 28px; border-radius: 50%; transition: transform .5s var(--ease); }
.p-credit strong { color: var(--text); font-weight: 750; }
.p-credit a:hover { color: var(--text); border-color: #c026a3; box-shadow: 0 6px 18px rgba(192, 38, 163, .18); transform: translateY(-1px); }
.p-credit a:hover img { transform: rotate(-12deg) scale(1.08); }
.p-credit a:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
body.frame-open .p-credit--portal, body.is-searching .p-credit--portal { display: none; }
.p-credit--landing { margin-top: 14px; }

/* Landing: posizione e animazione delle immagini delle aree */
.p-role { min-height: 330px; }
.p-role-ill {
    position: absolute; z-index: 0; top: -6px; right: -8px;
    width: clamp(170px, 17vw, 210px); height: auto;
    pointer-events: none;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .22));
    animation: p-ill-float 6s ease-in-out infinite;
    transition: transform .7s var(--ease);
}
.p-role--studente .p-role-ill { animation-delay: -3s; }
@keyframes p-ill-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.p-role:hover .p-role-ill { transform: rotate(-5deg) scale(1.06); }
.p-role-top, .p-role-name, .p-role-text, .p-role-chips, .p-role-cta { position: relative; z-index: 1; }
.p-role-top { justify-content: flex-start; min-height: 30px; }
.p-role-name { margin-top: 26px; }
.p-role-name, .p-role-text { max-width: calc(100% - clamp(140px, 14vw, 175px)); }
.p-role-chips { margin-top: 22px; }
.p-role-last { right: auto; left: clamp(22px, 3vw, 32px); top: clamp(22px, 3vw, 32px); }
@media (max-width: 760px) {
    .p-role { min-height: 0; }
    .p-role-ill { width: 138px; top: -2px; right: -6px; }
    .p-role-name { margin-top: 18px; }
    .p-role-name, .p-role-text { max-width: calc(100% - 112px); }
}

/* Landing: volto in primo piano + illustrazione alle spalle */
.p-role { min-height: 350px; }
.p-role-art {
    position: absolute; z-index: 0; top: 4px; right: 4px;
    width: clamp(220px, 21vw, 262px); aspect-ratio: 1;
    pointer-events: none;
}
.p-role-art .p-role-ill {
    position: absolute; top: -10px; right: -10px; left: auto;
    width: 70%;
    opacity: .95;
}
.p-role-face {
    position: absolute; left: 0; bottom: 0;
    width: 64%;
    animation: p-ill-float 6s ease-in-out infinite; animation-delay: -1.5s;
    transition: transform .7s var(--ease);
}
.p-role-face img { display: block; width: 100%; height: auto; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .3)); }
.p-role:hover .p-role-face { transform: translateY(-6px) rotate(-4deg) scale(1.05); }
.p-role:hover .p-role-art .p-role-ill { transform: rotate(6deg) scale(1.04); }
.p-role-name, .p-role-text { max-width: calc(100% - clamp(190px, 18vw, 225px)); }
@media (max-width: 760px) {
    .p-role { min-height: 0; }
    .p-role-art { position: relative; top: auto; right: auto; width: 210px; margin: -6px auto 4px; order: -1; }
    .p-role-name, .p-role-text { max-width: none; }
    .p-role-name { margin-top: 12px; }
    .p-role-last { left: auto; right: 18px; top: 18px; }
}

/* Landing: card a griglia (testo | volto) per evitare sovrapposizioni */
.p-role {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "head art" "chips chips" "cta cta";
    column-gap: 10px;
    align-items: start;
    min-height: 0;
}
.p-role-head { grid-area: head; display: flex; flex-direction: column; position: relative; z-index: 1; min-width: 0; }
.p-role-art { grid-area: art; position: relative; top: auto; right: auto; margin: -14px -14px -6px 0; width: clamp(200px, 19vw, 236px); }
.p-role-chips { grid-area: chips; }
.p-role-cta { grid-area: cta; justify-self: start; }
.p-role-name, .p-role-text { max-width: none; }
.p-role-name { margin-top: 22px; }
@media (max-width: 760px) {
    .p-role { grid-template-columns: minmax(0, 1fr); grid-template-areas: "art" "head" "chips" "cta"; }
    .p-role-art { margin: -8px auto 2px; width: 210px; justify-self: center; }
    .p-role-name { margin-top: 12px; }
}

/* Landing: un'unica illustrazione per area (images/area-docente.svg, images/area-studente.svg) */
.p-role-art { width: clamp(190px, 17vw, 220px); margin: -10px -8px -4px 0; }
.p-role-pic {
    display: block; width: 100%; height: auto;
    animation: p-ill-float 7s ease-in-out infinite;
    transition: transform .8s var(--ease);
}
.p-role--studente .p-role-pic { animation-delay: -3.5s; }
.p-role:hover .p-role-pic { transform: scale(1.04); }
@media (max-width: 760px) {
    .p-role-art { width: 184px; margin: -4px auto 4px; }
}

/* Tema: selettore Chiaro / Scuro / Sistema */
.p-seg { display: inline-flex; gap: 3px; padding: 4px; border-radius: 14px; background: var(--surface-muted); border: 1px solid var(--border); flex-shrink: 0; }
.p-seg button {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text-soft);
    font: 700 .85rem var(--font); cursor: pointer;
    transition: background .25s, color .25s, box-shadow .25s;
}
.p-seg button .p-ico { font-size: 1rem; }
.p-seg button:hover { color: var(--text); }
.p-seg button[aria-checked="true"] { background: var(--surface-strong); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .p-seg button[aria-checked="true"] { background: linear-gradient(120deg, var(--brand-1), var(--brand-2)); color: #fff; }
.p-seg button:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
@media (max-width: 560px) {
    .p-setting--theme { flex-direction: column; align-items: stretch; }
    .p-setting--theme .p-seg { width: 100%; }
    .p-setting--theme .p-seg button { flex: 1; justify-content: center; }
}

/* Landing: menu del tema */
.p-theme-menu {
    position: fixed; top: 68px; right: 16px; z-index: 30;
    display: flex; flex-direction: column; gap: 2px;
    min-width: 168px; padding: 6px;
    border-radius: 16px;
    background: var(--surface-strong); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform-origin: top right;
    animation: p-menu-in .25s var(--ease);
}
.p-theme-menu[hidden] { display: none; }
@keyframes p-menu-in { from { opacity: 0; transform: scale(.92) translateY(-6px); } }
.p-theme-menu button {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text);
    font: 600 .92rem var(--font); text-align: left; cursor: pointer;
}
.p-theme-menu button .p-ico { font-size: 1.1rem; color: var(--text-soft); }
.p-theme-menu button:hover, .p-theme-menu button:focus-visible { background: var(--surface-muted); outline: none; }
.p-theme-menu button[aria-checked="true"] { color: var(--brand-1); }
[data-theme="dark"] .p-theme-menu button[aria-checked="true"] { color: var(--accent); }
.p-theme-menu button[aria-checked="true"] .p-ico { color: inherit; }
.p-theme-menu .p-check { margin-left: auto; opacity: 0; }
.p-theme-menu button[aria-checked="true"] .p-check { opacity: 1; }
.p-theme-fab .i-monitor { display: none; }
.p-theme-fab[data-mode="system"] .i-sun, .p-theme-fab[data-mode="system"] .i-moon { display: none !important; }
.p-theme-fab[data-mode="system"] .i-monitor { display: block; }

/* Selettore della lingua (inc/i18n.php → verri_lang_picker) */
.p-lang {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0 30px 0 12px; height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-strong);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}
.p-lang::after {
    content: ""; position: absolute; right: 12px; top: 50%;
    width: 7px; height: 7px; margin-top: -5px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); opacity: .7; pointer-events: none;
}
.p-lang .p-ico { font-size: 1.05rem; flex-shrink: 0; }
.p-lang select {
    -webkit-appearance: none; appearance: none;
    border: 0; background: transparent; color: inherit;
    font: 700 .88rem var(--font);
    padding: 0; margin: 0; cursor: pointer;
    outline: none;
}
.p-lang select option { color: #0f1b2d; background: #fff; }
.p-lang:focus-within { outline: 3px solid var(--ring); outline-offset: 2px; }
.p-lang--hero {
    position: absolute; z-index: 3; top: 16px; right: 16px;
    height: 34px;
    color: #fff; border-color: rgba(255,255,255,.3);
    background: rgba(255,255,255,.14);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.p-lang--hero:hover { background: rgba(255,255,255,.24); }
.p-lang--landing {
    position: fixed; z-index: 20; top: 16px; left: 16px;
    height: 44px;
    background: var(--surface);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
@media (max-width: 700px) {
    .p-lang--hero { top: 10px; right: 10px; height: 30px; padding: 0 26px 0 10px; }
    .p-lang--hero select { font-size: .8rem; }
    .p-lang--hero::after { right: 10px; }
}

/* Data: maiuscola solo l'iniziale (in italiano, francese e spagnolo i mesi sono minuscoli) */
.p-date { text-transform: none; display: inline-block; }
.p-date::first-letter { text-transform: uppercase; }

/* Selettore della lingua con bandiere (sostituisce la versione con il globo) */
.p-lang { position: relative; display: inline-block; height: auto; padding: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.p-lang::after { display: none; }
.p-lang:focus-within { outline: none; }
.p-flag {
    display: block; flex-shrink: 0;
    width: 22px; height: 15px;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(15, 27, 45, .18), 0 1px 2px rgba(0, 0, 0, .15);
}
.p-lang-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: 999px;
    background: var(--surface-strong); color: var(--text);
    font: 700 .88rem var(--font);
    cursor: pointer;
    transition: background .2s, box-shadow .2s;
}
.p-lang-btn:hover { box-shadow: var(--shadow-sm); }
.p-lang-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.p-lang-caret { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: .7; transition: transform .25s var(--ease); }
.p-lang-btn[aria-expanded="true"] .p-lang-caret { transform: rotate(180deg); }
.p-lang-menu {
    position: absolute; z-index: 60; top: calc(100% + 8px); right: 0;
    min-width: 188px; margin: 0; padding: 6px; list-style: none;
    border-radius: 16px;
    background: var(--surface-strong); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform-origin: top right;
    animation: p-menu-in .22s var(--ease);
}
.p-lang-menu[hidden] { display: none; }
.p-lang-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--text); text-decoration: none;
    font: 600 .95rem var(--font);
}
.p-lang-menu a:hover, .p-lang-menu a:focus-visible { background: var(--surface-muted); outline: none; }
.p-lang-menu a[aria-current] { color: var(--brand-1); font-weight: 750; }
[data-theme="dark"] .p-lang-menu a[aria-current] { color: var(--accent); }
.p-lang-check { width: 18px; height: 18px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.p-lang-menu a[aria-current] .p-lang-check { opacity: 1; }

/* posizioni */
.p-lang--hero { position: absolute; z-index: 5; top: 16px; right: 16px; }
.p-lang--hero .p-lang-btn {
    height: 34px; color: #fff;
    border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.14);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.p-lang--hero .p-lang-btn:hover { background: rgba(255,255,255,.24); }
.p-lang--hero .p-flag { box-shadow: 0 0 0 1px rgba(255,255,255,.55), 0 1px 3px rgba(0,0,0,.25); }
.p-lang--landing { position: fixed; z-index: 30; top: 16px; left: 16px; }
.p-lang--landing .p-lang-btn { height: 44px; background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.p-lang--landing .p-lang-menu { right: auto; left: 0; transform-origin: top left; }
@media (max-width: 700px) {
    .p-lang--hero { top: 10px; right: 10px; }
    .p-lang--hero .p-lang-btn { height: 30px; padding: 0 9px; gap: 6px; font-size: .8rem; }
    .p-lang--hero .p-lang-name { display: none; }
}
@media (max-width: 420px) {
    .p-lang--landing .p-lang-name { display: none; }
}
/* il menu delle lingue deve stare sopra la barra di ricerca (sticky, z-index 30) */
.p-lang--hero { z-index: 35; }

/* Durante le transizioni animate i tocchi devono arrivare alla pagina (già aggiornata),
   non allo strato dell'animazione: altrimenti un tocco rapido dopo il cambio di sezione va perso. */
::view-transition { pointer-events: none; }

/* Con un documento aperto la barra in alto è del documento (Indietro · titolo · Nuova scheda):
   il selettore della lingua torna visibile chiudendo il documento */
body.frame-open .p-lang--hero { display: none; }
