/* TTA Accredited Foals — brand: TTA navy, cerulean, saddle gold; Cinzel 300 + Montserrat */
.tta-foals {
  --tf-navy: #2e3192;
  --tf-cerulean: #3c6db4;
  --tf-gold: #c6b28a;
  --tf-gold-deep: #a48e5f;
  --tf-mist: #dce4f1;
  --tf-mist-soft: #f1f4fa;
  --tf-ink: #1f2147;
  --tf-muted: #5d6385;
  --tf-rule: #d6dbea;
  --tf-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --tf-body: "Montserrat", "Helvetica Neue", Arial, sans-serif;

  font-family: var(--tf-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--tf-ink);
  scroll-margin-top: 120px; /* clears Avada's sticky header when paging */
}
.tta-foals *, .tta-foals *::before, .tta-foals *::after { box-sizing: border-box; }
.tta-foals [hidden] { display: none !important; }
.tta-foals__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tta-foals__status { padding: 32px 0; color: var(--tf-muted); }

/* Buttons: neutralise theme button styles */
.tta-foals button {
  appearance: none; -webkit-appearance: none;
  margin: 0; padding: 0; border: 0; background: none; box-shadow: none;
  font: inherit; color: inherit; letter-spacing: normal; text-transform: none; line-height: inherit;
  cursor: pointer; border-radius: 0; min-height: 0; width: auto;
}
.tta-foals button:focus-visible,
.tta-foals .tta-foals__input:focus-visible,
.tta-foals a:focus-visible { outline: 2px solid var(--tf-gold-deep); outline-offset: 2px; }

/* ---------- Filter panel ---------- */
.tta-foals .tta-foals__panel {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(180px, 1.4fr);
  gap: 16px 20px;
  padding: 24px 28px;
  background: var(--tf-mist);
}
.tta-foals__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tta-foals__field label {
  font-size: 13px; font-weight: 600; color: var(--tf-navy); margin: 0;
}
.tta-foals input.tta-foals__input,
.tta-foals select.tta-foals__input {
  width: 100%; height: 46px; margin: 0;
  padding: 0 14px;
  font-family: var(--tf-body); font-size: 15px; color: var(--tf-ink);
  background-color: #fff;
  border: 1px solid #c3cbe0; border-radius: 0; box-shadow: none;
}
.tta-foals input.tta-foals__input::placeholder { color: #8a90ad; opacity: 1; }
.tta-foals input.tta-foals__input:focus,
.tta-foals select.tta-foals__input:focus { border-color: var(--tf-navy); outline: none; box-shadow: inset 0 0 0 1px var(--tf-navy); }
.tta-foals select.tta-foals__input {
  -webkit-appearance: none; appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%232e3192' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* ---------- Result bar ---------- */
.tta-foals__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding: 22px 0 14px;
}
.tta-foals .tta-foals__count { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; }
.tta-foals__total {
  font-family: var(--tf-display); font-weight: 300; font-size: 26px; line-height: 1.1; color: var(--tf-navy);
}
.tta-foals__range { font-size: 13px; color: var(--tf-muted); }
.tta-foals__chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tta-foals .tta-foals__chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 14px;
  font-size: 13px; font-weight: 500; color: var(--tf-navy);
  background: #fff; border: 1px solid var(--tf-gold);
}
.tta-foals .tta-foals__chip span { font-size: 17px; line-height: 1; color: var(--tf-gold-deep); }
.tta-foals .tta-foals__chip:hover { background: var(--tf-mist-soft); }
.tta-foals .tta-foals__clear { font-size: 13px; font-weight: 600; color: var(--tf-navy); text-decoration: underline; text-underline-offset: 3px; padding: 6px 4px; }

/* ---------- Table ---------- */
.tta-foals__tablewrap { overflow-x: auto; }
.tta-foals table.tta-foals__table {
  width: 100%; margin: 0; border-collapse: collapse; border: 0;
  font-size: 14px; background: #fff;
}
.tta-foals .tta-foals__table thead th {
  padding: 0; text-align: left; vertical-align: bottom;
  background: var(--tf-navy); border: 0; border-bottom: 3px solid var(--tf-gold);
}
.tta-foals .tta-foals__table .tta-foals__sort {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 15px 16px 13px;
  font-family: var(--tf-display); font-weight: 300; font-size: 15px; letter-spacing: 0.02em;
  color: #fff; text-align: left; white-space: nowrap;
}
.tta-foals .tta-foals__table .tta-foals__sort:hover { background: #262a7d; }
.tta-foals__arrow { width: 8px; height: 8px; flex: none; opacity: 0; transition: opacity .15s; }
.tta-foals th.is-sorted .tta-foals__arrow {
  opacity: 1;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--tf-gold); width: 0; height: 0;
}
.tta-foals th[aria-sort="ascending"] .tta-foals__arrow { transform: rotate(180deg); }
.tta-foals .tta-foals__table tbody td {
  padding: 12px 16px; vertical-align: top;
  border: 0; border-bottom: 1px solid var(--tf-rule);
  background: transparent; color: var(--tf-ink);
}
.tta-foals .tta-foals__table tbody tr:nth-child(even) td { background: var(--tf-mist-soft); }
.tta-foals .tta-foals__table tbody tr:hover td { background: #e7ecf6; }
.tta-foals .tta-foals__name { font-weight: 600; color: var(--tf-navy); }
.tta-foals .tta-foals__name.is-unnamed { font-weight: 400; font-style: italic; color: var(--tf-muted); }
.tta-foals .tta-foals__year, .tta-foals .tta-foals__date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tta-foals__none { color: #a3a8c2; }
.tta-foals .tta-foals__link {
  text-align: left; color: var(--tf-ink);
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  transition: text-decoration-color .15s, color .15s;
}
.tta-foals .tta-foals__link:hover { color: var(--tf-navy); text-decoration-color: var(--tf-gold-deep); }

/* ---------- Empty ---------- */
.tta-foals .tta-foals__empty { padding: 40px 24px; text-align: center; border: 1px dashed #c3cbe0; }
.tta-foals .tta-foals__empty p { margin: 0 0 16px; color: var(--tf-muted); }
.tta-foals .tta-foals__btn {
  padding: 12px 22px; font-size: 14px; font-weight: 500; color: #fff; background: var(--tf-gold);
}
.tta-foals .tta-foals__btn:hover { background: var(--tf-gold-deep); }

/* ---------- Pager ---------- */
.tta-foals .tta-foals__pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; padding: 26px 0 8px; }
.tta-foals .tta-foals__page {
  min-width: 40px; height: 40px; padding: 0 10px;
  font-size: 14px; font-weight: 500; color: var(--tf-navy);
  border: 1px solid var(--tf-rule); background: #fff;
}
.tta-foals .tta-foals__page:hover:not([disabled]) { border-color: var(--tf-navy); }
.tta-foals .tta-foals__page[aria-current="page"] { background: var(--tf-navy); border-color: var(--tf-navy); color: #fff; }
.tta-foals .tta-foals__page[disabled] { opacity: .4; cursor: default; }
.tta-foals .tta-foals__page--step { padding: 0 16px; }
.tta-foals__gap { color: var(--tf-muted); padding: 0 4px; }

/* ---------- Downloads ---------- */
.tta-foals .tta-foals__downloads { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--tf-rule); }
.tta-foals .tta-foals__dl-title {
  margin: 0 0 14px; font-family: var(--tf-display); font-weight: 300; font-size: 20px; color: var(--tf-navy);
  text-transform: none; letter-spacing: 0.01em;
}
.tta-foals .tta-foals__dl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tta-foals .tta-foals__dl-list li { margin: 0; padding: 0; }
.tta-foals .tta-foals__dl-list li::before { content: none; }
.tta-foals .tta-foals__dl-list a {
  display: inline-flex; flex-direction: column; gap: 1px;
  padding: 9px 16px; min-width: 112px;
  font-size: 14px; font-weight: 600; color: var(--tf-navy); text-decoration: none;
  border: 1px solid var(--tf-gold); background: #fff;
}
.tta-foals .tta-foals__dl-list a:hover { background: var(--tf-mist-soft); border-color: var(--tf-gold-deep); }
.tta-foals__dl-meta { font-size: 11px; font-weight: 400; color: var(--tf-muted); }

/* ---------- Tablet ---------- */
@media (max-width: 960px) {
  .tta-foals .tta-foals__panel { grid-template-columns: 1fr 1fr; padding: 20px; }
  .tta-foals__field--search { grid-column: 1 / -1; }
}

/* ---------- Phone: rows become entries — "by Sire out of Dam" ---------- */
@media (max-width: 700px) {
  .tta-foals .tta-foals__panel { grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; }
  .tta-foals__field--search, .tta-foals__field--sire { grid-column: 1 / -1; }
  .tta-foals__total { font-size: 22px; }

  .tta-foals table.tta-foals__table, .tta-foals .tta-foals__table tbody { display: block; }
  .tta-foals .tta-foals__table thead { display: block; }
  .tta-foals .tta-foals__table thead tr { display: flex; overflow-x: auto; }
  .tta-foals .tta-foals__table thead th { flex: none; }
  .tta-foals .tta-foals__table .tta-foals__sort { font-size: 13px; padding: 11px 12px 9px; }

  .tta-foals .tta-foals__table tbody tr {
    display: grid; grid-template-columns: 1fr auto;
    grid-template-areas: "name year" "sire sex" "dam dam" "date date";
    column-gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--tf-rule);
  }
  .tta-foals .tta-foals__table tbody tr:nth-child(even) { background: var(--tf-mist-soft); }
  .tta-foals .tta-foals__table tbody td { display: block; padding: 0; border: 0; background: none !important; }
  .tta-foals .tta-foals__name { grid-area: name; font-size: 15px; }
  .tta-foals .tta-foals__year { grid-area: year; justify-self: end; font-size: 13px; color: var(--tf-muted); }
  .tta-foals .tta-foals__sex { grid-area: sex; justify-self: end; margin-top: 6px; font-size: 13px; color: var(--tf-muted); }
  .tta-foals .tta-foals__sire { grid-area: sire; margin-top: 6px; }
  .tta-foals .tta-foals__dam { grid-area: dam; }
  .tta-foals .tta-foals__date { grid-area: date; margin-top: 4px; font-size: 12px; color: var(--tf-muted); }
  .tta-foals .tta-foals__sire::before,
  .tta-foals .tta-foals__dam::before,
  .tta-foals .tta-foals__date::before { content: attr(data-label) " "; color: var(--tf-muted); font-size: 13px; }
  .tta-foals .tta-foals__date:has(.tta-foals__none) { display: none; }
  .tta-foals .tta-foals__page { min-width: 36px; height: 38px; }
  .tta-foals .tta-foals__page:not([aria-current]):not(.tta-foals__page--step) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tta-foals * { transition: none !important; }
}
