/* The deck — twelve full-screen cards, swiped one at a time.
   Set like a film poster: a title block in the upper third,
   lots of black, small details near the foot.
   Phone first; desktop keeps the same rules, laid out wider. */

:root{
  --fell:"IM Fell English", "EB Garamond", Garamond, serif;
}

html,
body.deck-page{
  height:100%;
  overflow:hidden;
  overscroll-behavior:none;
}

body.deck-page{
  position:fixed;
  inset:0;
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
}

.deck{
  position:fixed;
  inset:0;
  overflow:hidden;
  touch-action:none;
  cursor:grab;
  background:var(--night);
}

.deck.is-dragging{
  cursor:grabbing;
}

/* ---------- a card ---------- */

.card{
  position:absolute;
  inset:0;
  display:grid;
  /* top air · title block · air · smaller words · air · number */
  grid-template-rows:1.15fr auto 1.25fr auto .8fr auto;
  justify-items:center;
  padding:
    calc(env(safe-area-inset-top) + 36px)
    calc(env(safe-area-inset-right) + 24px)
    calc(env(safe-area-inset-bottom) + 28px)
    calc(env(safe-area-inset-left) + 24px);
  text-align:center;
  color:var(--silver);
  visibility:hidden;
  will-change:transform, opacity;
  background:
    radial-gradient(ellipse 80% 45% at 50% 34%, rgba(200,199,194,.04), transparent 72%),
    var(--night);
}

.card.is-near{
  visibility:visible;
}

.deck.is-animating .card{
  transition:
    transform .38s cubic-bezier(.2,.8,.25,1),
    opacity .38s cubic-bezier(.2,.8,.25,1);
}

/* ---------- title block ---------- */

.card-head{
  grid-row:2;
  width:100%;
}

/* small spaced capitals above the title, like "THE" */
.card-sign{
  margin:0 0 clamp(18px, 3vh, 28px);
  font-family:var(--fell);
  font-size:clamp(1rem, 4.2vw, 1.2rem);
  font-weight:400;
  letter-spacing:.42em;
  text-indent:.42em; /* keeps spaced caps optically centred */
  text-transform:uppercase;
}

/* the word — one size for every card, set so the longest fits */
.card-word{
  margin:0;
  font-family:var(--fell);
  font-size:min(4.4rem, calc((100vw - 48px) / 10.3));
  font-weight:400;
  line-height:1;
  letter-spacing:.16em;
  text-indent:.16em;
  text-transform:uppercase;
  white-space:nowrap;
}

/* italic line beneath, like a subtitle */
.card-dates{
  margin:clamp(18px, 3vh, 28px) 0 0;
  font-style:italic;
  font-size:clamp(1.15rem, 4.8vw, 1.35rem);
}

/* ---------- the smaller words, a few to a line ---------- */

.card-keys{
  grid-row:4;
  margin:0;
  font-style:italic;
  font-size:clamp(1.2rem, 5vw, 1.4rem);
  line-height:1.75;
}

.pair{
  display:block;
}

.dot{
  margin:0 .55em;
  font-style:normal;
  color:var(--silver-faint);
}

.pair-dot{
  display:none;
}

/* ---------- number at the foot, like a release date ---------- */

.card-folio{
  grid-row:6;
  margin:0;
  font-family:var(--fell);
  font-size:.95rem;
  letter-spacing:.3em;
  text-indent:.3em;
  color:var(--silver-dim);
}

/* Connected sign for the performer: two small dots either side of the numeral,
   · IV ·  — always in place (so nothing shifts), visible only once linked. */
.card-folio::before,
.card-folio::after{
  content:"\00b7";
  display:inline-block;
  opacity:0;
  transition:opacity 1.2s var(--ease);
}

.card-folio::before{ margin-right:.35em; }
.card-folio::after{ margin-left:.05em; }  /* the numeral's own spacing makes up the rest */

.is-linked .card-folio::before,
.is-linked .card-folio::after{
  opacity:1;
}

.deck-noscript{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  margin:0;
  font-style:italic;
}

/* ---------- desktop / landscape: same rules, wider ---------- */

@media (min-width:900px) and (min-aspect-ratio:1/1){
  .card{
    grid-template-rows:1fr auto .9fr auto .6fr auto;
  }

  .card-sign{
    font-size:1.15rem;
  }

  .card-word{
    font-size:min(5.4rem, calc((100vw - 120px) / 9.6));
    letter-spacing:.24em;
    text-indent:.24em;
  }

  .card-keys{
    font-size:1.35rem;
  }

  .pair{
    display:inline;
  }

  .pair-dot{
    display:inline;
  }
}

@media (prefers-reduced-motion:reduce){
  .deck.is-animating .card{
    transition:opacity .2s linear;
  }
}
