/* Reivery — court galleries (Fire first).
   Builds on reivery.css. The court color appears only here, as accent. */

.court--fire { --court: var(--fire); }

/* ---------- Top mark ---------- */

.top {
  display: flex;
  justify-content: center;
  padding: 1.75rem 1rem 0;
}

.top-mark {
  font-family: var(--display);
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: .5em;
  margin-right: -.5em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color .6s var(--ease);
}
.top-mark:hover { color: var(--ink); }

/* ---------- Heading ---------- */

.court-head {
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 4.5rem) 1rem clamp(2rem, 6vh, 3.5rem);
  text-align: center;
}

.court-head h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2.4rem, 8vw, 3.8rem);
  line-height: 1.1;
  letter-spacing: .03em;
}

.court-sub {
  margin: .5rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.15rem, 3.5vw, 1.4rem);
  color: var(--court);
}

.court-line {
  margin: 1.75rem auto 0;
  padding-top: 1.5rem;
  max-width: 32ch;
  position: relative;
  font-style: italic;
  color: var(--muted);
}
.court-line::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 6rem;
  height: 1px;
  transform: translateX(-50%);
  background: var(--court);
  opacity: .8;
}

/* ---------- The cards ---------- */

.cards {
  list-style: none;
  margin: 0 auto;
  padding: 0 1rem;
  max-width: 72rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.5rem, 4vw, 2.75rem) clamp(1rem, 3vw, 2rem);
}
@media (min-width: 40rem) { .cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 60rem) { .cards { grid-template-columns: repeat(4, 1fr); } }

/* the Reiver heads the court on her own row */
.card:first-child { grid-column: 1 / -1; justify-self: center; width: min(100%, 15rem); }

.card {
  opacity: 0;
  animation: rise 1.6s var(--ease) calc(.15s + var(--i) * .09s) forwards;
}

.card-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: zoom-in;
}

/* pinstripe frame: thin outer line, dark band, inner hairline */
.card-frame {
  display: block;
  width: 100%;
  aspect-ratio: 1248 / 1824;
  padding: 5px;
  border: 1px solid rgba(176, 141, 87, .22);
  background: var(--surface);
  box-shadow:
    0 0 0 4px var(--ground),
    0 0 0 5px rgba(176, 141, 87, .1),
    0 24px 50px -24px rgba(0, 0, 0, .9);
  transition: border-color .8s var(--ease), box-shadow .8s var(--ease);
}
.card-frame picture,
.card-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-frame img {
  filter: brightness(.88);
  transition: filter .8s var(--ease);
}

.card-open:hover .card-frame,
.card-open:focus-visible .card-frame {
  border-color: var(--court);
  box-shadow:
    0 0 0 4px var(--ground),
    0 0 0 5px rgba(201, 120, 46, .25),
    0 24px 60px -20px rgba(201, 120, 46, .18);
}
.card-open:hover img,
.card-open:focus-visible img { filter: brightness(1); }

.card-num {
  margin-top: 1rem;
  font-family: var(--display);
  font-size: .8rem;
  letter-spacing: .3em;
  margin-right: -.3em;
  color: var(--court);
}
.card-name {
  margin-top: .15rem;
  font-family: var(--display);
  font-size: clamp(1.2rem, 3.4vw, 1.45rem);
  line-height: 1.2;
}
.card-rank {
  margin-top: .2rem;
  font-family: var(--display);
  font-size: .75rem;
  letter-spacing: .24em;
  margin-right: -.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.court-foot {
  margin: clamp(3rem, 10vh, 5rem) 0 clamp(3rem, 8vh, 4rem);
  text-align: center;
  font-family: var(--display);
  font-size: .85rem;
  letter-spacing: .3em;
  text-transform: uppercase;
}
.court-foot a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: .3rem;
}
.court-foot a:hover { color: var(--ink); }

/* rank-metal ring on the card number */
.card-num.ringed {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  margin-right: 0;
  letter-spacing: .08em;
  border-radius: 50%;
  position: relative;
}
.card-num.ringed::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--m2) 0 50%, var(--m1) 50% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.6px), #000 calc(100% - 1.4px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 1.6px), #000 calc(100% - 1.4px));
  opacity: .9;
}

.court-emblem { display: block; margin: 0 auto 1rem; width: 3.6rem; height: 3.6rem; }
.ring72--court { margin-top: 2.25rem; width: min(100%, 40rem); }

/* ---------- The viewer ---------- */

.viewer {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 8, 7, .97);
  color: var(--ink);
}
.viewer::backdrop { background: rgba(10, 8, 7, .9); }
.viewer[open] { display: grid; place-items: center; animation: fade .6s var(--ease); }

.viewer-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3.5rem 1rem 1.5rem;
}
.viewer-fig img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 34rem);
  max-height: calc(100svh - 14rem);
  border: 1px solid rgba(176, 141, 87, .25);
  box-shadow: 0 0 0 5px var(--ground), 0 0 0 6px rgba(201, 120, 46, .2), 0 0 120px -20px rgba(201, 120, 46, .15);
}

.viewer-cap {
  max-width: 36rem;
  text-align: center;
}
.viewer-num, .viewer-name, .viewer-rank { display: inline-block; margin: 0 .45rem; vertical-align: baseline; }
.viewer-num { font-family: var(--display); font-size: .85rem; letter-spacing: .3em; color: var(--court); }
.viewer-name { font-family: var(--display); font-size: 1.6rem; }
.viewer-rank { font-family: var(--display); font-size: .8rem; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.viewer-canon {
  display: block;
  margin: .5rem auto 0;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  opacity: .85;
}
.viewer-canon:empty { display: none; }
.viewer-canon[data-src]:not([data-src=""])::after {
  content: attr(data-src);
  display: block;
  margin-top: .3rem;
  font-style: normal;
  font-family: var(--display);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.viewer-btn,
.viewer-close {
  position: fixed;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--display);
  line-height: 1;
  cursor: pointer;
  transition: color .4s var(--ease);
}
.viewer-btn:hover, .viewer-close:hover,
.viewer-btn:focus-visible, .viewer-close:focus-visible { color: var(--ink); }
.viewer-btn { top: 50%; transform: translateY(-50%); font-size: 3rem; padding: 1rem .75rem; }
.viewer-prev { left: max(.25rem, 2vw); }
.viewer-next { right: max(.25rem, 2vw); }
.viewer-close { top: .75rem; right: 1rem; font-size: 2.2rem; padding: .5rem; }

@media (max-width: 40rem) {
  .viewer-btn { top: auto; bottom: .5rem; transform: none; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; opacity: 1; }
  .viewer[open] { animation: none; }
}

/* frames in the rank's metal (body.metal-frames): a quiet echo of the number ring.
   Split ranks: top/left in the first metal, bottom/right in the second. Hover still burns in the court colour. */
.metal-frames .card-open[style*="--m1"] .card-frame {
  border-color: color-mix(in srgb, var(--m1) 88%, transparent) color-mix(in srgb, var(--m2) 88%, transparent)
                color-mix(in srgb, var(--m2) 88%, transparent) color-mix(in srgb, var(--m1) 88%, transparent);
  box-shadow:
    0 0 0 4px var(--ground),
    0 0 0 5px color-mix(in srgb, var(--m1) 38%, transparent),
    0 0 34px -16px var(--m1),
    0 24px 50px -24px rgba(0, 0, 0, .9);
}

/* the Reiver: a mark, not a number; her caption stays on one line */
.card-num--mark { font-size: .9rem; letter-spacing: 0; margin-right: 0; color: var(--fire); }
.card:first-child .card-rank { white-space: nowrap; }
