/* The events: a card for each function, on the ivory muslin, under a sheer organza veil.

   Each card is the letter's paper (its top, its middle repeated as far as the words need, its foot:
   the same pictures and measures as the letter, assets/events/events.css), with a small picture of
   its night in a cusped arch, the day, date and time, a thin rule in the function's colour, the
   venue, the dress code and its colours, a note, and Directions and Add to calendar.

   Over it lies its veil (.ev-veil, a button): sheer organza with a silver zari border, beads in
   the function's colour and a bead tassel at each corner, drawn as a border-image over the card so
   its border and tassels keep their shape whatever the card's height (--vw: the width its border
   spans). js/events.js lifts it and draws it aside; it lies gathered at the card's left side
   (.ev-gathered). Loose jasmine (.ev-loose) lies about the card, under its edges.

   Phones: one card under another. Upright tablets and the laptop column (and a narrower tablet
   held sideways): two by two. A wide tablet sideways: four in a row. */

.events {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--seam-h) * .5 + 34px) 14px calc(var(--seam-h) * .5 + 48px);
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

.ev-head,
.ev-list { position: relative; }

/* ------------------------------------------------------------ heading */

.ev-head {
  text-align: center;
  margin-bottom: clamp(22px, 6cqi, 40px);
}

.ev-head > * { margin: 0; }

.ev-kicker {
  font: 700 clamp(11px, 3cqi, 14px)/1.3 "Cormorant Garamond", Georgia, serif;
  letter-spacing: .28em;
  padding-left: .28em;
  text-transform: uppercase;
  color: var(--kick);
}

.ev-title { font: 400 clamp(48px, 14cqi, 84px)/1.2 "Allura", cursive; }

.ev-title .ink {
  display: inline-block;
  padding: 0 .3em .1em;
}

.ev-sub {
  font: italic 500 clamp(15px, 4.2cqi, 19px)/1.4 "Cormorant Garamond", Georgia, serif;
  color: var(--ink);
  opacity: .88;
}

/* ------------------------------------------------------------ the cards */

.ev-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  row-gap: 46px;
  width: 100%;
  max-width: 1180px;
}

.ev {
  --tone: var(--mehndi);
  position: relative;
  width: min(100% - 30px, 380px);
  container-type: inline-size;
  --vw: 103cqi;                                /* the veil's border: the card and a little more */
}

.ev[hidden] { display: none; }

.ev-nikah { --tone: var(--nikah-edge); }
.ev-baraat { --tone: var(--baraat); }
.ev-walima { --tone: var(--walima); }

@container (min-width: 600px) {
  .ev-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 70px;
    row-gap: 56px;
  }
  .ev { width: min(100%, 380px); }
  .ev:nth-child(odd) { justify-self: end; }
  .ev:nth-child(even) { justify-self: start; }
}

@container (min-width: 1080px) {
  .ev-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 64px;
  }
  .ev { width: 100%; }
}

/* the paper: its top and foot, and its middle repeated between them (as the letter's) */
.ev-face {
  position: relative;
  z-index: 1;
  isolation: isolate;
  min-height: calc(100cqi * var(--pmin));
  padding:
    calc(100cqi * var(--pin-t)) calc(100cqi * var(--pin-r))
    calc(100cqi * var(--pin-b) + 4px) calc(100cqi * var(--pin-l));
  filter: drop-shadow(0 1px 1px rgba(20, 50, 72, .16)) drop-shadow(0 10px 14px rgba(14, 40, 60, .18));
  text-align: center;
  font: 500 clamp(14px, 4.9cqi, 18px)/1.45 "Cormorant Garamond", Georgia, serif;
  color: var(--ink);
}

.ev-face::before,
.ev-face::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  pointer-events: none;
}

.ev-face::before {
  top: calc(100cqi * var(--pt));
  bottom: calc(100cqi * var(--pb));
  background-position: 0 0;
  background-size: 100% auto;
  background-repeat: repeat-y;
}

.ev-face::after {
  top: 0;
  bottom: 0;
  background-position: 50% 0, 50% 100%;
  background-size: 100% auto, 100% auto;
  background-repeat: no-repeat;
}

.ev-face > * { margin: 0; }

/* its night, in a cusped arch */
.ev-pic {
  width: 66%;
  aspect-ratio: var(--pic-r, 1);
  margin: 2px auto 10px !important;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 2px 3px rgba(20, 50, 72, .22));
}

.ev-day {
  font: 700 clamp(10px, 3.1cqi, 12.5px)/1.3 "Cormorant Garamond", Georgia, serif;
  letter-spacing: .26em;
  padding-left: .26em;
  text-transform: uppercase;
  color: var(--kick);
}

.ev-name { font: 400 clamp(40px, 15cqi, 58px)/1.12 "Allura", cursive; }

.ev-name .ink {
  display: inline-block;
  padding: 0 .28em .08em;
}

.ev-when { line-height: 1.35; }
.ev-dmy,
.ev-time { display: block; }
.ev-dmy { font-weight: 600; white-space: nowrap; }
.ev-time { font-style: italic; }

/* a thin rule in the function's colour, a bead of it in the middle */
.ev-rule {
  position: relative;
  width: 62%;
  height: 1px;
  margin: 13px auto 12px !important;
  background: linear-gradient(90deg, transparent, var(--tone) 22%, var(--tone) 78%, transparent);
  opacity: .9;
}

.ev-rule i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--tone) 55%, color-mix(in srgb, var(--tone) 60%, #1b2b38));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .7), 0 1px 2px rgba(20, 50, 72, .35);
}

.ev-place { font-weight: 700; font-size: 1.08em; line-height: 1.25; }
.ev-addr { font-style: italic; margin-bottom: 12px !important; }

.ev-label {
  font: 700 clamp(9.5px, 2.9cqi, 11.5px)/1.3 "Cormorant Garamond", Georgia, serif;
  letter-spacing: .24em;
  padding-left: .24em;
  text-transform: uppercase;
  color: var(--kick);
}

.ev-sw {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 6px 0 5px !important;
}

.ev-sw i {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .7), transparent 42%), var(--c);
  box-shadow: 0 0 0 1.5px #b7c2ca, 0 0 0 2.5px rgba(255, 255, 255, .8), 0 1px 3px rgba(20, 50, 72, .35);
}

.ev-dress-words {
  font-style: italic;
  font-size: .94em;
  line-height: 1.3;
  text-wrap: balance;
}

.ev-note {
  margin-top: 10px !important;
  font-size: .92em;
  line-height: 1.35;
  opacity: .9;
  text-wrap: balance;
}

/* Directions, and Add to calendar */
.ev-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px !important;
}

.ev-cal { position: relative; }

.ev-btn {
  display: inline-block;
  padding: 9px 14px 8px;
  border: 1px solid rgba(23, 58, 82, .42);
  border-radius: 999px;
  background: rgba(255, 255, 255, .45);
  color: var(--ink);
  font: 700 clamp(10.5px, 3.3cqi, 12.5px)/1.1 "Cormorant Garamond", Georgia, serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ev-btn-map {
  border-color: transparent;
  background: linear-gradient(180deg, #2b5a7a, #173a52);
  color: var(--pearl);
  box-shadow: 0 1px 2px rgba(20, 50, 72, .35);
}

.ev-btn:hover { filter: brightness(1.08); }
.ev-btn:focus-visible,
.ev-cal-menu a:focus-visible { outline: 2px solid var(--kick); outline-offset: 2px; }

/* the calendar's choices, opening above the button */
.ev-cal-menu {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 6px);
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: min(250px, 92vw);
  padding: 6px;
  border: 1px solid rgba(86, 113, 127, .55);
  border-radius: 12px;
  background: #fbf9f3;
  box-shadow: 0 10px 24px rgba(14, 40, 60, .25);
  text-align: left;
}

.ev-cal-menu[hidden] { display: none; }

.ev-cal-menu a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  font: 700 15px/1.2 "Cormorant Garamond", Georgia, serif;
  text-decoration: none;
}

.ev-cal-menu a small {
  display: block;
  font: italic 500 13px/1.3 "Cormorant Garamond", Georgia, serif;
  color: rgba(23, 58, 82, .72);
}

.ev-cal-menu a:hover { background: rgba(86, 113, 127, .12); }

/* ------------------------------------------------------------ the veil */

.ev-veil {
  position: absolute;
  z-index: 3;
  inset: -1.5cqi;
  margin: 0;
  padding: 0;
  border-width: 0;                             /* longhands: a border shorthand would reset the */
  border-style: solid;                         /* border-image set in assets/events/events.css */
  border-color: transparent;
  border-image-repeat: stretch;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 2px 2px rgba(20, 50, 72, .16));
  transform-origin: 0 50%;
  -webkit-tap-highlight-color: transparent;
}

.ev-veil:focus-visible { outline: 2px solid var(--kick); outline-offset: 4px; }

/* lifted and drawn aside, it lies gathered along the card's left side */
.ev-gathered {
  position: absolute;
  z-index: 2;
  top: -3%;
  bottom: -3.5%;
  left: 0;
  aspect-ratio: calc(var(--g-r, .3) * .56);
  translate: -64% 0;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(2px 3px 3px rgba(20, 50, 72, .22));
  transform-origin: 30% 50%;
  opacity: 0;
  pointer-events: none;
}

.ev.is-open .ev-gathered { opacity: 1; }
.ev.is-open .ev-veil { visibility: hidden; }

.ev-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------ loose jasmine, under the card's edges */

.ev-loose {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.ev-loose i {
  position: absolute;
  width: 10cqi;
  background-image: url(../assets/cover/petals.webp);
  background-repeat: no-repeat;
  filter: drop-shadow(1px 2px 1.5px rgba(20, 50, 70, .28));
}

.ev-loose i:nth-child(1) { right: -6%; top: 4%; rotate: 38deg; }
.ev-loose i:nth-child(2) { left: -5%; bottom: -2%; rotate: -126deg; width: 8.5cqi; }
.ev-loose i:nth-child(3) { right: -7%; bottom: 26%; rotate: 104deg; width: 9cqi; }

@media (prefers-reduced-motion: reduce) {
  .ev-veil,
  .ev-gathered { transition: none; }
}
