/* الخيل المصرية — الخيل المصرية
   Mobile-first, RTL, PWA / future Capacitor */
:root {
  --ink: #1A0F0A;
  --brown: #2A180E;
  --brown-2: #3C2415;
  --brown-3: #5C3A22;
  --gold: #C9A254;
  --gold-deep: #9A7430;
  --gold-soft: #E8D5A3;
  --cream: #F7F0E4;
  --sand: #EDE3D0;
  --paper: #FBF7F0;
  --text: #2A1C12;
  --muted: #6E5846;
  --line: rgba(201, 162, 84, 0.38);
  --card: #fffdf8;
  --shadow: 0 10px 30px rgba(26, 15, 10, 0.12);
  --radius: 16px;
  --header-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --serif: "Amiri", "Noto Naskh Arabic", serif;
  --touch: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--paper);
  line-height: 1.7;
  min-height: 100dvh;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brown-3); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold-deep); }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip-link {
  position: absolute; right: 1rem; top: 0; transform: translateY(-200%); background: var(--gold); color: var(--ink);
  padding: .5rem 1rem; z-index: 100; border-radius: 8px;
}
.skip-link:focus { transform: none; top: calc(var(--safe-t) + 8px); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(26, 15, 10, 0.94);
  color: var(--cream);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: 8px 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: inherit; text-decoration: none; min-height: var(--touch);
}
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--serif); font-size: 1.15rem; color: var(--gold-soft); font-weight: 700; }
.brand-text span { font-size: .75rem; color: rgba(247,240,228,.7); }

.nav-toggle {
  appearance: none; background: transparent; border: 1px solid var(--line);
  color: var(--cream); width: var(--touch); height: var(--touch);
  border-radius: 10px; display: grid; place-items: center; cursor: pointer;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--gold-soft); position: relative; content: "";
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }

.site-nav { display: none; }
.site-nav.open, .site-nav.is-desktop { display: block; }
.site-nav ul {
  list-style: none; margin: 0; padding: 8px 16px calc(12px + var(--safe-b));
  display: flex; flex-direction: column; gap: 4px;
}
.site-nav a {
  display: flex; align-items: center; min-height: var(--touch);
  padding: 0 12px; color: var(--cream); text-decoration: none; border-radius: 10px;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  background: rgba(201,162,84,.16); color: var(--gold-soft);
}

.header-inner { flex-wrap: wrap; }
.site-nav { width: 100%; }
@media (min-width: 1040px) {
  .nav-toggle { display: none; }
  .site-nav, .site-nav.open, .site-nav.is-desktop {
    display: block;
    width: auto;
    margin-inline-start: auto;
  }
  .site-nav ul {
    flex-direction: row; align-items: center; padding: 0;
    flex-wrap: wrap;
  }
  .site-nav a { font-size: .92rem; }
}

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.page { padding-bottom: calc(40px + var(--safe-b)); }

/* Hero */
.hero {
  position: relative;
  color: var(--cream);
  background: var(--ink) center/cover no-repeat;
  min-height: min(78vh, 640px);
  display: flex; align-items: flex-end;
  isolation: isolate;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(26,15,10,.25) 0%, rgba(26,15,10,.55) 40%, rgba(26,15,10,.92) 100%);
  z-index: 0;
}
.hero-inner {
  position: relative; z-index: 1; width: 100%;
  max-width: 1180px; margin: 0 auto;
  padding: 32px 16px calc(28px + var(--safe-b));
}
.eyebrow {
  display: inline-block; color: var(--gold-soft); letter-spacing: .08em;
  font-size: .8rem; margin-bottom: 8px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 1.35; margin: 0 0 12px;
}
.hero p.lead { font-size: 1.05rem; max-width: 40rem; color: rgba(247,240,228,.9); margin: 0 0 20px; }

/* Search card */
.search-card {
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
  border: 1px solid var(--line);
}
.tabs { display: flex; gap: 6px; margin-bottom: 12px; background: var(--sand); padding: 4px; border-radius: 12px; }
.tab-btn {
  flex: 1; min-height: var(--touch); border: 0; border-radius: 10px;
  background: transparent; color: var(--brown-3); cursor: pointer; font-weight: 700;
  line-height: 1.25; padding: 6px 8px;
}
.tab-btn[aria-selected="true"] { background: var(--brown); color: var(--gold-soft); }
.search-box { position: relative; }
.search-box input {
  width: 100%; min-height: 52px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--paper);
  padding: 10px 44px 10px 14px; color: var(--text);
}
.search-box .icon-search {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--gold-deep); pointer-events: none;
}
.search-hint { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.results { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.result-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px; min-height: var(--touch);
  background: var(--cream); border-radius: 12px; text-decoration: none; color: inherit;
  border: 1px solid transparent;
}
.result-item .meta { flex: 1 1 10rem; text-align: start; }
.result-item:hover { border-color: var(--gold); }
.result-item .name-ar { font-weight: 700; display: block; }
.result-item .name-en { font-size: .85rem; color: var(--muted); }
.result-item .meta { font-size: .8rem; color: var(--muted); }

/* Sections */
.section { padding: 36px 0; }
.section h2 {
  font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin: 0 0 8px; color: var(--brown);
}
.section .sub { color: var(--muted); margin: 0 0 20px; }
.intro-grid, .cards, .timeline { display: grid; gap: 16px; }
@media (min-width: 760px) {
  .intro-grid { grid-template-columns: 1.2fr .8fr; align-items: start; }
  .cards { grid-template-columns: repeat(3, 1fr); }
}

.card, .news-card, .person-card, .horse-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 16px rgba(26,15,10,.05);
}
.card { padding: 20px; }
.card h3, .horse-card h3, .person-card h3, .news-card h3 {
  font-family: var(--serif); margin: 0 0 8px; font-size: 1.25rem;
}
.media-frame { aspect-ratio: 4/3; overflow: hidden; background: var(--sand); }
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.horse-card a, .person-card a, .news-card a { color: inherit; text-decoration: none; display: block; }
.horse-card .body, .person-card .body, .news-card .body { padding: 14px 16px 18px; }
.caption { font-size: .75rem; color: var(--muted); margin-top: 6px; }

.badge, .verified {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: rgba(201,162,84,.18); color: var(--gold-deep);
  border: 1px solid var(--line); white-space: nowrap;
}
.verified::before { content: "✓"; font-weight: 900; }
.status-upcoming { background: #e8f4ea; color: #215c2e; border-color: #b7d8be; }
.status-current { background: #f7ecd4; color: #7a4b00; border-color: var(--gold); }
.status-past, .status-listed { background: var(--sand); color: var(--muted); }

/* Timeline */
.timeline { position: relative; padding-right: 20px; }
.timeline::before {
  content: ""; position: absolute; right: 5px; top: 0; bottom: 0; width: 2px; background: var(--line);
}
.tl-item { position: relative; padding: 0 24px 24px 0; }
.tl-item::before {
  content: ""; position: absolute; right: 0; top: 8px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--paper);
}
.tl-item time, .tl-year {
  display: block; color: var(--gold-deep); font-weight: 800; font-size: .9rem;
}
.tl-item h3 { margin: 4px 0 6px; font-family: var(--serif); }
.source-link { font-size: .85rem; }

/* Horse page */
.horse-hero, .person-hero {
  background: linear-gradient(180deg, var(--brown) 0%, var(--ink) 100%);
  color: var(--cream); padding: 24px 0 28px;
}
.kicker { color: var(--gold-soft); font-size: .85rem; margin: 0 0 6px; }
.horse-hero h1, .person-hero h1 {
  font-family: var(--serif); margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem);
}
.en-name { margin: 4px 0 12px; color: rgba(247,240,228,.75); font-size: 1.05rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; list-style: none; }
.facts li { font-size: .95rem; }
.facts strong { color: var(--gold-soft); font-weight: 700; margin-left: 6px; }
.toolbar-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--touch); padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--brown-2); color: var(--gold-soft);
  text-decoration: none; cursor: pointer; font-weight: 700;
}
.btn-ghost { background: transparent; color: var(--cream); }
.btn-gold { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn-light { background: var(--card); color: var(--brown); }

/* Pedigree */
.pedigree-panel { background: var(--sand); border-radius: 20px; padding: 12px; border: 1px solid var(--line); }
.pedigree-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-wrap: wrap; margin-bottom: 8px;
}
.pedigree-toolbar .tools { display: flex; gap: 6px; }
.pedigree-toolbar button {
  min-width: var(--touch); min-height: var(--touch); border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700;
}
.pedigree-hint { font-size: .8rem; color: var(--muted); margin: 0; }
.pedigree-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  overscroll-behavior: contain;
  max-height: min(78vh, 820px);
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    repeating-linear-gradient(135deg, transparent, transparent 10px, rgba(201,162,84,.05) 10px, rgba(201,162,84,.05) 20px);
  border-radius: 14px;
  padding: 12px;
  cursor: grab;
}
.pedigree-scroll:active { cursor: grabbing; }
.pedigree-tree {
  transform-origin: top right;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  min-width: 920px;
  width: max-content;
  padding: 8px;
}
.ped-col {
  display: flex; flex-direction: column; justify-content: space-around;
}
.ped-slot {
  flex: 1; display: flex; align-items: center;
  min-height: 52px; position: relative;
}
.ped-col[data-gen="4"] .ped-slot { min-height: 36px; }
.p-node, .p-unknown {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 8px;
  width: 148px; min-height: 52px;
  box-shadow: 0 1px 0 rgba(26,15,10,.04);
  position: relative;
}
.ped-col[data-gen="0"] .p-node {
  width: 170px; min-height: 72px; background: var(--brown); color: var(--cream);
  border-color: var(--gold);
}
.ped-col[data-gen="0"] .p-node .en { color: rgba(247,240,228,.7); }
.p-node .ar { font-weight: 800; font-size: .9rem; display: block; line-height: 1.3; }
.p-node .en { font-size: .7rem; color: var(--muted); display: block; }
.p-node .yr { font-size: .68rem; color: var(--muted); }
.ped-col[data-gen="0"] .p-node .yr { color: var(--gold-soft); }
.p-unknown { background: #f3eee6; color: var(--muted); font-size: .75rem; display: flex; align-items: center; }
.p-node.has-title { border-color: var(--gold-deep); }
.medal {
  position: absolute; top: -7px; left: -7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(180deg, #f3d989, #c9a254);
  color: var(--ink); font-size: 12px;
  display: grid; place-items: center;
  border: 1px solid #8a6a28;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  cursor: pointer; z-index: 2;
}
.connector {
  width: 16px; position: relative;
}
.ped-pair { display: flex; flex: 1; flex-direction: column; }
/* vertical bar between sire/dam groups */
.ped-join {
  display: flex; flex-direction: row; align-items: stretch; flex: 1;
}
.ped-join .bar {
  width: 14px; position: relative;
}
.ped-join .bar::before {
  content: ""; position: absolute; top: 25%; bottom: 25%; left: 0;
  border-top: 1px solid var(--gold-deep);
  border-bottom: 1px solid var(--gold-deep);
  border-left: 1px solid var(--gold-deep);
  width: 8px;
}
.ped-join .bar::after {
  content: ""; position: absolute; top: 50%; left: 8px; width: 8px;
  border-top: 1px solid var(--gold-deep);
}

/* Champions list */
.champ-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.champ-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.champ-list a { font-weight: 700; text-decoration: none; }
.muted { color: var(--muted); }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 800px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Tooltip / popover for medals on touch */
.medal-pop {
  position: absolute; z-index: 80; max-width: 260px;
  background: var(--ink); color: var(--cream);
  padding: 8px 10px; border-radius: 10px; font-size: .8rem;
  box-shadow: var(--shadow); border: 1px solid var(--gold);
}
.medal-pop::after {
  content: ""; position: absolute; top: 100%; right: 12px;
  border: 6px solid transparent; border-top-color: var(--ink);
}

/* Admin form */
.form { display: grid; gap: 12px; max-width: 640px; }
.form label { font-weight: 700; display: grid; gap: 6px; }
.form input, .form select, .form textarea {
  min-height: var(--touch); border-radius: 10px; border: 1px solid var(--line);
  padding: 8px 12px; background: #fff;
}
.form textarea { min-height: 100px; resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Footer */
.site-footer {
  background: var(--ink); color: rgba(247,240,228,.8);
  padding: 28px 16px calc(24px + var(--safe-b));
  border-top: 1px solid var(--line);
}
.footer-inner { max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; }
@media (min-width: 700px) { .footer-inner { grid-template-columns: 1.2fr 1fr; } }
.site-footer h2 { font-family: var(--serif); color: var(--gold-soft); margin: 0 0 8px; font-size: 1.2rem; }
.site-footer a { color: var(--gold-soft); }
.tiny { font-size: .8rem; color: rgba(247,240,228,.6); }
.page .tiny, .coi-box .tiny, .section .tiny { color: var(--muted); }
.copyright {
  max-width: 1180px; margin: 20px auto 0;
  padding-top: 16px; border-top: 1px solid var(--line);
  font-size: .9rem; color: var(--gold-soft); font-weight: 700;
}
.data-error {
  background: #f7e4d4; color: #5c2a12; border-bottom: 1px solid #e0b08a;
  padding: 12px 0;
}
.data-error p { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.empty { text-align: center; color: var(--muted); padding: 20px 8px; }

/* Definition callout */
.callout {
  background: linear-gradient(180deg, #fff, var(--cream));
  border-right: 4px solid var(--gold);
  padding: 16px 18px; border-radius: 0 12px 12px 0;
}

/* Install hint */
.install-hint {
  display: none; margin-top: 10px; font-size: .85rem; color: var(--muted);
}

@media (max-width: 759px) {
  .cards { grid-template-columns: 1fr; }
  .ped-tree-note { display: block; }
}

/* Racing */
.race-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.race-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  min-height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700;
}
.chip[aria-pressed="true"] { background: var(--brown); color: var(--gold-soft); border-color: var(--gold); }
.race-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.race-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: grid; gap: 4px;
}
.race-item .top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.flag-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 700;
  background: var(--sand); border-radius: 999px; padding: 2px 10px;
}
.race-pos { font-weight: 800; color: var(--gold-deep); }
.race-icon {
  position: absolute; top: -7px; right: -7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #2c4a3a; color: #e8f4ea;
  font-size: 11px; display: grid; place-items: center;
  border: 1px solid #1a3328; cursor: pointer; z-index: 2;
}
.p-node.has-race { box-shadow: inset 0 -2px 0 #2c4a3a; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.legend-row span { display: inline-flex; align-items: center; gap: 4px; }

/* Asayel brand + section layout */
.brand-text strong { font-family: var(--serif); font-size: 1.25rem; letter-spacing: .02em; }
.brand-text span { font-size: .75rem; color: var(--gold-soft); }

.section-subnav {
  background: var(--brown);
  border-bottom: 1px solid var(--line);
}
.section-subnav ul {
  list-style: none; margin: 0 auto; padding: 0 16px;
  max-width: 1180px; display: flex; flex-wrap: wrap; gap: 4px;
}
.section-subnav a {
  display: flex; align-items: center; min-height: 44px;
  padding: 0 12px; color: var(--cream); text-decoration: none;
  border-radius: 10px; font-weight: 700; font-size: .92rem;
}
.section-subnav a[aria-current="page"], .section-subnav a:hover {
  background: rgba(201,162,84,.16); color: var(--gold-soft);
}

.badge-se {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(180deg, #e8d5a3, #c9a254);
  color: #2A180E; font-weight: 800; font-size: .75rem;
  padding: 2px 10px; border-radius: 999px; border: 1px solid #9A7430;
  letter-spacing: .02em;
}
.badge-open {
  display: inline-flex; align-items: center;
  background: #2c4a3a; color: #e8f4ea;
  font-weight: 800; font-size: .75rem;
  padding: 2px 10px; border-radius: 999px; border: 1px solid #1a3328;
  letter-spacing: .02em;
}
.badge-line {
  display: inline-flex; align-items: center;
  background: var(--sand); color: var(--brown);
  font-weight: 700; font-size: .75rem;
  padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line);
}

.section-cards {
  display: grid; gap: 16px; margin-top: 8px;
}
@media (min-width: 760px) {
  .section-cards { grid-template-columns: 1fr 1fr; }
}
.gateway-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 22px 22px 24px;
  box-shadow: var(--shadow); min-height: 180px;
  transition: transform .15s ease, border-color .15s ease;
}
.gateway-card:hover { transform: translateY(-2px); border-color: var(--gold); color: inherit; }
.gateway-card .eyebrow { color: var(--gold-deep); font-weight: 800; font-size: .8rem; }
.gateway-card h2 { font-family: var(--serif); color: var(--brown); margin: 6px 0 8px; font-size: 1.7rem; }
.gateway-card p { margin: 0; color: var(--muted); }
.gateway-card.se { background: linear-gradient(180deg, #fffdf8, #f3e6c8); }

.search-filters {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: center; margin-top: 12px;
}
.search-filters label { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 700; margin: 0; }
.search-filters select {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; padding: 0 10px; color: var(--text);
}
.toggle {
  cursor: pointer; user-select: none;
  background: var(--sand); border-radius: 999px; padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
}
.toggle input { width: 18px; height: 18px; accent-color: var(--brown); }
.search-filters.is-locked-se .toggle { background: #e8d5a3; border-color: var(--gold); }

/* Calendar tables */
.cal-filters {
  display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 20px; align-items: end;
}
.cal-filters label { display: grid; gap: 4px; font-weight: 700; font-size: .85rem; }
.cal-filters select, .cal-filters button {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; padding: 0 12px;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table.cal {
  width: 100%; border-collapse: collapse; min-width: 640px; font-size: .95rem;
}
table.cal th, table.cal td {
  padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.cal th {
  background: var(--brown); color: var(--gold-soft); font-weight: 800; font-size: .85rem;
}
table.cal tr:last-child td { border-bottom: 0; }
table.cal tbody tr:hover { background: var(--sand); }

.kicker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Terms and error pages */
.terms-page .section { padding: 16px 0; }
.terms-page .section h2 { font-size: 1.35rem; }
.terms-page p { max-width: 70ch; }
.error-page { padding-top: 48px; padding-bottom: calc(80px + var(--safe-b)); }
.pedigree-source { margin-top: 8px; }

/* ===== Classic pedigree table (Asayel theme) ===== */
.ped-classic { padding: 14px; }
.ped-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ped-subject { background: var(--brown); color: var(--cream); border: 1px solid var(--gold); border-radius: 12px; padding: 8px 14px; display: flex; flex-direction: column; }
.ped-subject-name { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: .04em; font-size: 1.05rem; color: var(--gold-soft); }
.ped-subject-meta { font-size: .75rem; color: rgba(247,240,228,.75); }
.ped-gens { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
.ped-gens button { min-width: 40px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 800; cursor: pointer; color: var(--brown-3); }
.ped-gens button[aria-pressed="true"] { background: var(--brown); color: var(--gold-soft); border-color: var(--gold); }
.ped-scroll-hint { display: none; font-size: .78rem; color: var(--gold-deep); margin: 0 0 6px; }
.ped-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.ped-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; table-layout: fixed; direction: rtl; }
.ped-table.ped-g3 { min-width: 0; }
.ped-table.ped-g4 { min-width: 620px; }
.ped-table th { position: sticky; top: 0; background: var(--sand); color: var(--brown-3); font-size: .72rem; font-weight: 800; padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); z-index: 2; }
.ped-table td.pc { position: relative; vertical-align: middle; padding: 4px 8px 4px 10px; border-bottom: 1px solid rgba(154,116,48,.22); border-left: 1px solid rgba(154,116,48,.22); line-height: 1.25; }
.ped-table td.pc-sire { background: #EEF2F4; box-shadow: inset -3px 0 0 #8FA6B4; }
.ped-table td.pc-dam { background: #F7EAE4; box-shadow: inset -3px 0 0 #C9A08F; }
.ped-table td.pc-g1 { padding-top: 10px; padding-bottom: 10px; }
.ped-table td.pc-g1.pc-sire { background: #E3EAEE; }
.ped-table td.pc-g1.pc-dam { background: #F2DFD6; }
.ped-table td.pc-empty { background: #FAF6EE; box-shadow: none; text-align: center; }
.pc-dash { color: #C2B39A; font-weight: 700; }
.pc-link { display: block; text-decoration: none; color: inherit; }
.pc-link:hover .pc-name, .pc-link:focus .pc-name { color: var(--gold-deep); text-decoration: underline; }
.pc-name { display: block; font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: .78rem; letter-spacing: .02em; color: var(--brown); text-align: right; overflow-wrap: anywhere; }
.pc-g1 .pc-name { font-size: .92rem; }
.pc-g2 .pc-name { font-size: .85rem; }
.pc-g5 .pc-name { font-size: .72rem; }
.pc-meta { display: block; font-size: .66rem; color: var(--muted); }
.pc-badges { display: inline-flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.pc-badges:empty { display: none; }
.ped-table td.pc-dup { box-shadow: inset -6px 0 0 var(--dup); }
.ped-table td.pc-dup .pc-name { color: var(--dup); }
.pb { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: .62rem; font-weight: 800; line-height: 1; border: 1px solid transparent; cursor: default; font-family: var(--font); }
.pb-se { background: rgba(201,162,84,.22); color: var(--gold-deep); border-color: rgba(154,116,48,.4); }
.pb-medal { background: linear-gradient(180deg, #f3d989, #c9a254); color: var(--ink); border-color: #8a6a28; cursor: pointer; padding: 0; width: 18px; }
.pb-race { background: #2c4a3a; color: #e8f4ea; border-color: #1a3328; cursor: pointer; padding: 0; width: 18px; font-size: .6rem; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.lg-sire { background: #EEF2F4; box-shadow: inset -3px 0 0 #8FA6B4; border: 1px solid #cfd8de; }
.lg-dam { background: #F7EAE4; box-shadow: inset -3px 0 0 #C9A08F; border: 1px solid #e6cfc4; }
.ped-filled { font-weight: 700; color: var(--brown-3); }
.ped-inbr-wrap { margin-top: 12px; }
.ped-inbr-wrap h3 { font-size: .95rem; margin: 0 0 2px; color: var(--brown); }
.ped-inbr { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ped-inbr li { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .78rem; }
.ped-inbr .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--dup); }
.ped-inbr a { color: var(--dup); font-weight: 800; text-decoration: none; font-family: Georgia, serif; }
.ped-inbr .x { color: var(--muted); }
.ped-inbr-none { font-size: .8rem; color: var(--muted); }
@media (max-width: 759px) {
  .ped-scroll-hint { display: block; }
  .ped-table td.pc-first, .ped-table th.pc-first { position: sticky; right: 0; z-index: 3; }
  .ped-table th.pc-first { z-index: 4; }
  .ped-table td.pc-first { width: 104px; box-shadow: inset -3px 0 0 #8FA6B4, -4px 0 8px -4px rgba(26,15,10,.25); }
  .ped-table td.pc-first.pc-dam { box-shadow: inset -3px 0 0 #C9A08F, -4px 0 8px -4px rgba(26,15,10,.25); }
  .ped-table td.pc-first.pc-dup { box-shadow: inset -6px 0 0 var(--dup), -4px 0 8px -4px rgba(26,15,10,.25); }
  .ped-table th.pc-first { width: 104px; }
  .ped-table.ped-g5 { min-width: 600px; }
  .ped-table.ped-g4 { min-width: 520px; }
  .ped-table.ped-g3 { min-width: 0; }
  .pc-g1 .pc-name { font-size: .8rem; }
}

/* ===== Progeny / siblings tables ===== */
.rel-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.rel-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 520px; }
.rel-table th { background: var(--sand); color: var(--brown-3); text-align: right; padding: 8px 10px; font-size: .75rem; }
.rel-table td { padding: 8px 10px; border-top: 1px solid rgba(154,116,48,.18); vertical-align: middle; }
.rel-table tr:nth-child(even) td { background: #fdf9f1; }
.rel-table .en-up { font-family: Georgia, serif; font-weight: 700; letter-spacing: .02em; text-decoration: none; color: var(--brown); }
.rel-table .en-up:hover { color: var(--gold-deep); text-decoration: underline; }
.rel-count { display: inline-block; background: var(--brown); color: var(--gold-soft); border-radius: 999px; padding: 0 10px; font-size: .8rem; margin-inline-start: 6px; vertical-align: middle; font-family: var(--font); }
.rel-sub { margin: 18px 0 8px; font-size: 1.05rem; color: var(--brown); }
.bio { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; line-height: 1.9; }
.src-list { font-size: .8rem; color: var(--muted); padding-inline-start: 18px; margin: 8px 0 0; }
.badge-ref { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: #eef2f4; color: #3d5562; border: 1px solid #cfd8de; }

/* ===== Encyclopedia ===== */
.enc-filters { display: grid; gap: 10px; margin-bottom: 14px; }
.enc-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.enc-letters { display: flex; flex-wrap: wrap; gap: 4px; }
.enc-letters button { min-width: 34px; min-height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 800; color: var(--brown-3); font-family: Georgia, var(--font); }
.enc-letters button[aria-pressed="true"] { background: var(--brown); color: var(--gold-soft); border-color: var(--gold); }
.enc-letters button:disabled { opacity: .35; cursor: default; }
.enc-search { flex: 1; min-width: 200px; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); padding: 0 12px; background: var(--paper); font: inherit; }
.enc-count { font-size: .85rem; color: var(--muted); }
.enc-group h2 { font-family: Georgia, var(--serif); font-size: 1.4rem; margin: 18px 0 8px; color: var(--gold-deep); border-bottom: 1px solid var(--line); }
.enc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.enc-list a { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; text-decoration: none; color: inherit; min-height: 44px; }
.enc-list a:hover { border-color: var(--gold); }
.enc-list .n { font-family: Georgia, serif; font-weight: 700; letter-spacing: .02em; color: var(--brown); }
.enc-list .ar { font-size: .85rem; color: var(--brown-3); }
.enc-list .m { font-size: .75rem; color: var(--muted); }
.pc-part { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; margin-top: 2px; }
.pp { display: block; font-size: .6rem; line-height: 1.3; color: #4a3a2c; white-space: normal; text-align: right; font-family: var(--font); }
.pp-show { color: #7a5a14; }
.pp-end { color: #2d5b4a; }
.pp-race { color: #24433a; }
.pp-more { font-size: .6rem; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 0 6px; cursor: pointer; color: var(--gold-deep); font-weight: 800; }
.medal-pop { white-space: pre-line; }

/* ===== Inquiry modal / form ===== */
.inq-btn { cursor: pointer; }
body.inq-open { overflow: hidden; }
.inq-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.inq-backdrop { position: absolute; inset: 0; background: rgba(26,15,10,.55); }
.inq-dialog { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--paper); border: 1px solid var(--gold); border-radius: 18px; padding: 16px 18px 20px; box-shadow: var(--shadow); }
.inq-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.inq-head h2 { margin: 0; font-family: var(--serif); color: var(--brown); }
.inq-x { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 1.4rem; cursor: pointer; }
.inq-form { display: grid; gap: 10px; }
.inq-form label { display: grid; gap: 4px; font-weight: 700; font-size: .9rem; color: var(--brown-3); }
.inq-form input, .inq-form textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); min-height: 44px; }
.inq-form .inq-ro { background: var(--sand); color: var(--brown); font-weight: 700; }
.inq-hp { display: none !important; }
.inq-err { color: #a3352b; font-size: .85rem; margin: 0; }
.inq-ok { background: #eaf4ea; border: 1px solid #b9d8bb; color: #24502a; border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.inq-page { max-width: 620px; }
.ped-inbr-wrap .tiny { color: var(--muted); }
.ped-subject .pc-part { align-items: flex-start; }
.ped-subject .pp { color: var(--gold-soft); font-size: .68rem; text-align: left; }
.ped-table td.pc-champ .pc-name::after { content: " ★"; color: #b8891f; font-size: .8em; }
.ped-table td.pc-champ { outline: 1px solid rgba(184,137,31,.55); outline-offset: -2px; }
.ped-abp { margin: 10px 0 0; font-size: .85rem; }
.ped-abp a { color: var(--gold-deep); font-weight: 700; }
.coi-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.coi-val { font-size: 1.6rem; font-weight: 800; font-family: Georgia, serif; color: var(--brown); direction: ltr; }
.coi-badge { display: inline-block; border-radius: 999px; padding: 2px 12px; font-weight: 800; font-size: .9rem; }
.coi-low { background: #e5f2e6; color: #23602b; border: 1px solid #b6d7b9; }
.coi-mid { background: #fbf0d6; color: #8a6312; border: 1px solid #e6cf92; }
.coi-high { background: #f8e1dd; color: #9b2c1f; border: 1px solid #e4b3aa; }
.mate-form { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .mate-form { grid-template-columns: 1fr 1fr auto; align-items: end; } }
.mate-form label { display: grid; gap: 4px; font-weight: 700; color: var(--brown-3); font-size: .9rem; }
.mate-form input { font: inherit; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; direction: ltr; text-align: left; }
.disclaimer { font-size: .8rem; color: var(--muted); background: #fbf6ec; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.pc-part { align-items: flex-start; }
.pp { direction: rtl; text-align: right; }
.pp-win { color: #8a6312; font-weight: 800; }
.pp-win small { font-weight: 600; color: var(--muted); }
.pp-total { color: var(--muted); }
.ped-subject .pp-win, .ped-subject .pp-total { color: var(--gold-soft); }
.ped-subject .pp { text-align: right; }

/* ===== Compact pedigree (dense) — overrides ===== */
.ped-classic { padding: 8px; border-radius: 8px; }
.ped-head { margin-bottom: 6px; gap: 6px; }
.ped-subject { padding: 4px 10px; border-radius: 6px; }
.ped-subject-name { font-size: 13px; }
.ped-subject-meta { font-size: 10.5px; }
.ped-gens { font-size: 12px; }
.ped-gens button { min-width: 30px; min-height: 28px; border-radius: 6px; font-size: 12px; }
.ped-scroll { border-radius: 2px; border: 1px solid #bfa77a; background: #fffdf9; }
.ped-table { font-size: 11px; min-width: 0; border-spacing: 0; }
.ped-table.ped-g5 { min-width: 0; }
.ped-table.ped-g4 { min-width: 0; }
.ped-table th { font-size: 10px; padding: 2px 4px; font-weight: 700; }
.ped-table td.pc { padding: 1px 5px 1px 4px; line-height: 1.15; border-bottom: 1px solid rgba(120,90,40,.28); border-left: 1px solid rgba(120,90,40,.28); }
.ped-table td.pc-g1 { padding-top: 2px; padding-bottom: 2px; }
.ped-table td.pc-sire { box-shadow: inset -2px 0 0 #8FA6B4; }
.ped-table td.pc-dam { box-shadow: inset -2px 0 0 #C9A08F; }
.ped-table td.pc-dup { box-shadow: inset -4px 0 0 var(--dup); }
.pc-name, .pc-g1 .pc-name, .pc-g2 .pc-name, .pc-g5 .pc-name { font-size: 11px; letter-spacing: 0; }
.pc-g1 .pc-name { font-size: 12px; }
.pc-meta { font-size: 9.5px; line-height: 1.15; }
.pc-g4 .pc-link, .pc-g5 .pc-link { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; }
.pc-g4 .pc-name, .pc-g5 .pc-name { display: inline; }
.pc-g4 .pc-meta, .pc-g5 .pc-meta { display: inline; }
.pc-badges { margin-top: 0; }
.pb { min-width: 0; height: 13px; padding: 0 4px; font-size: 8.5px; }
.pc-part { margin-top: 1px; gap: 0; }
.pp { font-size: 9.5px; line-height: 1.2; }
.pc-dash { font-size: 10px; }
.ped-table td.pc-empty { padding: 0 4px; }
.ped-scroll-hint { font-size: 11px; margin-bottom: 4px; }
.ped-foot .legend-row { font-size: 11px; gap: 8px 12px; margin-top: 6px; }
.ped-inbr-wrap { margin-top: 6px; }
.ped-inbr-wrap h3 { font-size: 12.5px; }
.ped-inbr li { font-size: 11px; padding: 1px 8px; }
.ped-abp { font-size: 12px; margin-top: 6px; }
.coi-box { padding: 6px 10px; margin: 6px 0; gap: 8px; font-size: 13px; }
.coi-val { font-size: 1.15rem; }
@media (max-width: 759px) {
  .ped-table.ped-g5 { min-width: 560px; }
  .ped-table.ped-g4 { min-width: 440px; }
  .ped-table td.pc-first, .ped-table th.pc-first { width: 92px; }
  .pc-g1 .pc-name { font-size: 11px; }
}

/* ===== Fit-to-width pedigree grid (no horizontal scroll) — final overrides ===== */
.ped-classic { padding: 6px; }
.ped-head { margin-bottom: 4px; gap: 4px; align-items: center; }
.ped-subject { padding: 2px 8px; border-radius: 4px; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 8px; max-width: 100%; }
.ped-subject-name { font-size: 12.5px; }
.ped-subject-meta { font-size: 10px; }
.ped-subject .pc-part { flex-basis: 100%; }
.ped-subject .pp { font-size: 9.5px; color: var(--cream); display: inline; margin-inline-end: 8px; }
.ped-gens { font-size: 11px; gap: 4px; }
.ped-gens button { min-width: 26px; min-height: 24px; font-size: 11px; border-radius: 4px; }
.ped-scroll { overflow-x: hidden; border: 0; border-radius: 0; background: transparent; }
.ped-scroll-hint { display: none !important; }
.ped-table, .ped-table.ped-g3, .ped-table.ped-g4, .ped-table.ped-g5 { width: 100%; min-width: 0 !important; max-width: 100%; table-layout: fixed; border-collapse: collapse; border: 1px solid #a89878; }
.ped-table th { position: static; font-size: 9.5px; padding: 1px 3px; border: 1px solid #a89878; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ped-table td.pc, .ped-table td.pc-first, .ped-table th.pc-first { position: static; width: auto; border: 1px solid #a89878; padding: 1px 3px; line-height: 1.15; vertical-align: middle; overflow: hidden; }
.ped-table td.pc-sire, .ped-table td.pc-first.pc-sire { box-shadow: none; }
.ped-table td.pc-dam, .ped-table td.pc-first.pc-dam { box-shadow: none; }
.ped-table td.pc-dup { box-shadow: inset -3px 0 0 var(--dup) !important; }
.pc-link { display: block; min-width: 0; }
.pc-name, .pc-g1 .pc-name, .pc-g2 .pc-name, .pc-g4 .pc-name, .pc-g5 .pc-name { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pc-g4 .pc-link, .pc-g5 .pc-link { display: block; }
.pc-meta, .pc-g4 .pc-meta, .pc-g5 .pc-meta { display: block; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-part { display: block; overflow: hidden; }
.pp { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-badges { display: inline; }
.pb { height: 12px; font-size: 8px; padding: 0 3px; }
.ped-foot .legend-row { font-size: 10px; gap: 4px 10px; margin-top: 4px; }
.lg { width: 10px; height: 10px; }
.ped-inbr-wrap h3 { font-size: 12px; margin: 4px 0 2px; }
.ped-inbr-wrap .tiny { font-size: 10px; margin: 0 0 4px; }
.ped-inbr li { font-size: 10px; padding: 0 6px; }
.coi-box { padding: 4px 8px; margin: 4px 0; font-size: 12px; gap: 6px; }
.coi-val { font-size: 1rem; }
@media (max-width: 759px) {
  .ped-classic { padding: 2px; border-radius: 4px; }
  .ped-table th { font-size: 8.5px; padding: 1px 2px; }
  .ped-table td.pc, .ped-table td.pc-first { padding: 0 2px; line-height: 1.1; }
  .pc-name, .pc-g1 .pc-name, .pc-g2 .pc-name, .pc-g3 .pc-name, .pc-g4 .pc-name, .pc-g5 .pc-name { font-size: 9.5px; }
  .pc-meta { font-size: 8.5px; }
  .pp { font-size: 8.5px; }
  .pc-g4 .pc-meta, .pc-g5 .pc-meta, .pc-g4 .pc-part, .pc-g5 .pc-part, .pc-g4 .pc-badges, .pc-g5 .pc-badges { display: none; }
  .ped-table.ped-g5 .pc-g3 .pc-part, .ped-table.ped-g5 .pc-g3 .pc-badges { display: none; }
  .pc-dash { font-size: 9px; }
  .ped-subject-name { font-size: 12px; }
  .ped-subject { padding: 2px 6px; }
  .ped-foot .legend-row { font-size: 9.5px; }
  .coi-box { font-size: 11px; }
}
.ped-namepop { font-size: 12px; max-width: 90vw; }
.ped-sec h2 { font-size: 1.05rem; margin-bottom: 2px; }
.ped-sec .sub { font-size: 11px; margin: 0 0 4px; }
@media (max-width: 759px) {
  #pedigree { margin-inline: -12px; }
  .ped-sec { margin-top: 10px; }
  .horse-hero .wrap { padding-top: 12px; padding-bottom: 12px; }
  .horse-hero h1 { font-size: 1.45rem; margin: 2px 0; }
  .horse-hero .facts { font-size: 12px; gap: 4px 10px; }
  .horse-hero .toolbar-links { gap: 6px; margin-top: 8px; }
  .horse-hero .toolbar-links .btn { min-height: 34px; padding: 4px 12px; font-size: 13px; }
}
@media (min-width: 760px) {
  .pc-g3 .pc-link, .pc-g4 .pc-link, .pc-g5 .pc-link { display: flex; align-items: baseline; gap: 0 4px; min-width: 0; }
  .pc-g3 .pc-name, .pc-g4 .pc-name, .pc-g5 .pc-name { flex: 0 1 auto; min-width: 0; }
  .pc-g3 .pc-meta, .pc-g4 .pc-meta, .pc-g5 .pc-meta { flex: 0 0 auto; }
  .ped-table.ped-g5 .pc-g5 .pc-badges { display: none; }
}
@media (max-width: 759px) {
  .coi-box .tiny { font-size: 10px; }
  .coi-box .coi-badge { font-size: 11px; padding: 0 8px; }
  .coi-box .coi-val { font-size: 14px; }
}
.visit-counter { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--gold-soft, #e8d3a0); background: rgba(255,255,255,.06); border: 1px solid rgba(201,162,84,.35); border-radius: 999px; padding: 1px 8px; white-space: nowrap; margin-inline-start: auto; margin-inline-end: 8px; }
.visit-counter[hidden] { display: none !important; }
.visit-counter b { font-weight: 800; font-family: Georgia, serif; }
@media (max-width: 380px) { .visit-counter { font-size: 10px; padding: 0 6px; } }
.reg-note { background: #fff7e3; border: 1px solid #e3c98a; border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 0 0 10px; }
.reg-share { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reg-form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px 4px; margin: 0 0 10px; }
.reg-form legend { font-weight: 800; color: var(--brown-3); padding: 0 6px; font-size: 14px; }
.reg-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0 8px; }
.reg-pick { margin: -4px 0 6px; min-height: 1em; }
.reg-pick.ok { color: #2c6a3a; } .reg-pick.new { color: var(--gold-deep); } .reg-pick.bad { color: #a03020; }
.req { color: #a03020; }
.reg-import textarea { width: 100%; min-height: 140px; font-family: monospace; direction: ltr; }
@media (max-width: 759px) {
  .rel-table { min-width: 0; table-layout: fixed; font-size: 11px; }
  .rel-table th, .rel-table td { padding: 4px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rel-table-wrap { overflow-x: hidden; }
}
@media (max-width: 759px) {
  .rel-table td a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
  .rel-table th:first-child, .rel-table td:first-child { width: 32%; }
}

/* tidy search results */
.result-item.ri2 { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; flex-wrap:nowrap; }
.ri2 .ri-names { min-width:0; flex:1 1 auto; overflow:hidden; }
.ri2 .name-ar, .ri2 .name-en, .ri2 .ri-par { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ri2 .name-ar { font-size:.95rem; }
.ri2 .name-en { font-size:.78rem; }
.ri2 .ri-par { font-size:.72rem; color:var(--muted); direction:ltr; text-align:right; }
.ri2 .ri-meta { flex:0 0 auto; display:flex; flex-direction:column; align-items:flex-end; gap:3px; font-size:.72rem; color:var(--muted); text-align:end; }
.ri2 .ri-meta .badge-se, .ri2 .ri-meta .badge-open { font-size:.7rem; white-space:nowrap; }
@media (max-width:600px){ .result-item.ri2 { padding:7px 8px; } .ri2 .name-ar{font-size:.88rem} }

.search-filters { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; }
.search-filters label { display:flex; align-items:center; gap:6px; font-size:.85rem; }
.search-filters label[hidden] { display:none; }
.search-filters select { max-width:100%; font-size:.85rem; padding:4px 6px; }
@media (max-width:600px){ .search-filters label { flex:1 1 100%; justify-content:space-between; } .search-filters select{ flex:1 1 auto; } }

.cmp-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.cmp-col { min-width:0; }
.cmp-col h2 { font-size:1rem; margin:4px 0; }
.perf-cell { font-size:.78rem; line-height:1.5; display:block; }
.perf-table td { vertical-align:top; }
@media (max-width:700px){ .cmp-grid { grid-template-columns:1fr; } }

/* horse picker (autocomplete) */
.hp-wrap{position:relative}
.hp-list{position:absolute;inset-inline:0;top:100%;z-index:50;background:#fff;border:1px solid #d9cfb8;border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.12);max-height:min(60vh,360px);overflow-y:auto;margin-top:4px;text-align:start}
.hp-list[hidden]{display:none}
.hp-item{display:block;width:100%;text-align:start;background:none;border:0;border-bottom:1px solid #f0ebe0;padding:9px 12px;font:inherit;font-size:14px;cursor:pointer;color:inherit}
.hp-item:hover,.hp-item:focus{background:#faf6ec}
.hp-item [dir=ltr]{font-weight:600}
.hp-ar{color:#6b5b3e;font-size:13px}
.hp-m{display:block;font-size:12px;color:#8a7f6a}
.hp-empty{padding:10px 12px;color:#8a7f6a;font-size:13px}
.mate-form,.mate-form.card,.reg-form,form.card{overflow:visible}

/* Mobile/tablet: horizontal one-row nav (no hamburger, no vertical list); scrolls sideways if needed */
@media (max-width: 1039.98px) {
  .nav-toggle { display: none !important; }
  .header-inner { padding: 6px 12px 0; gap: 8px; min-height: 0; }
  .site-nav, .site-nav.open, .site-nav.is-desktop { display: block; width: 100%; order: 10; }
  .site-nav ul {
    flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 2px;
    padding: 2px 0 6px; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .site-nav ul::-webkit-scrollbar { display: none; }
  .site-nav li { flex: 0 0 auto; }
  .site-nav a { min-height: 36px; padding: 0 10px; font-size: .85rem; white-space: nowrap; border-radius: 999px; }
  .site-nav a[aria-current="page"] { background: rgba(201,162,84,.22); }
  .brand img { width: 34px; height: 34px; }
}
@media (max-width: 1039.98px) {
  .site-nav ul { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 26px); mask-image: linear-gradient(to right, transparent 0, #000 26px); padding-inline: 10px; }
}

/* Competitions accordion */
#comp-acc details > summary { list-style: none; cursor: pointer; }
#comp-acc details > summary::-webkit-details-marker { display: none; }
.acc { border: 1px solid #e3d9c4; border-radius: 12px; background: #fff; margin: 0 0 10px; overflow: hidden; }
.acc > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; font-weight: 700; }
.acc > summary::after, .comp > summary::after { content: "▾"; font-size: 14px; color: #a88a4e; transition: transform .2s; margin-inline-start: 6px; flex: 0 0 auto; }
.acc[open] > summary::after, .comp[open] > summary::after { transform: rotate(180deg); }
.acc-t { flex: 1 1 auto; }
.acc-c { font-size: 12px; font-weight: 400; color: #8a7f6a; white-space: nowrap; }
.acc-body { padding: 0 12px 12px; border-top: 1px solid #f0ebe0; }
.acc-body h3 { font-size: 15px; margin: 12px 0 6px; }
.comp { border: 1px solid #eee6d6; border-radius: 10px; margin: 0 0 6px; background: #fdfbf6; }
.comp > summary { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 13.5px; }
.comp-d { font-variant-numeric: tabular-nums; color: #6b5b3e; white-space: nowrap; font-size: 12.5px; }
.comp-n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-k { font-size: 11px; background: #efe6d2; border-radius: 999px; padding: 1px 7px; color: #6b5b3e; }
.comp-body { padding: 4px 10px 10px; }
.comp-body h4 { font-size: 13px; margin: 8px 0 4px; }
.comp-req { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; font-size: 13px; margin: 0; }
.comp-req dt { color: #8a7f6a; } .comp-req dd { margin: 0; }
.comp-top { margin: 14px 0 16px; text-align: start; }
.comp-top .acc, .comp-top .comp { scroll-margin-top: calc(var(--header-h, 64px) + 56px); }
.comp-top > #comp-acc > p.tiny { color: rgba(247,240,228,.75); }
.acc > summary .acc-t { color: #2a1a10; }
.acc-body, .comp-body { color: #2a1a10; }
.nb-list { list-style: none; margin: 0; padding: 0; }
.nb-list li { padding: 7px 2px; border-bottom: 1px solid #f0ebe0; font-size: 14px; }
.nb-b { display: inline-block; font-size: 11px; border-radius: 999px; padding: 1px 8px; margin-inline-end: 4px; vertical-align: 1px; }
.nb-champ { background: #f3e2b3; color: #6b4a10; }
.nb-prod { background: #e6efe3; color: #2f5a2a; }
.comp-past { margin-top: 10px; }
/* Official stud logos */
.stud-logo { display: inline-block; vertical-align: middle; object-fit: contain; background: #fffdf8; border-radius: 4px; padding: 1px 2px; margin-inline: 0 5px; }
.stud-logo-xs { height: 11px; max-width: 30px; padding: 0 1px; margin-inline-end: 3px; }
.stud-logo-sm { height: 18px; max-width: 54px; }
.stud-logo-md { height: 30px; max-width: 96px; margin-inline-end: 8px; }
.stud-logo-hero { display: inline-block; background: #fffdf8; border-radius: 12px; padding: 8px 14px; margin-bottom: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.stud-logo-hero img { height: 56px; max-width: 200px; object-fit: contain; display: block; }
.stud-logo.stud-logo-dark, .stud-logo-hero.stud-logo-dark { background: #3b2a1e; }
/* Category badges */
.cat-badge { display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.12)); }
.pp .cat-badge { vertical-align: -1px; margin-inline-end: 1px; filter: none; }
h2 .cat-badge, .acc-t .cat-badge { margin-inline-end: 6px; vertical-align: -0.25em; }

/* ===== Polish pass (v11b): consistent spacing, refined surfaces ===== */
:root { --r-lg: 16px; --r-md: 12px; --sh-soft: 0 1px 2px rgba(26,15,10,.05), 0 6px 18px rgba(26,15,10,.06); --sh-lift: 0 2px 4px rgba(26,15,10,.06), 0 12px 28px rgba(26,15,10,.10); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.section { margin-block: 28px; }
.section h2 { letter-spacing: 0; line-height: 1.3; }
.section .sub { margin-top: 4px; line-height: 1.7; }
.horse-card, .person-card, .card, .search-card { border-radius: var(--r-lg); box-shadow: var(--sh-soft); transition: box-shadow .2s, transform .2s; }
.horse-card:hover, .person-card:hover { box-shadow: var(--sh-lift); transform: translateY(-1px); }
.horse-card h3, .person-card h3 { line-height: 1.35; }
.gateway-card { border-radius: var(--r-lg); box-shadow: var(--sh-soft); }
/* section sub-navigation: one tidy row */
.section-subnav ul { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.section-subnav ul::-webkit-scrollbar { display: none; }
.section-subnav li { flex: 0 0 auto; }
.section-subnav a { white-space: nowrap; border-radius: 999px; font-size: .88rem; min-height: 34px; display: inline-flex; align-items: center; padding: 0 12px; }
/* accordion surfaces */
.acc { border: 1px solid rgba(201,162,84,.35); border-radius: var(--r-lg); background: linear-gradient(180deg,#fffdf8,#fbf6ea); box-shadow: var(--sh-soft); }
.acc[open] { box-shadow: var(--sh-lift); }
.acc > summary { padding: 13px 14px; min-height: 52px; }
.acc > summary:focus-visible, .comp > summary:focus-visible { outline: 2px solid #c9a254; outline-offset: 2px; border-radius: var(--r-md); }
.acc-body { background: #fffdf8; }
.comp { border-radius: var(--r-md); background: #fff; border-color: #efe6d4; }
.comp[open] { border-color: #e0cf9f; }
.nb-list li { display: block; line-height: 1.6; }
.nb-list li:last-child { border-bottom: 0; }
/* tables */
.rel-table { border-radius: var(--r-md); overflow: hidden; }
@media (max-width: 640px) {
  .section { margin-block: 22px; }
  .horse-hero { padding-bottom: 18px; }
  .wrap { padding-inline: 14px; }
  .section h2 { font-size: 1.35rem; }
}
.horse-hero .wrap, .person-hero .wrap { padding-bottom: 8px; }
.acc-body .muted, .acc-body .tiny.muted, .comp-body .muted { color: #7a6c55 !important; } .acc-body a { color: #7a4f12; }
.comp-group { background: #faf5e8; border-color: #e6d7b0; margin: 10px 0 8px; }
.comp-group > summary { font-weight: 700; font-size: 14px; padding: 10px 12px; }
.comp-group > .comp-body { padding-top: 2px; }
.nb-br { background: #e8e2f3; color: #4a3a73; min-width: 22px; text-align: center; }
/* v11d brand: Scheherazade New (OFL, fonts/OFL-ScheherazadeNew.txt) */
@font-face { font-family: "AsayelBrand"; src: url("../fonts/scheherazade-brand.woff2") format("woff2"); font-weight: 700; font-display: swap; }
.brand img { width: 44px; height: 44px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(214,173,98,.55); object-fit: cover; }
.brand-text strong { font-family: "AsayelBrand", var(--serif); font-weight: 700; font-size: 1.55rem; line-height: 1.45; letter-spacing: 0; margin: -8px 0 1px; padding-top: 4px; background: linear-gradient(180deg,#f0d38f,#c29445 65%,#a57a32); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 2px; }
.brand-text span { font-size: .72rem; color: #d6ad62; letter-spacing: .02em; }
.hero-logo { display: block; width: 132px; height: 132px; border-radius: 22px; margin: 0 auto 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(214,173,98,.6); }
@media (max-width: 1039.98px) { .brand img { width: 38px; height: 38px; } .brand-text strong { font-size: 1.35rem; } .hero-logo { width: 104px; height: 104px; border-radius: 18px; } }
/* v11d unified search: results only while typing, grouped by type */
.search-card .tabs, .search-card #search-filters, .search-card #search-hint { display: none !important; }
.search-card .results:empty { display: none; }
.sr-group { margin: 10px 0 4px; }
.sr-group + .sr-group { border-top: 1px solid rgba(168,121,42,.18); padding-top: 10px; }
.sr-h { font-size: .82rem; font-weight: 700; color: #7a5a22; margin: 0 2px 6px; display: flex; align-items: center; gap: 6px; letter-spacing: .01em; }
.sr-n { background: #f1e6cf; color: #6b4d1a; border-radius: 999px; padding: 0 8px; font-size: .72rem; line-height: 1.6; }
.sr-more { margin: 6px 0 2px; width: 100%; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plain-list li { padding: 8px 12px; background: #fffaf0; border: 1px solid rgba(168,121,42,.18); border-radius: 10px; }
/* v11d tidy pass */
.hero-logo { margin-inline: 0 auto; }
.comp-top > div > p.tiny.muted, #comp-acc > p.tiny { display: none; }
.wrap.page > .section { padding-top: 22px; padding-bottom: 22px; margin: 0; }
@media (min-width: 1040px) { .wrap.page > .section { padding-top: 34px; padding-bottom: 34px; } }
.person-hero .facts { gap: 8px 18px; }
.person-hero .en-name { margin-top: 2px; opacity: .8; letter-spacing: .04em; }
.section h2 { margin-bottom: 12px; }
.cards { gap: 12px; }
.horse-card .body h3 { font-size: 1.02rem; line-height: 1.4; }
.horse-card .body p { font-size: .82rem; }
.horse-hero .facts, .person-hero .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 0; list-style: none; }
.horse-hero .facts li, .person-hero .facts li { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.horse-hero .facts li strong, .person-hero .facts li strong { font-size: .72rem; opacity: .75; font-weight: 600; }
@media (min-width: 1040px) { .horse-hero .facts, .person-hero .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.horse-hero + .wrap.page > .section:first-child, .person-hero + .wrap.page > .section:first-child { padding-top: 18px; }
.horse-hero .facts li, .person-hero .facts li { display: block; }
.horse-hero .facts li strong, .person-hero .facts li strong { display: block; margin-bottom: 2px; }
.horse-hero .facts li .badge-se, .horse-hero .facts li .badge-open { display: inline-block; width: auto; }
.horse-hero .facts li > a, .horse-hero .facts li > span { display: inline !important; }
.horse-hero .facts li { display: block !important; }

/* v11e sire season stats */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid rgba(214,173,98,.35); }
.stat-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
.stat-table th, .stat-table td { padding: 8px 10px; text-align: center; border-bottom: 1px solid rgba(0,0,0,.06); white-space: nowrap; }
.stat-table thead th { background: #5a1a2a; color: #f0d38f; font-weight: 700; }
.stat-table tbody tr:nth-child(even) td { background: rgba(214,173,98,.08); }

/* v11h restored emoji category markers */
.cat-emoji { display: inline; font-style: normal; line-height: 1; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }

/* v11h home redesign: dark green cards, grey Arabian on black hero, gold headline */
body.home-v2 { background: #0b1f19; }
body.home-v2 #main { background: radial-gradient(ellipse at top, #12332a 0%, #0b1f19 60%); }
.home2 { padding: 18px 14px 8px; }
.home2-wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 16px; }
.h2-hero { position: relative; border-radius: 22px; overflow: hidden; background: #000; border: 1px solid rgba(214,173,98,.45); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.h2-photo { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }
.h2-copy { position: absolute; inset: 0 auto 0 0; width: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px 28px;
  background: linear-gradient(90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.55) 70%, rgba(0,0,0,0) 100%); }
.h2-logo { width: 72px; height: 72px; border-radius: 16px; box-shadow: 0 0 0 1px rgba(214,173,98,.7), 0 8px 22px rgba(0,0,0,.5); margin-bottom: 14px; }
.h2-title { font-family: "AsayelBrand", var(--serif); font-weight: 700; font-size: clamp(1.9rem, 4.2vw, 3.3rem); line-height: 1.5; margin: 0 0 8px;
  background: linear-gradient(180deg,#f6dc9b,#d3a654 60%,#a97b33); -webkit-background-clip: text; background-clip: text; color: transparent; padding-top: 6px; }
.h2-sub { color: #e9e2cf; font-size: 1.02rem; line-height: 1.8; margin: 0; max-width: 30em; }
.h2-search.search-card { background: #11302a; border: 1px solid rgba(214,173,98,.4); border-radius: 20px; padding: 14px; box-shadow: 0 10px 26px rgba(0,0,0,.35); margin: 0; }
.h2-search .search-box { background: #fff; border-radius: 999px; border: 1px solid rgba(214,173,98,.6); padding: 4px 18px; }
.h2-search .search-box input { background: transparent; color: #1f1a14; font-size: 1.05rem; height: 48px; border: 0; }
.h2-search .search-box input::placeholder { color: #8a8170; }
.h2-search .results:not(:empty) { background: #fffdf7; border-radius: 16px; margin-top: 10px; padding: 8px; }
.h2-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.h2-tile { display: flex; flex-direction: column; gap: 6px; padding: 20px 18px; border-radius: 20px; text-decoration: none; text-align: center; align-items: center;
  background: linear-gradient(160deg, #164036 0%, #0f2c25 100%); border: 1px solid rgba(214,173,98,.5); box-shadow: 0 10px 24px rgba(0,0,0,.35); transition: transform .15s ease, box-shadow .15s ease; }
.h2-tile:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,0,0,.45); }
.h2-tile strong { font-family: "AsayelBrand", var(--serif); font-size: 1.45rem; line-height: 1.5; color: #f0d38f; }
.h2-tile-k { font-size: .76rem; color: #b9c9bf; letter-spacing: .02em; }
.h2-tile-s { font-size: .9rem; color: #dfe7e1; line-height: 1.7; }
body.home-v2 .wrap.page { background: transparent; }
body.home-v2 .intro-grid h2 { color: #f0d38f; }
body.home-v2 .intro-grid .callout { background: #11302a; color: #e9e2cf; border-color: rgba(214,173,98,.4); }
body.home-v2 .intro-grid .callout strong { color: #f0d38f; }
body.home-v2 .intro-grid .card { background: #11302a; border-color: rgba(214,173,98,.4); }
body.home-v2 .intro-grid .caption { color: #b9c9bf; }
@media (max-width: 700px) {
  .home2 { padding: 12px 10px 4px; }
  .h2-photo { aspect-ratio: 4/3; }
  .h2-copy { position: static; width: auto; background: linear-gradient(180deg,#000 0%, #0d241e 100%); padding: 18px 16px 20px; }
  .h2-logo { width: 60px; height: 60px; margin-top: -48px; position: relative; }
  .h2-title { font-size: 1.95rem; }
  .h2-sub { font-size: .95rem; }
  .h2-tiles { gap: 10px; }
  .h2-tile { padding: 16px 10px; }
  .h2-tile strong { font-size: 1.12rem; }
  .h2-tile-s { font-size: .8rem; }
}
@media (min-width: 701px) { .h2-photo { aspect-ratio: auto; height: 400px; object-position: 70% 30%; } .h2-copy { width: 52%; } }
.h2-hero picture { display: block; width: 100%; }
@media (max-width: 700px) { .h2-search .search-box { padding: 2px 14px; } .h2-search .search-box input { font-size: .92rem; } }
@media (max-width: 700px) { .h2-photo { -webkit-mask-image: linear-gradient(180deg,#000 70%,transparent 100%); mask-image: linear-gradient(180deg,#000 70%,transparent 100%); } }

/* ================= v11i unified theme: dark green + gold, rounded cream content cards ================= */
:root {
  --g-0: #081a15; --g-1: #0b1f19; --g-2: #11302a; --g-3: #164036; --g-4: #1d5244;
  --ink: #081a15; --brown: #11302a; --brown-2: #164036; --brown-3: #1d5244;
  --gold: #D3A654; --gold-deep: #8f6a24; --gold-soft: #F0D38F;
  --line: rgba(211,166,84,.45);
  --paper: #FBF7F0; --card: #fffdf7; --sand: #f3ecdc; --cream: #F7F0E4;
  --shadow: 0 10px 26px rgba(0,0,0,.32);
}
body { background: radial-gradient(ellipse at top, #12332a 0%, #0b1f19 55%) fixed, #0b1f19; color: var(--text); }
a { color: #1d5244; }
a:hover { color: var(--gold-deep); }

/* header */
.site-header { background: rgba(8,26,21,.92); border-bottom: 1px solid rgba(211,166,84,.5); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.header-inner { max-width: 1120px; padding: 8px 14px 6px; gap: 8px 12px; }
.brand img { box-shadow: 0 0 0 1px rgba(211,166,84,.7); }
.visit-counter { background: transparent; border-color: rgba(211,166,84,.3); color: rgba(240,211,143,.75); font-size: 10.5px; }
.site-nav a { color: #e9e2cf; border: 1px solid transparent; border-radius: 999px; }
.site-nav a:hover { background: rgba(211,166,84,.12); color: var(--gold-soft); }
.site-nav a[aria-current="page"] { background: rgba(211,166,84,.16); color: var(--gold-soft); border-color: rgba(211,166,84,.55); }
@media (min-width: 1040px) {
  .site-nav ul { gap: 4px; }
  .site-nav a { min-height: 34px; padding: 0 12px; font-size: .88rem; }
}

/* page heroes (section pages, horse, person, encyclopedia, generic) */
.hero, .page-hero, .horse-hero, .person-hero, .section-hero {
  background: linear-gradient(160deg, #164036 0%, #0b1f19 100%) !important; color: var(--cream);
}
.horse-hero, .person-hero, .page-hero, .section-hero { margin: 14px auto 0; max-width: 1120px; width: calc(100% - 24px); border-radius: 22px; border: 1px solid rgba(211,166,84,.5); box-shadow: var(--shadow); overflow: hidden; }
.hero::before, .hero::after { opacity: .85; }
.horse-hero h1, .person-hero h1, .page-hero h1, .hero h1 { color: var(--gold-soft); }
.kicker, .eyebrow { color: #cfdcd4; }
.horse-hero .facts li, .person-hero .facts li { color: #f2ecdd; }
.horse-hero .facts li strong, .person-hero .facts li strong { color: var(--gold); }
.horse-hero a, .person-hero a { color: var(--gold-soft); }
.en-name { color: #d7e2db; }

/* content: every section is a cream rounded card with a gold border on the green page */
.wrap.page { max-width: 1120px; }
.wrap.page > .section, .wrap > .section, main > .section {
  background: var(--card); border: 1px solid rgba(211,166,84,.55); border-radius: 20px; box-shadow: var(--shadow);
  padding: 18px 16px; margin: 0 0 16px;
}
.section h2, .section h1 { color: #11302a; }
.section h2::after { background: var(--gold) !important; }
.section .sub, .muted { color: #5d6b63; }
.callout { background: #f7f1e3; border-color: rgba(211,166,84,.55); }

/* buttons / chips / tabs */
.btn { border-radius: 999px; }
.btn-gold { background: linear-gradient(180deg,#f0d38f,#d3a654); color: #081a15; border-color: #b88a3c; }
.btn-ghost { color: var(--gold-soft); border-color: rgba(211,166,84,.6); }
.btn-light { background: #fffdf7; color: #11302a; border-color: rgba(211,166,84,.6); }
.chip[aria-pressed="true"], .tab-btn[aria-selected="true"], .ped-gens button[aria-pressed="true"], .enc-letters button[aria-pressed="true"] { background: #11302a; color: var(--gold-soft); border-color: var(--gold); }
.rel-count { background: #11302a; color: var(--gold-soft); }

/* tables */
.rel-table th, .ped-table th, table.cal th, .stat-table thead th { background: #11302a !important; color: var(--gold-soft) !important; }
.rel-table-wrap, .table-wrap, .table-scroll { border-color: rgba(211,166,84,.5); }
.ped-subject { background: #11302a; border-color: var(--gold); }

/* search cards on section pages */
.search-card { background: #11302a; border: 1px solid rgba(211,166,84,.45); border-radius: 20px; box-shadow: var(--shadow); }
.search-card .search-box { background: #fff; border-radius: 999px; border-color: rgba(211,166,84,.6); }
.search-card .results:not(:empty) { background: #fffdf7; border-radius: 16px; margin-top: 10px; padding: 8px; }
.search-card .sr-h { color: #11302a; }

/* accordions (competition categories) */
.acc { border-color: rgba(211,166,84,.5); border-radius: 16px; }
.acc > summary { background: linear-gradient(180deg,#164036,#11302a); color: var(--gold-soft); }
.acc > summary .acc-c, .acc > summary .muted { color: #cfdcd4 !important; }
.acc[open] > summary { border-bottom: 1px solid rgba(211,166,84,.5); }

/* footer */
.site-footer { background: #081a15; border-top: 1px solid rgba(211,166,84,.5); color: #d9e2dc; }
.site-footer a { color: var(--gold-soft); }
.site-footer h2, .site-footer h3, .site-footer strong { color: var(--gold-soft); }

/* home keeps its own hero */
body.home-v2 .wrap.page > .section { background: transparent; border: 0; box-shadow: none; padding: 0; }

.acc > summary, .acc > summary .acc-t, .acc > summary span { color: var(--gold-soft); }
.acc > summary .acc-c { color: #cfdcd4 !important; }
.acc > summary::after, .acc > summary .acc-arrow { color: var(--gold) !important; border-color: var(--gold) !important; }
.search-card .search-box input { background: transparent; color: #1f1a14; }
.search-card .search-box input::placeholder { color: #8a8170; }
.hero { min-height: 0 !important; } .hero .hero-inner { padding-top: 22px; }
/* v11j: home tiles + headline use a full Arabic font (brand font is a 'أصايل'-only subset -> broken joining on phones) */
.h2-title { font-family: "Amiri", "Noto Naskh Arabic", serif !important; font-weight: 700; }
.h2-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
.h2-tile { display: flex !important; flex-direction: column; justify-content: flex-start; align-items: center; gap: 10px; padding: 22px 16px 20px !important; text-align: center;
  background: linear-gradient(160deg,#1b4a3d,#0f2c24) !important; border: 1.5px solid rgba(240,211,143,.7) !important; }
.h2-tile > * { display: block; width: 100%; margin: 0; white-space: normal; word-break: normal; overflow-wrap: anywhere; }
.h2-tile-k { order: 1; font-family: "Tajawal", sans-serif; font-size: .78rem !important; font-weight: 700; color: #0b1f19 !important; background: #e6c27a; border-radius: 999px; padding: 3px 12px; width: auto !important; align-self: center; line-height: 1.6; }
.h2-tile strong { order: 2; font-family: "Amiri", "Noto Naskh Arabic", serif !important; font-weight: 700; font-size: 1.7rem !important; line-height: 1.45 !important; color: #FBE3A6 !important; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.h2-tile-s { order: 3; font-family: "Tajawal", sans-serif; font-size: .95rem !important; line-height: 1.75 !important; color: #F3F6F2 !important; font-weight: 500; }
@media (max-width: 600px) {
  .h2-tiles { gap: 10px; }
  .h2-tile { padding: 16px 10px 16px !important; gap: 8px; }
  .h2-tile strong { font-size: 1.32rem !important; }
  .h2-tile-s { font-size: .84rem !important; line-height: 1.7 !important; }
}
@media (max-width: 350px) { .h2-tiles { grid-template-columns: 1fr; } }
/* v11j: foal registration (one short form) */
.reg-page { max-width: 620px; margin: 0 auto 18px; background: linear-gradient(165deg,#173f34,#0e2a22) !important; border: 1.5px solid rgba(211,166,84,.6) !important; border-radius: 22px !important; padding: 20px 18px !important; color: #eef3ef; }
.reg-foal { display: flex; flex-direction: column; gap: 12px; }
.reg-foal .rf { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .98rem; color: #F0D38F; margin: 0; }
.reg-foal .rf .muted { color: #b9c9bf; font-weight: 500; }
.reg-foal .req { color: #ffb4a0; }
.reg-foal input[type=text], .reg-foal input:not([type]), .reg-foal input[name], .reg-foal select { width: 100%; min-height: 50px; padding: 10px 14px; font-size: 1.02rem; border-radius: 14px; border: 1.5px solid rgba(211,166,84,.55); background: #fffdf7; color: #1d1a14; box-sizing: border-box; }
.reg-foal input[type=radio] { width: auto; min-height: 0; accent-color: #D3A654; }
.reg-foal input:focus, .reg-foal select:focus { outline: 3px solid rgba(240,211,143,.55); outline-offset: 1px; }
.rf-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: end; }
.reg-foal fieldset.rf-sex { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.reg-foal fieldset.rf-sex legend { color: #F0D38F; font-weight: 700; font-size: .98rem; padding: 0; margin-bottom: 6px; width: 100%; }
.pill-opt { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; border-radius: 14px; border: 1.5px solid rgba(211,166,84,.55); background: rgba(255,255,255,.06); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; font-size: .92rem; }
.pill-opt:has(input:checked) { background: #D3A654; color: #0b1f19; border-color: #F0D38F; }
.reg-foal .reg-pick { margin: -6px 0 0; color: #cfdcd4; }
.reg-foal .reg-pick.ok { color: #9be3a8; } .reg-foal .reg-pick.new { color: #F0D38F; } .reg-foal .reg-pick.bad { color: #ffb4a0; }
.reg-foal .reg-pick a { color: #F0D38F; }
.reg-line { margin: 0; color: #eef3ef; font-size: .92rem; min-height: 0; }
.rf-more { border: 1px dashed rgba(211,166,84,.5); border-radius: 14px; padding: 10px 12px; }
.rf-more summary { cursor: pointer; color: #F0D38F; font-weight: 700; }
.rf-more[open] { display: flex; flex-direction: column; gap: 10px; }
.reg-submit { min-height: 56px; font-size: 1.12rem !important; font-weight: 800; border-radius: 16px !important; width: 100%; }
.reg-foot { text-align: center; color: #b9c9bf !important; margin: 0; }
.reg-page .inq-ok { color: #eef3ef; }
.h2-reg { display: flex; justify-content: center; margin: 12px 0 0; }
.h2-reg a { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; background: #D3A654; color: #0b1f19; font-weight: 800; text-decoration: none; box-shadow: 0 8px 20px rgba(0,0,0,.35); }
@media (max-width: 380px) { .rf-row { grid-template-columns: 1fr; } }
.reg-foal .rf { display: block !important; }
.reg-foal .rf > span, .reg-foal legend > span { display: inline !important; margin: 0 4px 0 0; }
.reg-foal .rf > input, .reg-foal .rf > select { display: block; margin-top: 6px; }
.reg-foal .pill-opt { flex-direction: row !important; color: #fff !important; opacity: 1 !important; }
.reg-foal .pill-opt input { margin: 0 !important; display: inline-block !important; }
.reg-foal .pill-opt:has(input:checked) { color: #0b1f19 !important; }
.reg-foal .rf-sex { display: flex !important; flex-wrap: wrap; }
.reg-foal .rf-sex .pill-opt { min-height: 50px; }
.rf-row { align-items: start; }
.reg-foal .pill-opt input[type=radio] { width: 18px !important; height: 18px; min-height: 0 !important; padding: 0 !important; border: 0 !important; flex: 0 0 auto; }
.reg-foal .rf-sex .pill-opt { flex: 1 1 40%; }
@media (max-width: 600px) { .rf-row { grid-template-columns: 1fr; } }
.reg-foal label.pill-opt { display: flex !important; flex-direction: row !important; justify-content: center; align-items: center; gap: 8px; }
.reg-foal .rf-sex { flex-direction: row !important; flex-wrap: nowrap !important; }
/* v11j: text placed directly on the dark page background (calendar, news, history, terms, 404) */
.wrap.page > h1, .wrap.page > .eyebrow + h1 { color: #F0D38F !important; font-family: "Amiri", var(--serif) !important; }
.wrap.page > .sub, .wrap.page > p:not(.reg-note), .wrap.page > .eyebrow { color: #dfe7e1 !important; }
.wrap.page > .sub a, .wrap.page > p a { color: #F0D38F !important; text-decoration-color: rgba(240,211,143,.5); }
.wrap.page > h2, .wrap.page > section:not(.section) > h2, .wrap.page > .cal-block > h2 { color: #F0D38F !important; }
.wrap.page > .cal-filters label, .cal-filters label { color: #F0D38F !important; font-weight: 700; }
.contact-page .muted, .inq-page .muted, .inq-page p.tiny { color: #6b5a48; }
details.comp:not(.comp-group) { color: #2a2118; }
details.comp:not(.comp-group) .comp-body, details.comp:not(.comp-group) .comp-body p, details.comp:not(.comp-group) .tiny, details.comp:not(.comp-group) .muted { color: #5a4a3a !important; }
details.comp:not(.comp-group) > summary, details.comp:not(.comp-group) > summary * { color: #1f3d33; }
.badge-verified, .vbadge, span.verified { color: #6b4e14 !important; }
.ped-empty, .pc-empty, td .dash { color: #8a7a62 !important; }
@media (max-width: 600px) {
  table.cal, table.cal tbody, table.cal tr, table.cal td { display: block; width: 100%; box-sizing: border-box; }
  table.cal thead { display: none; }
  table.cal tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.cal td { border: 0 !important; padding: 2px 0 !important; text-align: right; }
  table.cal td:first-child { font-weight: 700; color: #8f6a24; font-size: .88rem; }
}
.race-item.is-medal { border-color: rgba(211,166,84,.75); background: #fffaf0; }
