/* Brunel University RFC — landing page.
   Palette: navy #050B1C, gold #E8B93B, grey for quiet detail. No third colour. */

:root {
  --navy: #050B1C;
  --navy-lift: #0A1428;
  --gold: #E8B93B;
  --grey: #8A93A6;
  --grey-light: #DCE1EA;
  --draft-bar: 3.4rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy);
  color: var(--grey-light);
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- the gate */

.gate {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--draft-bar));
  overflow: hidden;
}

/* --------------------------------------------------------------- the badge */

.badge {
  order: -1;
  padding: 1.35rem 1.25rem 1.15rem;
  text-align: center;
  animation: badge-in 700ms ease-out backwards;
}

.badge > * { animation: rise-in 700ms 60ms ease-out backwards; }

.badge__crest {
  display: block;
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 auto 0.6rem;
  border-radius: 50%;
  border: 1px solid rgba(232, 185, 59, 0.45);
}

.badge__name {
  margin: 0;
  font-family: "Big Shoulders Display", Archivo, sans-serif;
  font-weight: 800;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  line-height: 0.94;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: #fff;
}

.badge__line {
  margin: 0.45rem auto 0;
  max-width: 24rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--grey);
}

.badge__prompt {
  margin: 0.6rem 0 0;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

/* --------------------------------------------------------------- the halves */

.half {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.half + .half { border-top: 2px solid var(--gold); }

.half__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.88) contrast(1.05);
  transition: transform 600ms ease;
}

.half--womens .half__photo { object-position: 50% 32%; }
.half--mens   .half__photo { object-position: 50% 38%; }

.half::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to top,
      rgba(5, 11, 28, 0.94) 0%,
      rgba(5, 11, 28, 0.55) 46%,
      rgba(5, 11, 28, 0.30) 100%
    ),
    radial-gradient(
      60% 45% at 50% 32%,
      rgba(5, 11, 28, 0.55) 0%,
      rgba(5, 11, 28, 0) 100%
    );
}

.half__plate {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  padding: 1.25rem 1.25rem 1.15rem;
}

.half__label {
  font-family: "Big Shoulders Display", Archivo, sans-serif;
  font-weight: 800;
  font-size: clamp(3.2rem, 17vw, 5rem);
  line-height: 0.82;
  text-transform: uppercase;
  color: #fff;
}

.half__enter {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(232, 185, 59, 0.5);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--grey-light);
}

.half__enter::after {
  content: " \2192";
  color: var(--gold);
}

/* The overlay and the plate sit above the anchor's own box, so the focus
   ring is drawn as a layer of its own rather than as an outline. */
.half:focus-visible { outline: none; }

.half:focus-visible::before {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 3;
  border: 3px solid var(--gold);
  pointer-events: none;
}

/* ------------------------------------------------------------------ the seam */

.seam { display: none; }

/* ----------------------------------------------------------------- draft bar */

.draft {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.55rem 1rem;
  min-height: var(--draft-bar);
  background: var(--navy-lift);
  border-top: 1px solid rgba(138, 147, 166, 0.28);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  color: var(--grey);
}

/* ------------------------------------------------------------------ desktop */

@media (min-width: 900px) {
  :root { --draft-bar: 2.25rem; }

  .gate { flex-direction: row; }

  .half { min-height: calc(100dvh - var(--draft-bar)); }
  .half + .half { border-top: 0; }

  .half__plate {
    padding: 3rem 3.5rem 4.5rem;
  }

  /* The plates read inward, meeting at the seam like the deck of the bridge. */
  .half--womens .half__plate { align-items: flex-end; text-align: right; }
  .half--mens   .half__plate { align-items: flex-start; text-align: left; }

  .half__label { font-size: clamp(4.5rem, 7.5vw, 7.5rem); }

  .half:hover .half__photo { transform: scale(1.035); }

  .seam {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    z-index: 4;
    width: 2px;
    margin-left: -1px;
    background: linear-gradient(
      to bottom,
      rgba(232, 185, 59, 0) 0%,
      var(--gold) 22%,
      var(--gold) 78%,
      rgba(232, 185, 59, 0) 100%
    );
    transform-origin: 50% 50%;
    animation: seam-in 900ms 200ms ease-out backwards;
  }

  .badge {
    order: 0;
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 5;
    transform: translate(-50%, -50%);
    padding: 0;
    width: min(36rem, 56vw);
    transition: transform 520ms ease, width 520ms ease;
  }

  .badge__crest {
    width: 11.5rem;
    height: 11.5rem;
    margin-bottom: 1.5rem;
    transition: width 520ms ease, height 520ms ease, margin-bottom 520ms ease;
  }

  .badge__name { font-size: clamp(2.2rem, 3.3vw, 3.1rem); white-space: nowrap; }
  .badge__line { font-size: 0.88rem; }
  .badge__prompt { margin-top: 1.4rem; }
}

/* Desktop reveal: the badge alone, until a pointer arrives or focus lands.
   Skipped entirely when the visitor asks for reduced motion, and on any
   device without a fine pointer, where both halves are there from the start. */
@media (min-width: 900px) and (hover: hover) and (pointer: fine)
   and (prefers-reduced-motion: no-preference) {

  .half {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.04);
    transition: opacity 620ms ease 900ms, transform 620ms ease 900ms;
  }

  .seam { opacity: 0; transition: opacity 500ms ease 900ms; }

  .gate:hover .half,
  .gate:focus-within .half .half {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }

  .gate:hover .seam,
  .gate:focus-within .seam .seam { opacity: 1; }

  .gate:focus-within .half .half { transition-delay: 40ms; }

  .gate:focus-within .seam .seam { transition-delay: 40ms; }

  /* Opened, the badge draws back and sits astride the seam. */
  .gate:hover .badge,
  .gate:focus-within .badge .badge { width: min(26rem, 40vw); }

  .gate:hover .badge__crest,
  .gate:focus-within .badge__crest .badge__crest {
    width: 7rem;
    height: 7rem;
    margin-bottom: 0.9rem;
  }

  .gate:hover .badge__name,
  .gate:focus-within .badge__name .badge__name {
    font-size: 1.55rem;
    letter-spacing: 0.02em;
    transition: font-size 520ms ease;
  }

  .gate:hover .badge__line,
  .gate:focus-within .badge__line,
    .gate:hover .badge__prompt,
  .gate:focus-within .badge__prompt .badge__prompt {
    opacity: 0;
    transition: opacity 300ms ease;
  }
}

/* ------------------------------------------------------------------- motion */

@keyframes badge-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes seam-in {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .badge, .badge > *, .seam { animation: none; }
  .half__photo, .badge, .badge__crest { transition: none; }
}


/* ===================================================== the tap reveal ==
   Same moment as the desktop hover, armed for a touchscreen. cv-bru-gate.js
   adds .is-armed only where there is no hover, so nothing here applies unless
   the script has run and the device is a touch one. */

.gate.is-armed { flex-direction: row; }

.gate.is-armed .badge {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: min(20rem, 80vw);
  transform: translate(-50%, -50%);
  padding: 0;
  cursor: pointer;
  transition: width 520ms ease, opacity 300ms ease;
}

.gate.is-armed .badge__crest {
  width: 8.5rem;
  height: 8.5rem;
  transition: width 520ms ease, height 520ms ease;
}

.gate.is-armed .half {
  min-height: 100%;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
  transition: opacity 620ms ease, transform 620ms ease;
}

.gate.is-armed .seam {
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 4;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(
    to bottom,
    rgba(232, 185, 59, 0) 0%,
    var(--gold) 22%,
    var(--gold) 78%,
    rgba(232, 185, 59, 0) 100%
  );
  opacity: 0;
  transition: opacity 500ms ease;
}

.gate.is-armed .half + .half { border-top: 0; }

.gate.is-armed.is-open .half {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.gate.is-armed.is-open .seam { opacity: 1; }

.gate.is-armed.is-open .badge { width: min(13rem, 52vw); }
.gate.is-armed.is-open .badge__crest { width: 4.6rem; height: 4.6rem; }
.gate.is-armed.is-open .badge__line,
.gate.is-armed.is-open .badge__prompt { opacity: 0; transition: opacity 300ms ease; }
.gate.is-armed.is-open .badge__name { font-size: 1.05rem; transition: font-size 520ms ease; }

/* Two halves across a phone is a narrow column each, so the labels come down
   to fit rather than running off the side. */
.gate.is-armed .half__plate { padding: 1.1rem 0.85rem 1.4rem; }
.gate.is-armed .half__label { font-size: clamp(1.6rem, 9vw, 2.6rem); }
.gate.is-armed .half__enter { font-size: 0.7rem; }
.gate.is-armed .half--womens .half__plate { align-items: flex-start; text-align: left; }


/* On a phone each half is a narrow column, so the centre of a wide match
   photograph is the wrong part of it. The men's frame moves right, where a
   Brunel player is, rather than sitting on the opposition. */

@media (max-width: 620px) {
  .half--mens .half__photo { object-position: 82% 38%; }
  .half--womens .half__photo { object-position: 44% 30%; }
}

.gate.is-armed .half--mens .half__photo { object-position: 82% 38%; }
.gate.is-armed .half--womens .half__photo { object-position: 44% 30%; }
