/* ==========================================================================
   global.css — Thoroughbred Trainers Information Guide
   Components reused across most pages: ticker, ad slots & creatives,
   boards (cards with "presented by"), data tables, badges, CTA band.
   Loaded alongside main.css. Tokens come from main.css :root.
   Mobile rules live directly under each section's base rules (look for
   the "Mobile:" comment right below a component), not in one big block.
   ========================================================================== */

/* ---------- Ticker (tote-board style entries & deadlines strip) ---------- */
.ticker {
  position: sticky;
  top: var(--nav-height);
  z-index: 40;
  background: var(--primary);
  color: var(--surface);
  border-bottom: 1px solid var(--line);
}

.ticker__inner {
  display: flex;
  align-items: stretch;
}

.ticker__label {
  display: flex;
  align-items: center;
  flex: none;
  padding: 0.85rem 1rem;
  background: var(--secondary);
  color: var(--accent-dark);
  font: 700 0.7rem/1 var(--font-head);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Without JS the strip is a plain horizontal scroller; JS adds .ticker--ready */
.ticker__viewport {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.ticker__viewport::-webkit-scrollbar { display: none; }

.ticker__track {
  display: flex;
  white-space: nowrap;
}

.ticker__track li {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0.85rem 1.75rem 0.85rem 0.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.ticker__track li::before {
  content: "";
  flex: none;
  width: 0.4em;
  height: 0.4em;
  margin: 0 1rem 0 1.25rem;
  background: var(--secondary);
  transform: rotate(45deg);
}

.ticker--ready .ticker__viewport {
  overflow: hidden;
  /* Edge fade: the mask's color stops only control opacity, not color */
  -webkit-mask-image: linear-gradient(to right, transparent, var(--ink) 3%, var(--ink) 97%, transparent);
  mask-image: linear-gradient(to right, transparent, var(--ink) 3%, var(--ink) 97%, transparent);
}
.ticker--ready .ticker__track {
  animation: ticker-scroll var(--ticker-duration, 40s) linear infinite;
  will-change: transform;
}
.ticker--ready:hover .ticker__track,
.ticker--ready:focus-within .ticker__track { animation-play-state: paused; }

@keyframes ticker-scroll {
  to { transform: translateX(-50%); }
}

/* Mobile: shrink the label chip and item text so more of the strip fits */
@media (max-width: 768px) {
  .ticker__label {
    padding: 0.75rem 0.85rem;
    font-size: 0.62rem;
  }
  .ticker__track li { font-size: 0.92rem; }
}

/* ---------- Ad slots ---------- */
.spotlight { position: relative; }

.spotlight__tag {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  z-index: 2;
  padding: 0.28rem 0.42rem;
  border-radius: 4px;
  background: var(--tag-on-any);
  color: var(--surface);
  font: 600 0.56rem/1 var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.creative {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* Compact house creative — the persistent masthead slot */
.creative--house {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.2rem 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--primary);
  color: var(--surface);
}
.creative--house strong {
  display: block;
  font: 700 1rem/1.2 var(--font-head);
  color: var(--secondary);
}
.creative--house span:not(.btn) {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--surface);
}
.creative--house .btn {
  grid-column: 2;
  grid-row: 1 / span 2;
}

/* Mobile: stack the house-ad copy above the button instead of side by side */
@media (max-width: 768px) {
  .creative--house {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .creative--house .btn {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    margin-top: 0.5rem;
  }
}

/* Rotating banner slot */
.spotlight__slides {
  position: relative;
  min-height: 236px;
}

.spotlight__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s, visibility 0.6s;
}
.spotlight__slide.is-active {
  position: relative;
  opacity: 1;
  visibility: visible;
}

.creative--banner {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  align-items: center;
  gap: 1.5rem 2.5rem;
  min-height: 236px;
  height: 100%;
  padding: 2rem 2.5rem;
  border-radius: var(--radius);
}
.creative--banner .eyebrow { margin-bottom: 0.45rem; }
.creative--banner strong {
  display: block;
  margin-bottom: 0.5rem;
  font: 800 clamp(1.3rem, 1rem + 1.2vw, 1.9rem)/1.15 var(--font-head);
  letter-spacing: -0.01em;
}
.creative--banner p {
  max-width: 52ch;
  font-size: 1rem;
}
.creative--banner .btn { margin-top: 1.1rem; }

.creative__visual { justify-self: end; }

.creative--navy {
  background: var(--primary);
  color: var(--surface);
}
.creative--navy .eyebrow { color: var(--secondary); }
.creative--navy p { color: var(--surface); }

.creative--white {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.creative--white p { color: var(--ink-soft); }

.creative--gold {
  background: var(--secondary);
  color: var(--accent-dark);
}
.creative--gold .eyebrow,
.creative--gold strong { color: var(--accent-dark); }

.pill-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: 24rem;
}
.pill-cloud li {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-on-dark);
  border-radius: 999px;
  font: 600 0.78rem/1 var(--font-head);
  color: var(--surface);
}

.savings-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.book {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 150px;
  aspect-ratio: 3 / 4;
  padding: 1.1rem 1rem 1rem 1.35rem;
  background: var(--accent-dark);
  color: var(--surface);
  border-radius: 4px 10px 10px 4px;
  box-shadow: var(--shadow);
}
.book::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 9px;
  width: 2px;
  background: var(--line-on-dark);
}
.book__year {
  font: 800 1.7rem/1 var(--font-head);
  color: var(--secondary);
}
.book__title { font: 700 0.72rem/1.3 var(--font-head); }
.book__note {
  margin-top: auto;
  font: 600 0.58rem/1.2 var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-dark-soft);
}

/* Mobile: the 2-up banner (copy + visual) becomes 1-up, visual left-aligned */
@media (max-width: 1100px) {
  .creative--banner {
    grid-template-columns: 1.2fr 1fr;
    padding: 1.75rem 2rem;
  }
}
@media (max-width: 768px) {
  .spotlight__slides { min-height: 0; }
  .creative--banner {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    min-height: 0;
    padding: 1.5rem 1.35rem;
  }
  .creative__visual { justify-self: start; }
  .pill-cloud,
  .savings-row { justify-content: flex-start; }
}

/* ---------- Boards (cards with a "presented by" sponsor) ---------- */
.board {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--nav-height) + var(--ticker-height) + 1rem);
}

.board__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem 1.5rem;
  padding: 1.5rem 1.5rem 1.1rem;
}
.board__head .eyebrow { margin-bottom: 0.35rem; }
.board__head h2 { font-size: clamp(1.2rem, 1rem + 0.7vw, 1.45rem); }

.presented-by {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}
.presented-by__label {
  font: 600 0.62rem/1 var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.presented-by__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.presented-by img {
  height: 30px;
  width: auto;
}
.presented-by__brand--mark img { height: 44px; }
.presented-by__name {
  max-width: 13ch;
  font: 700 0.76rem/1.15 var(--font-head);
  color: var(--ink);
}

.board__body {
  flex: 1;
  padding: 0 1.5rem;
}

.board__foot {
  margin-top: auto;
  padding: 1.15rem 1.5rem 1.5rem;
}

/* Mobile: tighter card padding, "presented by" drops to a row under the title */
@media (max-width: 768px) {
  .board__head {
    grid-template-columns: 1fr;
    padding: 1.25rem 1.15rem 0.9rem;
  }
  .board__body { padding: 0 1.15rem; }
  .board__foot { padding: 1rem 1.15rem 1.25rem; }

  .presented-by {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
  }
  .presented-by img { height: 24px; }
  .presented-by__brand--mark img { height: 34px; }
}

/* ---------- Data tables ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  min-width: 100%;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.table th {
  padding: 0.5rem 0.5rem 0.6rem;
  border-bottom: 2px solid var(--line);
  font: 600 0.66rem/1.2 var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-soft);
  white-space: nowrap;
}
.table th:first-child,
.table td:first-child { padding-left: 0; }
.table th:last-child,
.table td:last-child { padding-right: 0; }

.table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: 0; }

.table .num { text-align: center; }
.table .tight { white-space: nowrap; }
.table strong { font-weight: 500; }
.table small {
  display: block;
  font-size: 0.82em;
  line-height: 1.3;
  color: var(--ink-soft);
}
.table .rank {
  width: 2.2rem;
  font: 700 0.85rem/1.6 var(--font-head);
  color: var(--ink-soft);
}
.table--nowrap strong { white-space: nowrap; }

/* Mobile: .table-wrap above already lets wide tables scroll horizontally;
   this just tightens the type/padding so more columns are visible at once */
@media (max-width: 768px) {
  .table { font-size: 0.88rem; }
  .table td { padding: 0.65rem 0.35rem; }
  .table th { padding: 0.45rem 0.35rem 0.55rem; }
}

.status {
  display: inline-block;
  padding: 0.32rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font: 600 0.66rem/1 var(--font-head);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  background: var(--secondary-soft);
  color: var(--accent-dark);
  font: 700 0.74rem/1 var(--font-head);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge--strong { background: var(--secondary); }

/* ---------- CTA band (bottom of every page) ---------- */
.cta-band {
  background: var(--accent-dark);
  color: var(--surface);
}
.cta-band--primary { background: var(--primary); }

.cta-band__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.cta-band__grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.cta-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 2.25rem;
  border-radius: var(--radius);
  scroll-margin-top: calc(var(--nav-height) + var(--ticker-height) + 1rem);
}
.cta-panel h2 { font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2rem); }
.cta-panel p { max-width: 48ch; }
.cta-panel .btn {
  align-self: flex-start;
  margin-top: 0.75rem;
}

.cta-panel--light {
  background: var(--surface);
  color: var(--ink);
}
.cta-panel--light p { color: var(--ink-soft); }

.cta-panel--gold {
  background: var(--secondary);
  color: var(--accent-dark);
}
.cta-panel--gold .eyebrow,
.cta-panel--gold h2,
.cta-panel--gold h2 em { color: var(--accent-dark); }

.cta-panel__copy { max-width: 48ch; }

.signup-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.signup-form__input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font: 500 0.95rem/1 var(--font-body);
  color: var(--ink);
  background: var(--surface);
}
.signup-form__input:focus-visible {
  outline: none;
  border-color: var(--primary);
}
.signup-form .btn { align-self: center; margin-top: 0; }

/* Desktop: the signup card splits into copy on the left, form on the right */
@media (min-width: 769px) {
  .cta-panel--signup {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2.5rem;
  }
  .cta-panel--signup .cta-panel__copy { flex: 0 1 auto; }
  .cta-panel--signup .signup-form {
    flex: 1;
    margin-top: 0;
  }
}

/* Mobile: the two side-by-side CTA panels stack into one column */
@media (max-width: 768px) {
  .cta-band__grid { grid-template-columns: 1fr; }
  .cta-panel { padding: 1.75rem 1.35rem; }
  .signup-form { flex-direction: column; align-items: stretch; }
}
