:root {
  --ink: #1b1726;
  --muted: #6f697c;
  --paper: #f8f6f1;
  --card: #ffffff;
  --purple: #4b3b76;
  --purple-2: #6a5598;
  --gold: #f1bd45;
  --burgundy: #9e2344;
  --line: #e8e2d8;
  --shadow: 0 18px 50px rgba(39, 28, 62, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.shell { width: min(1160px, calc(100% - 32px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.hero {
  position: relative;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(135deg, rgba(47,31,78,.96), rgba(82,58,123,.91)),
    url("assets/programa-9-12.jpeg") center 35% / cover;
  min-height: 520px;
  display: grid;
  align-items: end;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 150px;
  background: linear-gradient(transparent, rgba(15,10,24,.48));
}
.hero__content { position: relative; z-index: 2; padding-block: 96px 72px; }
.hero h1 { font-family: "DM Serif Display", serif; font-size: clamp(3.6rem, 10vw, 7.5rem); line-height: .86; margin: 10px 0 24px; letter-spacing: -.03em; }
.hero__lead { max-width: 620px; font-size: clamp(1.05rem, 3vw, 1.35rem); color: rgba(255,255,255,.84); }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.eyebrow { margin: 0; letter-spacing: .14em; font-weight: 800; font-size: .78rem; color: var(--gold); }
.eyebrow--dark { color: var(--burgundy); }
.hero__glow { position: absolute; border-radius: 50%; filter: blur(16px); opacity: .35; }
.hero__glow--one { width: 300px; height: 300px; right: 5%; top: -80px; background: var(--gold); }
.hero__glow--two { width: 200px; height: 200px; left: 12%; bottom: -80px; background: #d45178; }

.button { border: 0; border-radius: 999px; padding: 13px 20px; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button--primary { background: var(--gold); color: #2a2140; box-shadow: 0 10px 28px rgba(241,189,69,.25); }
.button--ghost { color: white; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(12px); }
.button--full { width: 100%; }

.date-nav { position: sticky; top: 0; z-index: 20; background: rgba(248,246,241,.88); backdrop-filter: blur(15px); border-bottom: 1px solid rgba(75,59,118,.08); }
.date-nav__inner { display: flex; gap: 8px; padding-block: 10px; overflow-x: auto; scrollbar-width: none; }
.date-nav__inner::-webkit-scrollbar { display: none; }
.date-pill { flex: 0 0 auto; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 16px; padding: 9px 14px; font-weight: 700; }
.date-pill.is-active { background: var(--purple); color: white; border-color: var(--purple); }

.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 38px; padding-block: 56px 90px; align-items: start; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.section-heading h2 { margin: 4px 0 0; font-family: "DM Serif Display", serif; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; }
.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: white; }
.view-toggle__button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 700; }
.view-toggle__button.is-active { background: var(--purple); color: white; }

.filters { display: grid; grid-template-columns: 1fr 210px; gap: 12px; margin-bottom: 30px; }
.search { display: flex; align-items: center; gap: 10px; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 0 16px; }
.search svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 2; }
.search input { width: 100%; border: 0; outline: 0; padding: 15px 0; background: transparent; }
.filters select { border: 1px solid var(--line); background: white; padding: 0 14px; border-radius: 16px; color: var(--ink); }

.schedule { display: grid; gap: 28px; }
.day-section { scroll-margin-top: 94px; }
.day-section__header { display: flex; align-items: end; justify-content: space-between; gap: 18px; border-bottom: 2px solid var(--purple); padding-bottom: 12px; margin-bottom: 14px; }
.day-section__weekday { margin: 0; color: var(--burgundy); font-size: .8rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.day-section__date { margin: 0; font-family: "DM Serif Display", serif; font-size: 2.25rem; }
.day-section__count { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.events-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.event-card { display: grid; grid-template-columns: 84px 1fr; min-height: 152px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 28px rgba(49,40,66,.05); transition: transform .2s ease, box-shadow .2s ease; }
.event-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.event-card__time { background: linear-gradient(155deg, var(--purple), var(--purple-2)); color: white; display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; font-size: 1.05rem; font-weight: 800; letter-spacing: .05em; }
.event-card__time span { display: block; white-space: nowrap; transform: rotate(-90deg); transform-origin: center; -webkit-transform: rotate(-90deg); -webkit-transform-origin: center; }
.event-card__body { padding: 17px 17px 18px; }
.event-card__topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.event-card__category { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; background: #f2eef9; color: var(--purple); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.favorite { border: 0; background: transparent; color: var(--burgundy); font-size: 1.6rem; line-height: 1; }
.favorite.is-active { color: var(--burgundy); }
.event-card__title { margin: 12px 0 6px; font-size: 1.04rem; line-height: 1.25; }
.event-card__description { margin: 0; color: var(--muted); font-size: .88rem; }
.schedule.is-compact .events-grid { grid-template-columns: 1fr; }
.schedule.is-compact .event-card { grid-template-columns: 100px 1fr; min-height: 106px; }
.schedule.is-compact .event-card__time span { transform: none; -webkit-transform: none; }
.empty-state { padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

.info-card { position: sticky; top: 84px; border-radius: var(--radius); background: #eee8f6; padding: 26px; box-shadow: var(--shadow); }
.info-card h3 { font-family: "DM Serif Display", serif; font-size: 2rem; line-height: 1; margin: 8px 0 14px; }
.info-card p { color: #5e5670; }
.info-card__notice { padding: 16px; border-radius: 16px; background: white; margin: 20px 0; }
.info-card__notice strong { color: var(--burgundy); }
.info-card__notice p { margin-bottom: 0; font-size: .88rem; }
.favorites-count { text-align: center; font-size: .8rem; margin-bottom: 0; }

footer { background: #211931; color: rgba(255,255,255,.72); }
.footer__inner { min-height: 110px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
footer button { color: white; background: transparent; border: 0; font-weight: 700; }

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .info-card { position: static; order: -1; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 22px, 1160px); }
  .hero { min-height: 470px; }
  .hero__content { padding-block: 72px 48px; }
  .hero h1 { font-size: clamp(3.4rem, 20vw, 5.8rem); }
  .main-layout { padding-block: 38px 68px; gap: 26px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .filters select { min-height: 52px; }
  .events-grid { grid-template-columns: 1fr; }
  .event-card { grid-template-columns: 72px 1fr; }
  .day-section__date { font-size: 1.9rem; }
  .footer__inner { flex-direction: column; justify-content: center; text-align: center; }
}

@media (max-width: 420px) {
  .hero__actions .button { width: 100%; }
  .event-card { grid-template-columns: 62px 1fr; }
  .event-card__body { padding: 15px; }
  .date-pill { padding-inline: 12px; }
}

/* Instal·lació PWA */
.install-prompt {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(24, 17, 36, .52);
  backdrop-filter: blur(8px);
}
.install-prompt[hidden] { display: none; }
.install-prompt__card {
  width: min(100%, 470px);
  border-radius: 26px;
  padding: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 12, 34, .28);
  animation: installUp .32s ease-out;
}
.install-prompt__head { display: flex; gap: 15px; align-items: center; }
.install-prompt__icon { width: 70px; height: 70px; border-radius: 18px; box-shadow: 0 8px 22px rgba(75,59,118,.22); }
.install-prompt h2 { margin: 0 0 5px; font-size: 1.3rem; }
.install-prompt p { margin: 0; color: var(--muted); line-height: 1.45; }
.install-prompt__ios { margin-top: 14px !important; padding: 12px 14px; border-radius: 14px; background: #f2eef9; color: #4b3b76 !important; font-size: .9rem; }
.install-prompt__actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 20px; }
.install-prompt__later { border: 1px solid var(--line); background: white; color: var(--ink); }
.install-prompt__install { background: var(--purple); color: white; }
.install-prompt__install:disabled { opacity: .55; cursor: not-allowed; }
@keyframes installUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 681px) { .install-prompt { place-items: center; } }

/* Compatibilitat iOS/Safari per als horaris */
.event-card__time { -webkit-font-smoothing: antialiased; }
@supports (-webkit-touch-callout: none) {
  .event-card__time span { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
}
