/* Functions: a stack of invitation cards + big tappable date seals, fitted to one screen */
.events {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 1.6svh;
  padding: 6svh 18px 5svh;
  text-align: center;
}

.events__title {
  margin: 0;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: min(clamp(34px, 4.4svh + 10px, 68px), 10vw);
  color: var(--gold);
  line-height: 1.1;
}

.events__hint {
  margin: 0.2em 0 0;
  font-size: clamp(12px, 1.3svh + 3px, 16px);
  color: #86664a;
}

.events__body {
  position: relative;
  min-height: 0;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.events__stack {
  position: relative;
  height: 100%;
  max-height: 64svh;
  aspect-ratio: 0.62;
  max-width: calc(100vw - 120px);
  touch-action: pan-y;
}

/* one card: animated scene on top, details below, printed-card look */
.event-card {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background: #fbf6ec url("../assets/paper/paper.webp") repeat;
  background-size: 400px;
  border: 2px solid var(--gold-line);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(90, 60, 30, 0.22), inset 0 0 0 6px #fbf6ec, inset 0 0 0 7px rgba(176, 128, 58, 0.6);
  overflow: hidden;
  padding: 10px;
}

/* scene framed all round: arched top, straight sides, rounded bottom, gold double line */
.event-card__art {
  min-height: 0;
  border: 2px solid var(--gold-line);
  border-radius: 999px 999px 14px 14px / 160px 160px 14px 14px;
  box-shadow: 0 0 0 4px #fbf6ec, 0 0 0 5px rgba(176, 128, 58, 0.55);
  overflow: hidden;
  margin: 5px;
}

.event-card__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 70%;
}

.event-card__info {
  padding: 1.2svh 6px 0.4svh;
}

.event-card__name {
  margin: 0;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(26px, 3.4svh + 4px, 46px);
  color: var(--gold);
  line-height: 1.05;
}

.event-card__subtitle {
  margin: 0.1em 0 0;
  font-size: clamp(12px, 1.4svh + 2px, 17px);
  color: var(--rose);
}

.event-card__when {
  margin: 0.5svh 0 0;
  font-size: clamp(13px, 1.6svh + 3px, 19px);
  font-weight: 500;
  color: var(--rose);
}

.event-card__venue {
  margin: 0.4svh 0 0;
  font-size: clamp(12px, 1.4svh + 3px, 17px);
  color: var(--ink);
}

.event-card__address {
  margin: 0.1svh 0 0;
  font-size: clamp(11px, 1.1svh + 2px, 14px);
  color: #7a5c44;
  line-height: 1.3;
}

.event-card__actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 1svh;
  flex-wrap: wrap;
}

.event-btn {
  padding: 0.55em 1.1em;
  border: 1.5px solid var(--gold-line);
  border-radius: 999px;
  font-size: clamp(11px, 1.2svh + 3px, 15px);
  color: #7a4e1e;
  text-decoration: none;
  background: rgba(255, 250, 238, 0.7);
}

.event-btn:hover { background: #f6e6c6; }

/* arrows beside the stack */
.events__arrow {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-line);
  background: rgba(255, 250, 238, 0.9);
  color: #7a4e1e;
  font-size: 20px;
  cursor: pointer;
}

/* big gold date seals: the main, obvious way to switch */
.events__seals {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2.5vw, 22px);
}

.event-seal {
  display: grid;
  place-items: center;
  align-content: center;
  width: clamp(80px, 22vw, 116px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--gold-line);
  background: radial-gradient(circle at 35% 30%, #fff8e6, #f1dcb2);
  box-shadow: 0 3px 8px rgba(120, 80, 30, 0.2);
  color: #7a4e1e;
  cursor: pointer;
  padding: 6px;
  transition: transform 0.25s, background 0.25s;
}

.event-seal__date {
  font-size: clamp(15px, 1.8svh + 4px, 22px);
  font-weight: 600;
}

.event-seal__name {
  font-size: clamp(10.5px, 1svh + 2px, 13px);
  line-height: 1.15;
}

.event-seal.is-active {
  background: radial-gradient(circle at 35% 30%, #c0373f, #8e1c2a);
  color: #fff3dc;
  border-color: #e9c98a;
  transform: scale(1.08);
}

.events.is-single .events__arrow,
.events.is-single .events__seals,
.events.is-single .events__hint { display: none; }

/* desktop: wider cards with the scene on the left and details on the right */
@media (min-aspect-ratio: 1/1) {
  .events__stack { aspect-ratio: 1.45; max-height: 60svh; max-width: 900px; }
  .event-card { grid-template-rows: 1fr; grid-template-columns: 0.9fr 1fr; align-items: center; }
  .event-card__art { height: calc(100% - 10px); border-radius: 999px 999px 14px 14px / 180px 180px 14px 14px; }
  .event-card__info { padding: 0 2vw; }
}

.event-seal, .events__arrow { font-family: var(--font-serif); }

/* phone: the labelled date seals are the controls; side arrows would squeeze the card */
@media (max-aspect-ratio: 1/1) {
  .events__arrow { display: none; }
  .events__stack { max-width: calc(100vw - 70px); }
}

@media (min-aspect-ratio: 1/1) {
  .event-card__name { font-size: clamp(34px, 5svh, 60px); }
  .event-card__subtitle { font-size: clamp(14px, 2svh, 20px); }
  .event-card__when { font-size: clamp(16px, 2.4svh, 24px); }
  .event-card__venue { font-size: clamp(15px, 2.1svh, 21px); }
  .event-card__address { font-size: clamp(12px, 1.6svh, 16px); }
  .event-btn { font-size: clamp(13px, 1.7svh, 17px); }
}

/* date seals: weekday, date, year, function name */
.event-seal { gap: 0; padding: 4px; }
.event-seal__day, .event-seal__year { font-size: clamp(10px, 0.9svh + 2px, 12px); line-height: 1.1; letter-spacing: 0.03em; }
.event-seal__date { line-height: 1.05; }
.event-seal__name { margin-top: 1px; }

/* the time sits on its own line, right under the date */
.event-card__time { margin-top: 0.1em; }

/* keep the date seals clear of the language button's row at the bottom of the screen */
.events { padding-bottom: max(5svh, calc(42px + env(safe-area-inset-bottom, 0px))); }

/* the date seals always fit in one row, whatever the number of functions (--n set by events.js) */
.event-seal { width: min(clamp(80px, 22vw, 116px), calc((100vw - 40px - (var(--n, 3) - 1) * 8px) / var(--n, 3))); }
.events__seals { max-width: 100%; }
