/* Poker hero: headline, countdown, CTA and the live tournaments table.
 * Below 1280px: a card above the table. Desktop (1280px+): two columns over a full-width background. */

.poker-hero {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---- card (mobile) --------------------------------------------------------------------------- */
.poker-hero__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 208px;
  /* Figma's 20px includes its 1px inside stroke. */
  padding: 19px;
  overflow: hidden;
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-xl);
  background: var(--hero-bg-mobile, var(--hero-bg, none)) center / cover no-repeat var(--color-background-1);
}

.poker-hero__intro,
.poker-hero__countdown,
.poker-hero__cta {
  position: relative;
  z-index: 1;
}

.poker-hero__intro {
  max-width: 204px;
}

/* Negative offsets in the hero stand in for Figma's cap-height text trim. */
.poker-hero__headline {
  margin: -5px 0 0;
  font-size: 29px;
  font-weight: 400;
  line-height: 1.16;
  color: var(--color-foreground-high);
}

.poker-hero__headline-title,
.poker-hero__headline-highlight {
  display: block;
}

/* Mobile Figma bolds the title line; desktop bolds the highlight. */
.poker-hero__headline-title {
  font-weight: 800;
}

.poker-hero__headline-highlight {
  font-weight: 400;
}

/* Figma's mobile hero has no subtitle. */
.poker-hero__subtitle {
  display: none;
  margin: 10px 0 0;
  font-size: var(--text-lg);
  line-height: 1.5;
  color: var(--color-foreground-low);
}

.poker-hero__photo {
  position: absolute;
  z-index: 0;
  top: 3px;
  right: -24px;
  height: 235px;
}

.poker-hero__photo img {
  width: auto;
  max-width: none;
  height: 100%;
}

/* ---- countdown ------------------------------------------------------------------------------- */
.poker-hero__countdown {
  width: 162px;
  margin-top: -6px;
}

.poker-hero__countdown-title {
  margin: 0 0 9px;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  line-height: 1.2;
  color: var(--color-foreground-high);
}

.poker-hero__countdown-units {
  display: flex;
  gap: 3px;
  height: 36px;
}

.poker-hero__countdown-unit {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 8px;
  border-radius: var(--radius-lg);
  background: var(--color-fill-low);
  color: var(--color-foreground-high);
  font-family: var(--font-heading);
  line-height: 1;
}

.poker-hero__countdown-value {
  font-size: var(--text-base);
  font-weight: 800;
}

.poker-hero__countdown-label {
  font-size: 8px;
  letter-spacing: 0.24px;
  text-transform: uppercase;
}

/* Mobile shows MIN / SEC; the full word stays available to screen readers. */
.poker-hero__countdown-label-long {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- CTA (Aurora ADS/CTA, yellow) ------------------------------------------------------------- */
/* Figma's mobile "Small" CTA is drawn at Aurora's XSmall size. */
.poker-hero__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-action-1);
  background: var(--color-cta-2);
  color: var(--color-cta-2-foreground);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  /* Stays at the card's foot when there is no countdown above it. */
  margin-top: auto;
}

.poker-hero__cta:hover {
  background: var(--color-cta-2-hover);
  color: var(--color-cta-2-foreground);
  text-decoration: none;
}

.poker-hero__cta:active {
  background: var(--color-cta-2-active);
}

/* !important because site.css sets `outline: 0 !important` on every link state. */
.poker-hero__cta:focus-visible {
  outline: 2px solid var(--color-cta-3-border) !important;
  outline-offset: 3px;
}

/* Logged-in customers get the blue Play Now (Aurora primary) instead of the yellow Join Now. */
.poker-v2[data-audience="loggedin"] .poker-hero__cta {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

.poker-v2[data-audience="loggedin"] .poker-hero__cta:hover {
  background: var(--color-primary-hover);
  color: var(--color-primary-foreground);
}

.poker-v2[data-audience="loggedin"] .poker-hero__cta:active {
  background: var(--color-primary-active);
}

/* ---- live tournaments table ------------------------------------------------------------------ */
.poker-hero__table-wrap {
  position: relative;
  z-index: 1;
  padding-top: 13px;
}

.poker-hero__table-head {
  display: flex;
  align-items: center;
  gap: 15px;
}

.poker-hero__table-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: 1.2;
}

.poker-hero__live-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 16px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  background: var(--color-tone-red);
  color: var(--color-tone-red-foreground);
  font-family: var(--font-heading);
  font-size: var(--text-2xs);
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
}

.poker-hero__live-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: poker-live-pulse 1.4s ease-in-out infinite;
}

@keyframes poker-live-pulse {
  50% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .poker-hero__live-label::before {
    animation: none;
  }
}

/* Wraps short of the chip that sits over the table's top-right corner. */
.poker-hero__table-subtitle {
  max-width: calc(100% - 90px);
  margin: 4px 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-foreground-low);
}

.poker-hero__table-card {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-xl);
}

.poker-hero__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-heading);
}

.poker-hero__table th,
.poker-hero__table td {
  padding: 10px 4px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-card-border);
}

.poker-hero__table th:first-child,
.poker-hero__table td:first-child {
  padding-left: 10px;
}

.poker-hero__table th:last-child,
.poker-hero__table td:last-child {
  padding-right: 10px;
}

.poker-hero__table th {
  padding-top: 11px;
  padding-bottom: 11px;
  background: var(--color-background-2);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--color-foreground-high);
}

/* Figma mobile: names start ~115px in, the prize pill sits centred, the player count right. */
.poker-hero__table th:nth-child(1) { width: 30%; }
.poker-hero__table th:nth-child(2) { width: 20%; }
.poker-hero__table th:nth-child(3) { width: 13%; }
.poker-hero__table th:nth-child(4) { width: 23%; }
.poker-hero__table th:nth-child(5) { width: 14%; }

.poker-hero__table th:nth-child(4),
.poker-hero__table .poker-hero__cell--prize {
  text-align: center;
}

.poker-hero__table th:nth-child(5),
.poker-hero__table .poker-hero__cell--players {
  text-align: right;
}

.poker-hero__table td {
  background: var(--color-card-solid);
  font-size: var(--text-2xs);
  line-height: 1.2;
  color: var(--color-foreground-high);
}

.poker-hero__row:last-child td {
  border-bottom: 0;
}

.poker-hero__time {
  display: block;
}

/* Nexa's descenders hang below a 1.2 line box; the padding keeps them out of the clip without moving the row. */
.poker-hero__name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  padding-bottom: 0.15em;
  margin-bottom: -0.15em;
}

.poker-hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-lgx);
  color: var(--color-foreground-high);
  white-space: nowrap;
}

.poker-hero__pill--registering {
  justify-content: center;
  gap: 4px;
  min-width: 84px;
  background: var(--color-alpha-7-5);
}

.poker-hero__pill--prize {
  background: var(--color-success-muted);
}

.poker-hero__prize-value {
  font-variant-numeric: tabular-nums;
}

/* prize-count.js counts the amounts up and reveals them; until then they stay invisible so the
   final figure doesn't flash first, and they show after 1.5s anyway if the script never runs. */
@media (prefers-reduced-motion: no-preference) {
  .poker-hero__prize-value {
    opacity: 0;
    animation: poker-prize-reveal 0s 1.5s forwards;
  }
}

@keyframes poker-prize-reveal {
  to {
    opacity: 1;
  }
}

.poker-hero__cell-icon {
  flex: none;
  width: 14px;
  height: 14px;
}

.poker-hero__cell-icon--players {
  width: 12px;
  margin-right: 2px;
  vertical-align: -2px;
}

.poker-hero__cell--players {
  white-space: nowrap;
}

.poker-hero__no-value {
  color: var(--color-foreground-low);
}

/* The mobile Figma shows the player count without its icon. */
@media (max-width: 575px) {
  .poker-hero__cell-icon--players {
    display: none;
  }
}

/* Below Figma's 390px frame the pills drop their icons to fit their columns. */
@media (max-width: 374px) {
  .poker-hero__table .poker-hero__cell-icon {
    display: none;
  }

  .poker-hero__pill--registering {
    min-width: 0;
  }

  .poker-hero__table th {
    white-space: nowrap;
  }

  .poker-hero__table th:nth-child(1) { width: 27%; }
  .poker-hero__table th:nth-child(2) { width: 23%; }
  .poker-hero__table th:nth-child(3) { width: 13%; }
  .poker-hero__table th:nth-child(4) { width: 19%; }
  .poker-hero__table th:nth-child(5) { width: 18%; }
}

/* ---- chip art (only rendered when the payload supplies it) ----------------------------------- */
/* Positions are chip centres; transforms are Figma's, applied to the payload's trail-down chip. */
.poker-hero__chip {
  position: absolute;
  z-index: 0;
  aspect-ratio: 1;
  pointer-events: none;
  background: var(--poker-chip, none) center / contain no-repeat;
  animation: poker-chip-float 1.2s ease-in-out infinite alternate;
}

/* Float distances are Figma's, as a share of the chip so they scale with it. */
.poker-hero__chip--a {
  --poker-chip-float: -22%;
  top: 18px;
  left: calc(100% - 137px);
  width: 68px;
  transform: translate(-50%, -50%) rotate(-136.94deg) scaleX(-1);
}

/* Lives in the table block so it tracks the table whatever the card's height; Figma draws it over the table. */
.poker-hero__chip--b {
  --poker-chip-float: -23%;
  z-index: 2;
  top: 71px;
  left: calc(100% - 53px);
  width: 87px;
  transform: translate(-50%, -50%) rotate(-19.34deg);
  animation-duration: 1.6s;
}

/* ---- tablet: same card layout, larger type (Figma has no tablet frame) ------------------------ */
@media (min-width: 768px) {
  .poker-hero__card {
    min-height: 260px;
    padding: 28px;
  }

  .poker-hero__intro {
    max-width: 320px;
  }

  .poker-hero__photo {
    bottom: 0;
    height: auto;
  }

  /* Scaled with the taller tablet card and photo. */
  .poker-hero__chip--a {
    top: 22px;
    left: calc(100% - 185px);
    width: 87px;
  }

  .poker-hero__headline {
    font-size: var(--text-5xl);
    line-height: 1.07;
  }

  .poker-hero__countdown {
    width: 260px;
  }

  .poker-hero__countdown-title {
    font-size: var(--text-base);
  }

  .poker-hero__countdown-units {
    height: 52px;
    gap: 6px;
  }

  .poker-hero__countdown-value {
    font-size: var(--text-2xl);
  }

  .poker-hero__cta {
    height: 56px;
    font-size: var(--text-xl);
  }

  .poker-hero__table-title {
    font-size: var(--text-2xl);
  }

  .poker-hero__table th {
    font-size: var(--text-xs);
  }

  .poker-hero__table td {
    font-size: var(--text-sm);
  }

  .poker-hero__pill {
    padding: 8px;
  }
}

/* ---- desktop: two columns need the table's 863px plus room for the headline ---------------- */
@media (min-width: 1280px) {
  .poker-v2 > .poker-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 863px);
    grid-template-rows: auto auto 1fr;
    column-gap: 24px;
    max-width: none;
    padding: 79px calc(max(var(--poker-gutter), calc((100% - var(--poker-maxw)) / 2)) + 4px) 132px max(var(--poker-gutter), calc((100% - var(--poker-maxw)) / 2));
    overflow: hidden;
    background:
      linear-gradient(167.6deg, transparent 39.88%, var(--color-background-1) 73.52%),
      var(--hero-bg, none) center / cover no-repeat;
  }

  .poker-hero__card {
    display: contents;
    /* Resets the mobile overflow:hidden. Piwik reads it as clipping this now 0x0 box, so the
       hero CTA's click stopped firing on desktop (80608). No visual effect. */
    overflow: visible;
  }

  /* The intro may run past its column toward the countdown, as in Figma. */
  .poker-hero__intro {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    justify-self: start;
    width: 595px;
    max-width: calc(100% + 60px);
  }

  /* Negative offsets stand in for Figma's trimmed text boxes (text-box-trim). */
  .poker-hero__headline {
    margin-top: -11px;
    font-size: clamp(var(--text-5xl), 3.2vw, var(--text-6xl));
    line-height: 1.07;
  }

  .poker-hero__headline-title {
    font-weight: 400;
  }

  .poker-hero__headline-highlight {
    font-weight: 800;
  }

  .poker-hero__subtitle {
    display: block;
  }

  /* Figma's photo frame, as insets of the hero. */
  .poker-hero__photo {
    top: 28.22%;
    right: 46.25%;
    bottom: 2.02%;
    left: -2.34%;
  }

  /* Capped at the photo's own ratio: any wider and cover crops its faded bottom edge into a hard line. */
  .poker-hero__photo img {
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transform: translate(2.8%, 3.3%);
  }

  .poker-hero__countdown {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    width: 410px;
    margin-top: 3px;
  }

  .poker-hero__countdown-title {
    margin-bottom: 5px;
    font-size: var(--text-2xl);
    text-align: center;
  }

  .poker-hero__countdown-units {
    gap: 8px;
    height: 78px;
  }

  .poker-hero__countdown-unit {
    gap: 2px;
    padding: 12px;
    line-height: 1.2;
  }

  .poker-hero__countdown-value {
    font-size: var(--text-4xl);
    line-height: 1;
  }

  .poker-hero__countdown-label {
    font-weight: 600;
    letter-spacing: 0;
  }

  .poker-hero__countdown-label-long {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  .poker-hero__countdown-label-short {
    display: none;
  }

  .poker-hero__cta {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
    width: 410px;
    height: 56px;
    margin-top: 12px;
    padding: 0 20px;
    /* Figma overrides Aurora's Medium label size here. */
    font-size: var(--text-3xl);
  }

  .poker-hero__table-wrap {
    grid-column: 2;
    grid-row: 3;
    padding-top: 36px;
  }

  .poker-hero__table-head {
    justify-content: center;
    padding: 20px 0 14px;
  }

  .poker-hero__table-title {
    font-size: var(--text-2xl);
    line-height: 1;
  }

  .poker-hero__table-subtitle {
    display: none;
  }

  .poker-hero__table-card {
    margin-top: 0;
    box-shadow: 0 0 94px var(--color-alpha-20);
  }

  /* Figma's columns are 196 / 240 / 124 / 170 / 84px inside 24px edge padding. */
  .poker-hero__table th,
  .poker-hero__table td {
    padding-right: 8px;
    padding-left: 0;
  }

  .poker-hero__table th:first-child,
  .poker-hero__table td:first-child {
    padding-left: 24px;
  }

  .poker-hero__table th:last-child,
  .poker-hero__table td:last-child {
    padding-right: 24px;
  }

  .poker-hero__table th {
    padding-top: 23px;
    padding-bottom: 23px;
    font-size: var(--text-base);
    line-height: 1;
  }

  .poker-hero__table th:nth-child(1) { width: 25.5%; }
  .poker-hero__table th:nth-child(2) { width: 27.8%; }
  .poker-hero__table th:nth-child(3) { width: 14.4%; }
  .poker-hero__table th:nth-child(4) { width: 19.7%; }
  .poker-hero__table th:nth-child(5) { width: 12.6%; }

  .poker-hero__table th:nth-child(4),
  .poker-hero__table .poker-hero__cell--prize {
    text-align: left;
  }

  .poker-hero__time {
    display: inline;
  }

  /* Figma rows are 54px apart whether or not the row has a pill. */
  .poker-hero__table td {
    height: 54px;
    padding-top: 0;
    padding-bottom: 0;
    font-size: var(--text-base);
    color: var(--color-foreground-medium);
  }

  .poker-hero__name {
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .poker-hero__pill {
    padding: 8px 10px;
    line-height: 1;
  }

  .poker-hero__pill--registering {
    gap: 10px;
  }

  .poker-hero__chip--a {
    --poker-chip-float: -14%;
    top: calc(100% - 200px);
    left: 96.39%;
    width: min(11.1vw, 213px);
    animation-duration: 1.3s;
  }

  .poker-hero__chip--b {
    display: none;
  }

  /* No tournaments: the CTA joins the intro and the photo takes the table's column. */
  .poker-v2 > .poker-hero[data-has-tournaments="false"] {
    grid-template-rows: 1fr auto auto 1fr;
    padding-bottom: 0;
  }

  .poker-hero[data-has-tournaments="false"] .poker-hero__intro {
    grid-row: 2;
  }

  .poker-hero[data-has-tournaments="false"] .poker-hero__cta {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    width: min(410px, calc(100% + 60px));
    margin-top: 40px;
  }

  .poker-hero[data-has-tournaments="false"] .poker-hero__photo {
    position: relative;
    inset: auto;
    display: flex;
    justify-content: center;
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: end;
    height: clamp(480px, 31.25vw, 600px);
  }

  .poker-hero[data-has-tournaments="false"] .poker-hero__photo img {
    width: auto;
    object-fit: contain;
    transform: none;
  }
}

/* Past Figma's 1920 frame the content stops widening, so the photo keeps that frame's place beside it. */
@media (min-width: 1920px) {
  .poker-hero__photo {
    right: calc(50% - 72px);
    left: calc(50% - 1005px);
  }
}

/* Last in the file so it outranks the chips' animation durations above. */
@media (prefers-reduced-motion: reduce) {
  .poker-hero__chip {
    animation: none;
  }
}
