/* Personalizzazione rapida: modifica solo queste variabili. */
.ih-team {
    --ih-bg: #0f3aa2;
    --ih-surface: #0b2b78;
    --ih-text: #f8f5ee;
    --ih-muted: #aaa6b3;
    --ih-accent: #ecbb93;
    --ih-accent-2: #f6d7bd;
    --ih-line: rgba(255, 255, 255, .13);
    --ih-title-font: Cinzel, Georgia, serif;
    --ih-body-font: inherit;
    --ih-radius: 22px;
    --ih-effective-columns: 3;
    --ih-card-width: 440px;
    width: 100%;
    max-width: 1440px;
    margin-inline: auto;
    color: var(--ih-text);
    font-family: var(--ih-body-font);
}

.ih-team--cols-1 { --ih-effective-columns: 1; }
.ih-team--cols-2 { --ih-effective-columns: 2; }
.ih-team--cols-3 { --ih-effective-columns: 3; }
.ih-team--cols-4 { --ih-effective-columns: 4; }
.ih-team--size-small { --ih-card-width: 280px; }
.ih-team--size-medium { --ih-card-width: 350px; }
.ih-team--size-large { --ih-card-width: 430px; }

.ih-team *, .ih-team *::before, .ih-team *::after { box-sizing: border-box; }
.ih-team__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); justify-content: center; }
.ih-team--size-small .ih-team__grid, .ih-team--size-medium .ih-team__grid, .ih-team--size-large .ih-team__grid { grid-template-columns: repeat(var(--ih-effective-columns), minmax(0, min(var(--ih-card-width), 100%))); }
.ih-team--cols-1 .ih-team__grid { grid-template-columns: minmax(0, 440px); }
.ih-team--cols-2 .ih-team__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ih-team--cols-4 .ih-team__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ih-member { min-width: 0; }

.ih-card {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    color: var(--ih-text);
    text-align: left;
    border: 1px solid var(--ih-line);
    border-radius: var(--ih-radius);
    background: var(--ih-surface);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
    cursor: pointer;
    isolation: isolate;
    appearance: none;
    transition: transform .55s cubic-bezier(.2, .8, .2, 1), border-color .35s ease, box-shadow .55s ease;
}

.ih-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0);
    pointer-events: none;
    transition: box-shadow .35s ease;
}

.ih-card__media { position: relative; display: block; aspect-ratio: 4 / 4.7; overflow: hidden; background: linear-gradient(145deg, #1649bd, #0b2b78); }
.ih-team--ratio-portrait .ih-card__media { aspect-ratio: 4 / 5; }
.ih-team--ratio-tall .ih-card__media { aspect-ratio: 3 / 4; }
.ih-team--ratio-square .ih-card__media { aspect-ratio: 1 / 1; }
.ih-team--ratio-landscape .ih-card__media { aspect-ratio: 4 / 3; }
.ih-card__image { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(.86) contrast(1.04); transform: scale(1.002); transition: transform .8s cubic-bezier(.2, .8, .2, 1), filter .6s ease; }
.ih-card__placeholder { display: block; width: 100%; height: 100%; background: radial-gradient(circle at 60% 25%, rgba(236, 187, 147, .35), transparent 35%), linear-gradient(145deg, #1649bd, #0b2b78); }
.ih-card__media::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, var(--ih-surface)); }
.ih-card__glow { position: absolute; right: -30%; bottom: -18%; width: 75%; aspect-ratio: 1; border-radius: 50%; background: var(--ih-accent); opacity: .24; filter: blur(45px); transition: opacity .5s ease, transform .6s ease; }
.ih-card__mark { position: absolute; top: 18px; left: 18px; z-index: 2; display: grid; width: 42px; height: 42px; place-items: center; color: var(--ih-text); font: 700 13px/1 var(--ih-title-font); letter-spacing: .08em; border: 1px solid rgba(255,255,255,.32); border-radius: 50%; backdrop-filter: blur(8px); }
.ih-card__content { position: relative; z-index: 4; display: flex; min-height: clamp(136px, 12vw, 154px); flex-direction: column; padding: 2px clamp(18px, 2vw, 26px) 22px; }
.ih-card__role, .ih-modal__eyebrow { margin-bottom: 8px; color: var(--ih-accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; line-height: 1.4; text-transform: uppercase; }
.ih-card__name { font: 600 clamp(21px, 2vw, 29px)/1.14 var(--ih-title-font); letter-spacing: .025em; text-transform: uppercase; }
.ih-card__nickname { margin-top: 6px; color: var(--ih-muted); font-size: 13px; letter-spacing: .05em; }
.ih-card__nickname--primary { margin-top: 0; color: var(--ih-text); font: 600 clamp(21px, 2vw, 29px)/1.14 var(--ih-title-font); letter-spacing: .025em; text-transform: uppercase; }
.ih-card__name--secondary { margin-top: 8px; color: color-mix(in srgb, var(--ih-text) 78%, transparent); font: 600 clamp(14px, 1.25vw, 17px)/1.3 var(--ih-body-font); letter-spacing: .065em; }
.ih-card__cta { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: auto; padding-top: 20px; color: var(--ih-muted); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.ih-card__cta span { display: grid; width: 32px; height: 32px; place-items: center; color: var(--ih-text); border: 1px solid var(--ih-line); border-radius: 50%; transition: color .3s ease, background .3s ease, transform .4s cubic-bezier(.2,.8,.2,1); }

@media (hover: hover) {
    .ih-card:hover { transform: translateY(-10px); border-color: color-mix(in srgb, var(--ih-accent) 65%, transparent); box-shadow: 0 32px 80px rgba(0,0,0,.4), 0 0 45px color-mix(in srgb, var(--ih-accent) 16%, transparent); }
    .ih-card:hover::after { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ih-accent) 35%, transparent); }
    .ih-card:hover .ih-card__image { transform: scale(1.065); filter: saturate(1.04) contrast(1.05); }
    .ih-card:hover .ih-card__glow { opacity: .42; transform: translate(-10%, -8%) scale(1.15); }
    .ih-card:hover .ih-card__cta span { color: var(--ih-bg); background: var(--ih-accent); transform: rotate(45deg); }
}

.ih-card:focus-visible, .ih-modal__close:focus-visible { outline: 3px solid var(--ih-accent); outline-offset: 4px; }

/* Modal */
.ih-modal[hidden] { display: none; }
.ih-modal { --ih-modal-vh: 100dvh; position: fixed; top: var(--ih-modal-offset, 0px); right: 0; bottom: auto; left: 0; z-index: 2147483000; display: grid; height: var(--ih-modal-vh); place-items: center; padding: clamp(10px, 2.4vw, 28px); overflow: hidden; overscroll-behavior: contain; }
.ih-modal, .ih-modal *, .ih-modal *::before, .ih-modal *::after { box-sizing: border-box; }
.ih-modal__backdrop { position: absolute; inset: 0; background: rgba(4, 16, 48, .84); opacity: 0; backdrop-filter: blur(0); transition: opacity .38s ease, backdrop-filter .5s ease; }
.ih-modal__panel { position: relative; display: grid; grid-template-columns: minmax(250px, .82fr) minmax(0, 1.18fr); grid-template-rows: minmax(0, 1fr); width: min(1040px, 100%); height: min(var(--ih-panel-height, 760px), calc(var(--ih-modal-vh) - clamp(20px, 4.8vw, 56px))); max-height: 100%; min-height: 0; overflow: hidden; color: var(--ih-text); border: 1px solid var(--ih-line); border-radius: clamp(18px, 2vw, 30px); background: var(--ih-bg); box-shadow: 0 40px 120px rgba(0,0,0,.72); opacity: 0; transform: translateY(30px) scale(.94); transform-origin: 50% 65%; transition: opacity .32s ease, transform .62s cubic-bezier(.16, 1, .3, 1), height .35s cubic-bezier(.2, .8, .2, 1); }
.ih-modal.is-opening .ih-modal__backdrop { opacity: 1; backdrop-filter: blur(13px); }
.ih-modal.is-opening .ih-modal__panel { opacity: 1; transform: translateY(0) scale(1); }
.ih-modal.is-closing .ih-modal__backdrop { opacity: 0; backdrop-filter: blur(0); }
.ih-modal.is-closing .ih-modal__panel { opacity: 0; transform: translateY(18px) scale(.97); transition-duration: .25s; }
.ih-modal__close { position: absolute; top: 18px; right: 18px; z-index: 5; display: grid; width: 46px; height: 46px; padding: 0; place-items: center; color: #fff; font: 300 32px/1 sans-serif; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; background: rgba(5, 27, 82, .58); cursor: pointer; backdrop-filter: blur(10px); transition: transform .3s ease, background .3s ease; }
.ih-modal__close:hover { color: var(--ih-bg); background: var(--ih-accent); transform: rotate(90deg); }
.ih-modal__visual { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--ih-surface); }
.ih-modal__image, .ih-modal__placeholder { display: block; width: 100%; height: 100%; object-fit: cover; }
.ih-modal__placeholder { background: radial-gradient(circle at 50% 20%, rgba(236,187,147,.35), transparent 38%), #0b2b78; }
.ih-modal__visual-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(6,25,75,.92)); }
.ih-modal__nickname { position: absolute; left: clamp(24px, 3vw, 42px); bottom: 28px; color: rgba(255,255,255,.88); font: 500 clamp(20px, 2.5vw, 34px)/1 var(--ih-title-font); letter-spacing: .03em; }
.ih-modal__body { min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: clamp(38px, 5vw, 68px) clamp(26px, 4.5vw, 60px) 48px; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-color: var(--ih-accent) transparent; -webkit-overflow-scrolling: touch; }
.ih-modal__heading { position: relative; padding-bottom: 28px; border-bottom: 1px solid var(--ih-line); }
.ih-modal__heading::before { content: ""; position: absolute; top: -22px; left: 0; width: 56px; height: 3px; background: linear-gradient(90deg, var(--ih-accent), var(--ih-accent-2)); box-shadow: 0 0 20px var(--ih-accent); }
.ih-modal__eyebrow { margin: 0 0 11px; }
.ih-modal__title { margin: 0; color: var(--ih-text); font: 600 clamp(32px, 4.2vw, 58px)/1.04 var(--ih-title-font); letter-spacing: .02em; text-transform: uppercase; }
.ih-modal__role { margin: 12px 0 0; color: var(--ih-muted); font-size: 15px; }
.ih-modal__role strong { color: color-mix(in srgb, var(--ih-text) 88%, transparent); font-size: 17px; font-weight: 650; letter-spacing: .035em; }
.ih-modal__story { margin-top: 28px; color: color-mix(in srgb, var(--ih-text) 82%, transparent); font-size: 16px; line-height: 1.75; }
.ih-modal__story > :first-child { margin-top: 0; }
.ih-modal__story > :last-child { margin-bottom: 0; }

.ih-results { margin-top: 40px; }
.ih-results h3 { margin: 0 0 16px; color: var(--ih-text); font: 600 18px/1.2 var(--ih-title-font); letter-spacing: .11em; text-transform: uppercase; }
.ih-results__list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ih-line); }
.ih-result { display: grid; grid-template-columns: 42px 1fr auto; gap: 16px; align-items: center; margin: 0; padding: 18px 0; border-bottom: 1px solid var(--ih-line); opacity: 0; transform: translateX(18px); }
.ih-modal.is-opening .ih-result { animation: ih-result-in .5s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(180ms + var(--ih-i, 0) * 60ms); }
.ih-result:nth-child(1) { --ih-i: 1; } .ih-result:nth-child(2) { --ih-i: 2; } .ih-result:nth-child(3) { --ih-i: 3; } .ih-result:nth-child(4) { --ih-i: 4; } .ih-result:nth-child(5) { --ih-i: 5; } .ih-result:nth-child(n+6) { --ih-i: 6; }
@keyframes ih-result-in { to { opacity: 1; transform: translateX(0); } }
.ih-result__number { color: var(--ih-accent); font: 600 12px/1 var(--ih-title-font); }
.ih-result__main, .ih-result__meta { display: flex; flex-direction: column; gap: 4px; }
.ih-result__main strong, .ih-result__meta strong { color: var(--ih-text); font-size: 14px; line-height: 1.35; }
.ih-result__main small, .ih-result__meta small { color: var(--ih-muted); font-size: 12px; line-height: 1.35; }
.ih-result__meta { min-width: 74px; text-align: right; }
.ih-result__meta strong { color: var(--ih-accent); }
html.ih-modal-open, body.ih-modal-open { overflow: hidden; overscroll-behavior: none; }

/* Riepilogo risultati */
.ih-results-summary { padding: clamp(26px, 4vw, 52px); border: 1px solid var(--ih-line); border-radius: var(--ih-radius); background: var(--ih-bg); box-shadow: 0 22px 60px rgba(0, 0, 0, .22); }
.ih-results-summary__heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--ih-line); }
.ih-results-summary__eyebrow { color: var(--ih-accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.ih-results-summary__heading h2 { margin: 0; color: var(--ih-text); font: 600 clamp(25px, 3.2vw, 42px)/1.08 var(--ih-title-font); letter-spacing: .025em; text-align: right; text-transform: uppercase; }
.ih-results-summary__list { margin: 0; padding: 0; list-style: none; }
.ih-results-summary__item { display: grid; grid-template-columns: 46px minmax(0, 1.5fr) minmax(130px, .8fr) minmax(90px, auto); gap: clamp(12px, 2vw, 26px); align-items: center; padding: 18px 0; border-bottom: 1px solid var(--ih-line); }
.ih-results-summary__item:last-child { border-bottom: 0; }
.ih-results-summary__number { color: var(--ih-accent); font: 600 12px/1 var(--ih-title-font); }
.ih-results-summary__main, .ih-results-summary__athlete, .ih-results-summary__meta { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.ih-results-summary__main strong, .ih-results-summary__athlete strong, .ih-results-summary__meta strong { color: var(--ih-text); font-size: 14px; line-height: 1.35; }
.ih-results-summary__main small, .ih-results-summary__athlete small, .ih-results-summary__meta small { color: var(--ih-muted); font-size: 12px; line-height: 1.4; }
.ih-results-summary__athlete strong { color: var(--ih-accent); }
.ih-results-summary__meta { text-align: right; }

@media (max-width: 980px) {
    .ih-team--cols-3 .ih-team__grid, .ih-team--cols-4 .ih-team__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ih-team--cols-3, .ih-team--cols-4 { --ih-effective-columns: 2; }
    .ih-team--size-small .ih-team__grid, .ih-team--size-medium .ih-team__grid, .ih-team--size-large .ih-team__grid { grid-template-columns: repeat(var(--ih-effective-columns), minmax(0, min(var(--ih-card-width), 100%))); }
    .ih-modal__panel { grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); }
}

/* Notebook compatti (es. 13 pollici): meno ingombro verticale, stessa esperienza desktop. */
@media (max-height: 760px) and (min-width: 681px) {
    .ih-modal { padding: 12px; }
    .ih-modal__panel { grid-template-columns: minmax(230px, .68fr) minmax(0, 1.32fr); width: min(960px, 100%); height: min(var(--ih-panel-height, 760px), calc(var(--ih-modal-vh) - 24px)); border-radius: 20px; }
    .ih-modal__close { top: 14px; right: 14px; width: 40px; height: 40px; font-size: 28px; }
    .ih-modal__nickname { left: 26px; bottom: 22px; font-size: clamp(20px, 2.2vw, 28px); }
    .ih-modal__body { padding: 42px clamp(30px, 4vw, 48px) 34px; }
    .ih-modal__heading { padding-bottom: 20px; }
    .ih-modal__heading::before { top: -15px; }
    .ih-modal__title { font-size: clamp(30px, 3.5vw, 46px); }
    .ih-modal__role { margin-top: 9px; }
    .ih-modal__story { margin-top: 20px; font-size: 15px; line-height: 1.62; }
    .ih-results { margin-top: 26px; }
    .ih-results h3 { margin-bottom: 10px; font-size: 16px; }
    .ih-result { padding: 13px 0; }
}

@media (max-width: 680px) {
    .ih-team__grid, .ih-team--cols-2 .ih-team__grid, .ih-team--cols-3 .ih-team__grid, .ih-team--cols-4 .ih-team__grid { grid-template-columns: 1fr; }
    .ih-team { --ih-effective-columns: 1; }
    .ih-team--size-small .ih-team__grid, .ih-team--size-medium .ih-team__grid, .ih-team--size-large .ih-team__grid { grid-template-columns: minmax(0, min(var(--ih-card-width), 100%)); }
    .ih-modal { padding: 0; place-items: stretch; }
    .ih-modal__panel { display: flex; width: 100%; height: var(--ih-modal-vh); max-height: none; flex-direction: column; border: 0; border-radius: 0; overflow: hidden; overscroll-behavior: contain; transform: translateY(100%) scale(1); -webkit-overflow-scrolling: touch; }
    .ih-modal.is-opening .ih-modal__panel { transform: translateY(0) scale(1); }
    .ih-modal.is-closing .ih-modal__panel { transform: translateY(100%) scale(1); }
    .ih-modal__close { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; width: 44px; height: 44px; background: rgba(5, 27, 82, .76); }
    .ih-modal__visual { min-height: 0; height: auto; flex: 0 0 clamp(210px, 34vh, 320px); }
    .ih-modal__nickname { left: 22px; bottom: 20px; font-size: clamp(20px, 7vw, 30px); }
    .ih-modal__body { min-height: 0; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; padding: 38px 22px calc(42px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    .ih-modal__title { font-size: clamp(30px, 10vw, 44px); overflow-wrap: anywhere; }
    .ih-modal__story { font-size: 15px; line-height: 1.65; }
    .ih-results { margin-top: 32px; }
    .ih-result { grid-template-columns: 32px 1fr auto; gap: 10px; }
    .ih-results-summary { padding: 26px 20px; }
    .ih-results-summary__heading { display: block; }
    .ih-results-summary__heading h2 { margin-top: 9px; text-align: left; }
    .ih-results-summary__item { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; }
    .ih-results-summary__athlete { grid-column: 2; }
    .ih-results-summary__meta { grid-column: 3; grid-row: 1 / span 2; }
}

/* Su telefoni in orizzontale la foto e i contenuti sfruttano due colonne. */
@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    .ih-modal { padding: 0; }
    .ih-modal__panel { display: grid; grid-template-columns: minmax(190px, 40%) minmax(0, 60%); grid-template-rows: minmax(0, 1fr); width: 100%; height: var(--ih-modal-vh); max-height: none; border: 0; border-radius: 0; }
    .ih-modal__visual { width: auto; height: auto; min-height: 0; }
    .ih-modal__body { min-height: 0; overflow-y: auto; padding: 34px 44px 30px 28px; }
    .ih-modal__close { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); }
    .ih-modal__title { font-size: clamp(28px, 6vw, 42px); }
    .ih-modal__heading { padding-bottom: 20px; }
    .ih-modal__story { margin-top: 20px; }
    .ih-results { margin-top: 26px; }
}

@media (max-height: 620px) and (min-width: 681px) {
    .ih-modal { padding: 8px; }
    .ih-modal__panel { width: min(900px, 100%); height: min(var(--ih-panel-height, 760px), calc(var(--ih-modal-vh) - 16px)); }
    .ih-modal__body { padding-block: 34px 28px; }
    .ih-result { padding-block: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .ih-team *, .ih-team *::before, .ih-team *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
