/* ==========================================================================
   Il Tempio della Luce – pagina MESSAGGI (carica dopo base.css)
   Pop-up delle preghiere con :target (solo CSS), foto che scorrono in CSS.
   ========================================================================== */

.page-messaggi em { font-style: italic; }

/* ---------- Hero + versetto ---------- */

.ms-hero img { width: 100%; height: auto; aspect-ratio: 1280 / 800; object-fit: cover; object-position: center 40%; }

.ms-verse { padding: 56px 24px 64px; background: #fbf6ea; text-align: center; }
.ms-verse blockquote { max-width: 880px; margin: 0 auto; }
.ms-verse p { font-style: italic; font-size: clamp(1.3rem, 2.5vw, 2rem); line-height: 1.3; color: var(--taupe); }

/* ---------- Sezioni ---------- */

.ms-section { text-align: center; padding: 0 24px 88px; }
.ms-section .vline { height: 72px; }

.ms-h2 {
  margin-top: 40px;
  font-weight: 600;
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--taupe);
}

.ms-sub { margin-top: 12px; font-family: var(--sans-ui); font-size: 1.2rem; text-transform: uppercase; color: #bc6c56; }
.ms-sub--it { font-family: var(--serif); font-style: italic; text-transform: none; font-size: 1.5rem; color: var(--taupe); }

/* ---------- Testimonianze ---------- */

.ms-testi { background: #fbf6ea; }

.ms-strip { margin: 40px -24px 0; overflow: hidden; }
.ms-strip-track { display: flex; gap: 16px; width: max-content; animation: ms-scroll 60s linear infinite; }
.ms-strip:hover .ms-strip-track { animation-play-state: paused; }
.ms-strip li { flex: 0 0 auto; }
.ms-strip img { height: 200px; width: auto; max-width: none; border-radius: 12px; box-shadow: 0 2px 8px rgba(71, 44, 33, .15); }

@keyframes ms-scroll { to { transform: translateX(calc(-50% - 8px)); } }

.ms-carousel { position: relative; max-width: 1160px; margin: 40px auto 0; }
.ms-quotes {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 56px) / 3);
  gap: 28px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 6px 4px 28px;
  align-items: stretch;
  scrollbar-width: none;
}
.ms-quotes::-webkit-scrollbar { display: none; }
.ms-quotes:focus-visible { outline: 2px solid var(--rose); outline-offset: 4px; }

.ms-arrow {
  display: none;
  position: absolute;
  top: calc(50% - 14px);
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1px solid #ecd9cc;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(71, 44, 33, .2);
  font: 400 2rem/1 var(--serif);
  color: var(--brown);
  cursor: pointer;
  transition: opacity .25s ease, background .25s ease;
}
.ms-arrow:hover { background: #fbf1ea; }
.ms-arrow[disabled] { opacity: .3; cursor: default; }
.ms-arrow--prev { left: -22px; }
.ms-arrow--next { right: -22px; }
.js .ms-arrow { display: block; }

.ms-quote-card {
  margin: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: 26px 28px 22px;
  border: 1px solid #ecd9cc;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(71, 44, 33, .14);
  text-align: left;
}
.ms-quote-card blockquote { margin: 0; flex: 1; }
.ms-quote-card p { font-style: italic; font-size: 1.3rem; line-height: 1.3; color: var(--taupe); }
.ms-quote-card figcaption { margin-top: 18px; text-align: right; font-size: 1.15rem; color: var(--taupe); }

/* ---------- Meditazioni guidate ---------- */

.ms-med {
  padding-bottom: 110px;
  background: linear-gradient(rgba(238, 238, 244, .8), rgba(238, 238, 244, .72)), url(../img/messaggi/cosmo.jpg) center / cover no-repeat;
}

.ms-med-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  max-width: 1040px;
  margin: 56px auto 0;
  align-items: start;
}

.ms-med-card {
  --c: #e0b93e; --btn: #fdf1b8; --t: #6b4a00;
  overflow: hidden;
  border: 2px solid var(--c);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .25);
  text-align: left;
}
.ms-med--blue   { --c: #1e5b8a; --btn: #bfdcf5; --t: #1e5b8a; }
.ms-med--orange { --c: #e59a5b; --btn: #f6c6a8; --t: #c0652a; }

.ms-med-card img { width: 100%; aspect-ratio: 800 / 530; object-fit: cover; }
.ms-med-body { padding: 22px 22px 26px; }
.ms-med-body h3 { min-height: 2.5em; font-weight: 700; font-size: 1.06rem; letter-spacing: .04em; line-height: 1.25; text-transform: uppercase; color: var(--t); }

.ms-listen {
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 14px;
  border: 1px solid var(--c);
  border-radius: 12px;
  background: var(--btn);
  font-family: var(--sans-ui);
  font-size: 1.06rem;
  color: var(--t);
  transition: filter .25s ease;
}
a.ms-listen:hover, button.ms-listen:hover { filter: brightness(.95); }
.ms-listen .ico-pause { display: none; }
.ms-listen.is-playing .ico-play { display: none; }
.ms-listen.is-playing .ico-pause { display: inline; }
.ms-ico { flex: 0 0 auto; }

/* ---------- Preghiere ---------- */

.ms-pray { background: #fbf9f4; }

.ms-pray-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 340px));
  gap: 28px 24px;
  justify-content: center;
  margin-top: 56px;
}

.ms-pray-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d9b4aa;
  border-radius: 12px;
  background: #fafafa;
  box-shadow: 0 14px 24px rgba(71, 44, 33, .18);
  text-align: left;
}
.ms-pray-card img { width: 100%; aspect-ratio: 900 / 405; object-fit: cover; }
.ms-pray-body { display: flex; flex-direction: column; flex: 1; padding: 24px 24px 28px; }
.ms-pray-body h3 { min-height: 2.5em; font-weight: 700; font-size: 1.06rem; letter-spacing: .04em; line-height: 1.25; text-transform: uppercase; color: var(--brown); }
.ms-pray-excerpt { margin-top: 18px; flex: 1; font-style: italic; font-size: 1.1rem; line-height: 1.3; color: var(--taupe); }

.ms-read {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 8px 14px;
  border: 1px solid #d9a99b;
  border-radius: 12px;
  background: #f9eeee;
  font-family: var(--sans-ui);
  font-size: 1.06rem;
  color: #b97c6a;
  transition: background-color .25s ease;
}
.ms-read:hover { background: #f3dcdc; }

/* ---------- Pop-up preghiera ---------- */

.ms-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ms-modal:target { display: flex; }

.ms-modal-backdrop { position: absolute; inset: 0; background: rgba(40, 32, 28, .72); }

.ms-modal-box {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 36px 36px 40px;
  border: 1px solid #d9b4aa;
  border-radius: 12px;
  background: #fbf6ea;
  text-align: center;
}

.ms-modal-close {
  position: absolute;
  top: 8px; right: 12px;
  width: 36px; height: 36px;
  line-height: 34px;
  text-align: center;
  font-size: 2rem;
  color: var(--brown);
  z-index: 2;
}
.ms-modal-close:hover { color: var(--rose); }

.ms-modal-head { position: relative; border-radius: 12px; overflow: hidden; }
.ms-modal-head img { width: 100%; aspect-ratio: 900 / 405; object-fit: cover; }
.ms-modal-head h3 {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 36px 16px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, .6), transparent);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: .05em;
  text-align: left;
  text-transform: uppercase;
  color: #fff;
}

.ms-modal-text { margin-top: 28px; font-size: 1.12rem; line-height: 1.35; color: var(--brown-dark); }
.ms-modal-text p + p { margin-top: 1.1em; }
.ms-modal-text--tight p + p { margin-top: .3em; }
.ms-modal-sign { margin-top: 1.8em !important; font-style: italic; text-align: right; font-size: 1rem; }

/* ---------- Libri ---------- */

.ms-books { background: #fff; }

.ms-book {
  width: min(460px, 100%);
  margin: 48px auto 0;
  overflow: hidden;
  border: 2px solid #3b82c4;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(71, 44, 33, .22);
  text-align: left;
}
.ms-book img { width: 100%; aspect-ratio: 900 / 521; object-fit: cover; }
.ms-book-body { padding: 22px 26px 28px; }
.ms-book-body h3 { font-weight: 600; font-size: 1.2rem; color: #6c63b0; }
.ms-book-body p { margin-top: 12px; font-size: .95rem; line-height: 1.3; color: var(--brown-dark); }

.ms-buy {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  padding: 12px 20px;
  border: 1px solid #3b82c4;
  border-radius: 14px;
  background: #bdd5f5;
  font-family: var(--sans-ui);
  font-size: .8rem;
  line-height: 1.3;
  color: #1c2b44;
  transition: filter .25s ease;
}
.ms-buy:hover { filter: brightness(.96); }
.ms-buy .ms-ico { color: #1e5b8a; width: 36px; height: auto; }
.ms-buy strong { color: #1e7cc4; font-weight: 600; }
.ms-buy small { font-size: .75rem; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .ms-quotes { grid-auto-columns: calc((100% - 28px) / 2); }
  .ms-med-grid { grid-template-columns: 1fr; max-width: 380px; }
  .ms-med-body h3, .ms-pray-body h3 { min-height: 0; }
}

@media (max-width: 700px) {
  .ms-quotes { grid-auto-columns: 86%; }
  .ms-arrow--prev { left: -6px; }
  .ms-arrow--next { right: -6px; }
  .ms-pray-grid { grid-template-columns: minmax(0, 360px); }
  .ms-section { padding-bottom: 64px; }
  .ms-strip img { height: 150px; }
  .ms-modal-box { padding: 32px 20px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .ms-strip { overflow-x: auto; }
  .ms-strip-track { animation: none; }
}
