/* S4 — reusable components: buttons, links, photo slots, signup + states,
   cards, red panel, header/nav, mobile menu, preview banner, 404 page. */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  height: var(--control-h);
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { opacity: 0.88; }
.btn--red { background: var(--red); color: var(--white); }
.btn--red:disabled { background: var(--red-disabled); color: var(--text); opacity: 1; cursor: progress; }
.btn--outline { border: 1.5px solid var(--line-button); color: var(--text); background: transparent; }

/* A plain text link with an arrow: "Event details", "All events", "Map". */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.text-link::after { content: "→"; text-decoration: none; }
.btn--outline:hover { opacity: 1; border-color: var(--text-subtle); }
.btn--black { background: var(--black); color: var(--white); }
.btn--sm { height: 44px; padding: 0 18px; font-size: 12px; }
@media (min-width: 700px) {
  .btn--sm { height: 48px; padding: 0 22px; font-size: 13px; }
}

/* ---------- Text link ---------- */
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  text-underline-offset: 3px;
}
.text-link:hover { color: var(--text); opacity: 1; }
.text-link--strong { font-weight: 700; color: var(--text); }

/* ---------- Photo slots ----------
   The <img> fills a fixed-ratio slot. While its src is /assets/placeholder.svg the
   striped fill shows through, and main.js adds the [bracketed] caption from the <img>'s
   data-placeholder (the caption is never in the HTML). Swapping in a real photo =
   changing the src (and alt). --photo-focus (set on the slot) picks the part of the
   photo that stays in frame when the slot crops it: "x y", default centered. */
.photo {
  position: relative;
  overflow: hidden;
  background: var(--placeholder);
}
.photo__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--photo-focus, 50% 50%);
}
.photo__caption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  /* --text-placeholder (#6E6E78) is only 3.5:1 on the stripes; --text-subtle passes. */
  color: var(--text-subtle);
}
@media (min-width: 700px) {
  .photo__caption { font-size: 11px; }
}

/* ---------- Matchup card ----------
   "TBA vs TBA" stand-in for the next-event photo; becomes the real main-event card.
   Fills the .photo slot and rearranges by the slot's own shape (container queries),
   so nothing is cropped: phone row (390×240), tablet row (16:9, 2:1), desktop stagger
   (tall, or near-square on very wide screens). All sizes are in container units. */
.matchup-card {
  position: absolute;
  inset: 0;
  container: matchup / size;
  overflow: hidden;
  background: var(--matchup-ground);
  color: var(--text);
}
/* Geometry shared by the panel, divider and VS. The divider leans 12° from vertical:
   its x runs from cx + t at the top to cx − t at the bottom, t = half the height × tan 12°. */
.matchup-card > * {
  --t: calc(50cqh * var(--matchup-lean));
  --cx: 51cqw;
  --div-top: 4px;
  --div-bottom: 8px;
  --pad-x: 4.6cqw;
  --top: calc(6.7cqh + var(--card-cut, 0px));  /* --card-cut: the section's angled top edge, when the card sits right under it */
  --name-size: min(14.2cqw, 23cqh);
  --name-room: 31cqw; /* the width one fighter's name has: left of the VS, or right of the divider */
}
.matchup-card__panel,
.matchup-card__divider,
.matchup-card__grain { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.matchup-card__panel {
  background: radial-gradient(ellipse 60% 70% at 85% 60%, rgba(211, 11, 22, 0.35), rgba(211, 11, 22, 0) 70%), var(--matchup-panel);
  clip-path: polygon(calc(var(--cx) + var(--t)) 0, 100% 0, 100% 100%, calc(var(--cx) - var(--t)) 100%);
}
.matchup-card__divider {
  background: var(--red);
  clip-path: polygon(calc(var(--cx) + var(--t)) 0, calc(var(--cx) + var(--t) + var(--div-top)) 0,
                     calc(var(--cx) - var(--t) + var(--div-top)) 100%, calc(var(--cx) - var(--t) - var(--div-bottom) + var(--div-top)) 100%);
}
.matchup-card__grain { opacity: var(--matchup-grain-opacity); }
.matchup-card__mark { position: absolute; left: var(--pad-x); top: var(--top); width: 15.4cqw; max-width: none; height: auto; }

.matchup-card__name,
.matchup-card__vs {
  font-size: var(--name-size);
  font-weight: 900;
  font-style: italic;
  line-height: 0.86;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* Real names longer than ~5 letters: smaller type, and never wider than the room the name has.
   --name-chars is the name's length (set on the element by src/index.njk); a letter of this
   face is about 0.72em wide, so room ÷ (letters × 0.72) is the largest size that fits. */
.matchup-card__name--long { font-size: min(calc(var(--name-size) * 0.55), calc(var(--name-room) / (var(--name-chars, 8) * 0.72))); }
/* A real fighter's "Gym · Belt · Weight" line is cut short with … if it would leave its side. */
.matchup-card__meta--real { max-width: var(--name-room); overflow: hidden; text-overflow: ellipsis; }
.matchup-card__vs { position: absolute; font-size: min(7.7cqw, 12.5cqh); color: var(--red); left: 37.6cqw; top: 46.7cqh; } /* between the left TBA and the divider, clear of both */
.matchup-card__label {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
}
.matchup-card__fighter { position: absolute; top: 40cqh; display: flex; flex-direction: column; gap: 10px; }
.matchup-card__fighter--left { left: var(--pad-x); }
.matchup-card__fighter--right { right: var(--pad-x); align-items: flex-end; }
/* tracking adds space after the last letter; pull right-aligned labels back to the edge */
.matchup-card__fighter--right .matchup-card__label,
.matchup-card__event,
.matchup-card__billing { margin-right: -0.28em; }
.matchup-card__meta { font-size: clamp(11px, 1.45cqw, 12px); color: var(--text-subtle); }
.matchup-card__fighter--right .matchup-card__meta { color: var(--text-muted); }
.matchup-card__event { position: absolute; right: var(--pad-x); top: calc(10cqh + var(--card-cut, 0px)); font-size: max(9px, 2.3cqw); }
.matchup-card__place,
.matchup-card__billing { position: absolute; bottom: 6.5cqh; font-size: clamp(12px, 1.6cqw, 13px); }
.matchup-card__place { left: var(--pad-x); }
.matchup-card__billing { right: var(--pad-x); color: var(--text-muted); }
.matchup-card__soon { position: absolute; left: var(--pad-x); bottom: 6.7cqh; font-size: max(9px, 2.4cqw); color: var(--text); } /* crosses the red divider: --text keeps it AA there (5.1:1) */

/* phone (default): one row, a single "Matchups announced soon" line */
.matchup-card__meta,
.matchup-card__place,
.matchup-card__billing { display: none; }

/* tablet: TBA · VS · TBA in one row, VS on the divider, short captions, no "Main event" */
@container matchup (min-width: 560px) {
  .matchup-card > * {
    --cx: 52cqw;
    --div-top: 6px;
    --div-bottom: 12px;
    --pad-x: 4.2cqw;
    --top: calc(6.5cqh + var(--card-cut, 0px));
    --name-size: min(15.6cqw, 27.8cqh);
    --name-room: 37cqw;
  }
  .matchup-card__mark { width: 12cqw; }
  .matchup-card__event { top: calc(9.7cqh + var(--card-cut, 0px)); font-size: clamp(11px, 1.56cqw, 13px); }
  .matchup-card__fighter { top: 34.7cqh; }
  .matchup-card__vs { font-size: min(8.3cqw, 14.8cqh); left: var(--cx); top: 45.4cqh; translate: -50% 0; }
  .matchup-card__meta,
  .matchup-card__place { display: block; }
  .matchup-card__meta-long { display: none; }
  .matchup-card__soon { display: none; }
}
/* desktop: tall (or near-square), staggered diagonally along the divider */
@container matchup (aspect-ratio < 5 / 4) {
  .matchup-card > * {
    --cx: 50cqw;
    --div-top: 6px;
    --div-bottom: 12px;
    --pad-x: 6.1cqw;
    --top: calc(5.4cqh + var(--card-cut, 0px));
    --name-size: min(23.6cqw, 20.7cqh, 170px);
    --name-room: 87cqw; /* stacked: each name has the card's full width */
  }
  .matchup-card__panel { background: radial-gradient(ellipse 70% 60% at 85% 70%, rgba(211, 11, 22, 0.35), rgba(211, 11, 22, 0) 70%), var(--matchup-panel); }
  .matchup-card__mark { width: 16.7cqw; }
  .matchup-card__event { top: calc(7.6cqh + var(--card-cut, 0px)); font-size: 13px; }
  .matchup-card__fighter { gap: 14px; }
  .matchup-card__fighter--left { top: 26.8cqh; }
  .matchup-card__fighter--right { top: 63.4cqh; }
  .matchup-card__vs { font-size: min(13.3cqw, 11.7cqh, 96px); left: 24.4cqw; top: 53.7cqh; translate: none; }
  .matchup-card__meta { font-size: 12px; }
  .matchup-card__meta-long { display: inline; }
  .matchup-card__place,
  .matchup-card__billing { display: block; bottom: 4.9cqh; font-size: 13px; }
  .matchup-card__soon { display: none; }
}

/* ---------- Signup ---------- */
.signup__form { display: flex; flex-direction: column; gap: 10px; }
.signup__field { display: flex; flex-direction: column; gap: 10px; }
.signup__label { font-size: 14px; font-weight: 700; }
.signup__row { display: flex; flex-direction: column; gap: 10px; }
.signup__input {
  flex: 1 1 auto;
  min-width: 0;
  height: var(--control-h);
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--black);
  font-size: 16px;
  color-scheme: light;
  -webkit-appearance: none;
  appearance: none;
}
.signup__input::placeholder { color: var(--text-placeholder); opacity: 1; }
.signup__input:focus-visible { outline-offset: 2px; }
.signup__input[aria-invalid="true"] { border: 3px solid var(--error-border); padding-left: 13px; }
.signup__input:disabled { background: var(--text-muted); }
.signup__button { flex: none; }
.signup__note { font-size: 13px; line-height: 1.5; color: var(--text-subtle); }
@media (min-width: 700px) {
  .signup__label { font-size: 15px; }
  .signup__row { flex-direction: row; gap: 0; }
  .signup__input { padding: 0 18px; }
  .signup__input[aria-invalid="true"] { padding-left: 15px; }
}

/* Secondary signup: under a red "Register" button, so its own button steps back
   (home page while registration is open). */
.signup--secondary { margin-top: 16px; padding-top: 20px; border-top: 1px solid var(--line-strong); }
.signup--secondary .signup__row { flex-direction: row; gap: 0; }
.signup--secondary .signup__button {
  height: var(--control-h);
  padding: 0 14px;
  border-left: 1px solid var(--text-muted);
  background: var(--text);
  color: var(--black);
  font-size: 12px;
  white-space: nowrap;
}
.signup--secondary .signup__button:disabled { background: var(--text-muted); color: var(--black); }
@media (min-width: 700px) {
  .signup--secondary { margin-top: 12px; padding-top: 24px; }
  .signup--secondary .signup__row { max-width: 520px; }
  .signup--secondary .signup__button {
    padding: 0 22px;
    border-left: 0;
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--line-button);
    color: var(--text);
    font-size: 13px;
  }
  .signup--secondary .signup__button:hover { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--text-subtle); }
  .signup--secondary .signup__button:disabled { background: transparent; color: var(--text-subtle); }
}

.field-error { font-size: 14px; line-height: 1.4; color: var(--error-text); }
.field-error:empty { display: none; }

.form-alert {
  padding: 14px 16px;
  border: 1px solid var(--error-border);
  color: var(--error-text);
  font-size: 14px;
  line-height: 1.5;
}
.form-alert:empty { display: none; }
.form-alert a { color: inherit; overflow-wrap: anywhere; }

.form-result:empty { display: none; }
.form-result { scroll-margin-top: calc(var(--header-h) + 24px); }

.success-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--black);
  border-top: 3px solid var(--red);
}
.success-panel__title { font-size: var(--fs-success); }
.success-panel__body { font-size: 15px; line-height: 1.5; color: var(--text-muted); }
.success-panel .text-link { align-self: flex-start; }

/* ---------- Cards (01/02/03) ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--panel);
  border-top: 3px solid var(--red);
}
.card--on-panel { background: var(--black); }
.card__title { font-size: var(--fs-card); letter-spacing: -0.03em; }
.card--lg .card__title { font-size: var(--fs-card-lg); }
.card p:not(.card__num) { font-size: 15px; line-height: 1.55; color: var(--text-muted); }
@media (min-width: 700px) {
  .card { gap: 14px; padding: 32px; }
  .card--lg { gap: 16px; padding: 36px; }
  .card p:not(.card__num) { font-size: 16px; }
}

/* ---------- Red panel (sponsors, contact) ---------- */
.red-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 24px;
  background: var(--red);
  color: var(--white);
  font-size: 15px;
  line-height: 1.5;
}
.red-panel__title { font-size: var(--fs-row); letter-spacing: -0.03em; }
.red-panel__button { width: 100%; height: 52px; padding: 0 24px; font-size: 13px; }
@media (min-width: 700px) {
  .red-panel { gap: 18px; padding: 40px; font-size: 16px; }
  .red-panel__button { width: auto; align-self: flex-start; }
}

/* ---------- Header + nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--black);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--max-width);
  height: var(--header-h);
  margin-inline: auto;
  padding: 0 max(12px, calc(var(--gutter) - 8px)) 0 var(--gutter); /* menu button's 44px box sits 8px in */
}
.brand { display: flex; align-items: center; min-height: 44px; flex: none; }
.brand:hover { opacity: 1; }
.brand__logo { width: auto; height: 40px; }

.menu-toggle {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.menu-toggle__close { display: none; }
.menu-toggle[aria-expanded="true"] .menu-toggle__open { display: none; }
.menu-toggle[aria-expanded="true"] .menu-toggle__close { display: block; }

.site-nav__list a { text-decoration: none; }
.site-nav__place {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* ≥900: inline nav */
@media (min-width: 900px) {
  .site-header__inner { padding: 0 var(--gutter); }
  .site-nav { display: flex; align-items: center; gap: 20px; } /* tight until 1100: logo + nav just fit at 900 */
  .site-nav__list { display: flex; gap: 20px; }
  .site-nav__list a {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: 15px;
    font-weight: 600;
  }
  .site-nav__list a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
  .site-nav__cta { height: 44px; padding: 0 20px; font-size: 13px; white-space: nowrap; }
  /* While registration is open the header button is just "Register"; "Get event updates" is menu-only. */
  .site-nav__cta-more, .site-nav__cta--updates { display: none; }
  .site-nav__place { display: none; }
}
@media (min-width: 1100px) {
  .brand__logo { height: 48px; }
  .site-nav, .site-nav__list { gap: 36px; }
}

/* <900 with JS: full-screen menu panel */
@media (max-width: 899.98px) {
  .js .menu-toggle { display: grid; }
  .js .site-nav {
    position: fixed;
    inset: var(--menu-top, calc(var(--header-h) + 1px)) 0 0 0;
    z-index: 49;
    display: flex;
    flex-direction: column;
    padding: 20px var(--gutter) 36px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--black);
  }
  .js .site-nav:not(.is-open) { display: none; }
  .js .site-nav__list { margin-bottom: 40px; }
  .js .site-nav__list a {
    display: block;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    font-size: 44px;
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.045em;
    text-transform: uppercase;
  }
  .js .site-nav__cta { width: 100%; height: 56px; margin-top: auto; }
  .js .site-nav__cta--updates { margin-top: 10px; } /* second button, under "Register for a superfight" */
  .js .site-nav__place { margin-top: 16px; }

  /* Without JS the menu can't open, so show the links in a wrapped row. */
  .no-js .site-header { position: static; }
  .no-js .site-header__inner { flex-wrap: wrap; height: auto; padding-block: 10px; row-gap: 4px; }
  .no-js .site-nav { width: 100%; }
  .no-js .site-nav__list { display: flex; flex-wrap: wrap; column-gap: 20px; }
  .no-js .site-nav__list a { display: flex; align-items: center; min-height: 44px; font-weight: 600; }
  .no-js .site-nav__cta, .no-js .site-nav__place { display: none; }
}

/* ---------- Preview banner (preview links only; see <head> script) ---------- */
.preview-banner { display: none; }
.is-preview .preview-banner {
  display: block;
  padding: 10px var(--gutter);
  background: var(--text);
  color: var(--black);
  font-size: 14px;
  line-height: 1.4;
}
.preview-banner__tag {
  margin-right: 8px;
  padding: 2px 6px;
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Social links (contact card, footer): icon + text, or the icon alone ---------- */
.social-link { display: inline-flex; align-items: center; gap: 8px; }
.social-icon { flex: none; }

/* ---------- Not found (src/404.njk, built as /404.html) ---------- */
.not-found__inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  min-height: 60vh;
  padding-block: 56px;
}
.not-found__title { font-size: var(--fs-h2); }
.not-found__text { max-width: 560px; font-size: var(--fs-lead); line-height: 1.5; color: var(--text-muted); }
.not-found__actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
@media (min-width: 700px) {
  .not-found__inner { gap: 28px; padding-block: 72px; }
  .not-found__actions { flex-direction: row; gap: 12px; margin-top: 8px; }
}
