/* ==========================================================================
   ALPHONSIANA · Fondazione Sant’Alfonso
   Palette e tipografia ricavate dal manifesto 70x100
   ========================================================================== */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/hanken-grotesk-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF,
                 U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
                 U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Colori del manifesto */
  --purple: #84204c;          /* porpora dei testi e del logo */
  --purple-soft: rgba(132, 32, 76, .55);
  --purple-line: rgba(132, 32, 76, .35);
  --robe: #450d21;            /* porpora scuro della veste */
  --paper: #ddcbc1;           /* fondo carta, centro */
  --paper-light: #e5d5cb;
  --paper-dark: #c4b1a7;      /* vignettatura ai bordi */

  --font: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --maxw: 1520px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--purple);
  font-family: var(--font);
  font-weight: 350;
  font-size: clamp(1rem, .35vw + .9rem, 1.125rem);
  line-height: 1.45;
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga";
  overflow-x: hidden;
}

/* fondo carta con vignettatura, fisso */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 80% at 60% 35%, var(--paper-light) 0%, var(--paper) 45%, var(--paper-dark) 100%);
}

/* leggera grana fotografica, come la carta del manifesto */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .3 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { display: block; max-width: 100%; height: auto; }
p, h1, h2, h3, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
  border-radius: 2px;
}

::selection { background: var(--purple); color: var(--paper-light); }

.page {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Testata
   ========================================================================== */

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5.5rem) var(--gutter) 0;
  text-align: center;
}

.hero__title {
  margin: 0 auto;
  line-height: 0;
}

.hero__title svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* le lettere del titolo entrano una dopo l'altra */
.hero__title svg path {
  opacity: 0;
  transform: translateY(18px);
  transform-box: fill-box;
  animation: letter-in 1.1s cubic-bezier(.2, .7, .2, 1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}

@keyframes letter-in {
  to { opacity: 1; transform: none; }
}

.hero__subtitle {
  margin-top: clamp(1.25rem, 2.6vw, 2.25rem);
  font-weight: 650;
  font-size: clamp(1rem, 2.35vw, 2.15rem);
  line-height: 1.12;
  letter-spacing: -.005em;
}

.hero__period {
  margin-top: clamp(1.25rem, 2.4vw, 2rem);
  padding: clamp(.75rem, 1.4vw, 1.15rem) 0;
  border-top: 1px solid var(--purple-line);
  border-bottom: 1px solid var(--purple-line);
  font-weight: 650;
  font-size: clamp(1rem, 2.05vw, 1.85rem);
  letter-spacing: .005em;
}

/* ==========================================================================
   Programma
   ========================================================================== */

.program {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.25rem) var(--gutter) 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.program__side { display: contents; }
.brand { order: 0; }
.program__days { order: 1; }
.portrait { order: 2; }

.brand {
  display: inline-block;
  width: min(300px, 78vw);
  text-decoration: none;
}

.brand img { width: 100%; }

.program__days {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 clamp(1.5rem, 3vw, 3rem);
}

/* --- Giornata --- */

.day + .day,
.col + .col { margin-top: clamp(2.75rem, 5vw, 4rem); }

.day__title {
  font-weight: 650;
  font-size: clamp(1.75rem, 2.4vw, 2.35rem);
  line-height: 1;
  letter-spacing: -.01em;
  padding-bottom: .6em;
  margin-bottom: 1.85rem;
  position: relative;
}

.day__title::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--purple);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 1s cubic-bezier(.2, .7, .2, 1) .15s;
}

/* --- Evento --- */

.event + .event {
  margin-top: 2.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--purple-line);
}

.event__time {
  font-weight: 650;
  font-size: 1.6em;
  line-height: 1.05;
  letter-spacing: -.01em;
}

.event__place,
.event__lead {
  margin-top: .3rem;
  font-size: 1.12em;
  line-height: 1.28;
}

.event__lead { font-size: 1.22em; }

.event__name {
  margin-top: 1.4rem;
  font-weight: 650;
  font-size: 1.42em;
  line-height: 1.1;
  letter-spacing: -.005em;
}

.event__text + .event__name { margin-top: 1.6rem; }

.event__text {
  margin-top: 1.05rem;
  font-size: .95em;
  line-height: 1.42;
}

.event__name--tight + .event__sub { margin-top: .2rem; }
.event__sub { font-size: .98em; line-height: 1.32; }

.event__credit {
  margin-top: 1.3rem;
  font-size: 1em;
}
.event__credit + .event__place { margin-top: .15rem; font-size: .98em; }

.event__credit strong,
.people strong { font-weight: 650; }

/* --- Ospiti --- */

.event__people {
  margin-top: 1.4rem;
  font-size: .95em;
  line-height: 1.34;
}

.people__label { margin-top: 1.15rem; }
.people__label:first-child { margin-top: 0; }

.people li {
  position: relative;
  padding-left: .85em;
}
.people li + li { margin-top: .8rem; }

.people li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: .26em;
  height: .26em;
  border-radius: 50%;
  background: currentColor;
}

.people strong { display: block; }

/* --- Giornate trascorse: restano leggibili ma più tenui --- */

.day.is-past { opacity: .55; }
.day.is-past .day__title::after { background: var(--purple-soft); }

.day.is-today .day__title::before {
  content: "";
  position: absolute;
  left: -1.1rem;
  top: .18em;
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: var(--purple);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(132, 32, 76, .45); }
  50%      { box-shadow: 0 0 0 .5rem rgba(132, 32, 76, 0); }
}

/* --- Foto --- */

.portrait {
  margin-top: -1rem;
  margin-left: calc(var(--gutter) * -1);
  margin-right: calc(var(--gutter) * -1);
  margin-bottom: -2.5rem;
  height: min(125vw, 640px);
  overflow: hidden;
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0, #000 28%, #000 82%, transparent 100%);
          mask-image:
    linear-gradient(to bottom, transparent 0, #000 28%, #000 82%, transparent 100%);
}

.portrait picture,
.portrait img {
  width: 100%;
  height: 100%;
}

.portrait img {
  object-fit: cover;
  object-position: 0% 45%;
}

/* ==========================================================================
   Piede
   ========================================================================== */

.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 2rem;
}

.partners {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.75rem 2.5rem;
}

.partners img { height: 78px; width: auto; }
.partners li:nth-child(2) img { height: 58px; }

.footer__bar {
  margin-top: 2.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--purple-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-align: center;
  font-size: .8rem;
  line-height: 1.4;
}

.footer__credit { opacity: .85; }

.footer__credit a {
  font-weight: 650;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .35s ease;
}
.footer__credit a:hover,
.footer__credit a:focus-visible { background-size: 100% 1px; }

/* ==========================================================================
   Comparsa progressiva
   ========================================================================== */

.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .day.is-past.is-visible { opacity: .55; }

.js .day.reveal .day__title::after { transform: scaleX(0); }
.js .day.reveal.is-visible .day__title::after { transform: scaleX(1); }

@media (max-width: 599px) {
  .hero__subtitle { font-size: 1.05rem; line-height: 1.2; text-wrap: balance; }
  .hero__subtitle br { display: none; }
  .hero__period { font-size: 1rem; }
}

/* ==========================================================================
   Tablet: due colonne di giornate
   ========================================================================== */

@media (min-width: 720px) {
  .program__days {
    display: block;
    columns: 2;
    column-gap: clamp(2rem, 4vw, 3.5rem);
  }
  .program__days .col { display: contents; }
  .day {
    break-inside: avoid;
    margin-bottom: clamp(2.75rem, 5vw, 4rem);
  }
  .day + .day { margin-top: 0; }

  .col + .col { margin-top: 0; }
  .portrait {
    height: 620px;
    width: 70%;
    -webkit-mask-image:
      linear-gradient(to bottom, transparent 0, #000 28%, #000 85%, transparent 100%),
      linear-gradient(to left, transparent 0, #000 25%);
    -webkit-mask-composite: source-in;
            mask-image:
      linear-gradient(to bottom, transparent 0, #000 28%, #000 85%, transparent 100%),
      linear-gradient(to left, transparent 0, #000 25%);
            mask-composite: intersect;
  }
  .portrait img { object-position: 0% 70%; }

  .footer__bar {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ==========================================================================
   Desktop: impaginazione del manifesto (logo + foto a sinistra, 3 colonne)
   ========================================================================== */

@media (min-width: 1100px) {
  .program {
    grid-template-columns: minmax(250px, 1fr) 3fr;
    gap: 0 clamp(2rem, 3vw, 3.25rem);
    padding-top: clamp(2.5rem, 4vw, 3.5rem);
  }

  .program__side {
    position: relative;
    display: flex;
    flex-direction: column;
  }

  .brand {
    width: 100%;
    max-width: 300px;
    position: relative;
    z-index: 2;
  }

  /* la figura del Santo sale dal basso a sinistra, come nel manifesto */
  .portrait {
    position: sticky;
    bottom: 0;
    margin: auto 0 0 calc(var(--gutter) * -1 - max(0px, (100vw - var(--maxw)) / 2));
    width: calc(100% + var(--gutter) + max(0px, (100vw - var(--maxw)) / 2) + 2rem);
    height: min(86vh, 860px);
    margin-bottom: 0;
    -webkit-mask-image:
      linear-gradient(to bottom, transparent 0, #000 26%, #000 88%, transparent 100%),
      linear-gradient(to left, transparent 0, #000 14%);
    -webkit-mask-composite: source-in;
            mask-image:
      linear-gradient(to bottom, transparent 0, #000 26%, #000 88%, transparent 100%),
      linear-gradient(to left, transparent 0, #000 14%);
            mask-composite: intersect;
  }

  .portrait img { object-position: 0% 100%; }

  .program__days {
    columns: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding-bottom: 2rem;
  }
  .program__days .col { display: block; }
  .col + .col { margin-top: 0; }
  .day { margin-bottom: 0; }
  .col .day + .day { margin-top: clamp(3rem, 4.5vw, 4.25rem); }

  .partners { justify-content: flex-end; gap: 2.5rem 3.5rem; }
}

@media (min-width: 1100px) and (max-height: 640px) {
  .portrait { height: 70vh; }
}

/* ==========================================================================
   Accessibilità: movimento ridotto · stampa
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__title svg path { animation: none; opacity: 1; transform: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .day.reveal .day__title::after { transform: scaleX(1); transition: none; }
  .day.is-today .day__title::before { animation: none; }
}

@media print {
  body { background: #fff; }
  body::before, .portrait { display: none; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .day.is-past { opacity: 1; }
  .program__days { display: block; columns: 2; }
  .program__days .col { display: contents; }
  .day { break-inside: avoid; margin-bottom: 1.5rem; }
}
