/* BreedPair — "breeder's stud book": ruled ledger paper, ink, one pedigree card. */
:root {
  --paper: #f4efe4;
  --card: #fffcf5;
  --ink: #23201b;
  --muted: #655e55;
  --moss: #2f6a4f;
  --moss-dark: #22513c;
  --yolk: #e3a13a;
  --rule: #e2d9c7;
  --rule-strong: #cbbfa8;
  --moss-wash: #e6efe8;
  --yolk-wash: #fbeed5;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.06);
  --shadow-2: 0 8px 24px rgba(0,0,0,.08);
  --head: "Bitter", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.6 var(--body); font-feature-settings: "tnum" 1;
}
img { max-width: 100%; height: auto; }
a { color: var(--moss); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--moss-dark); }
:focus-visible { outline: 3px solid var(--yolk); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.2; font-weight: 700; margin: 0 0 12px; }
h1 { font-size: 36px; letter-spacing: -.01em; }
h2 { font-size: 28px; }
h3 { font-size: 18px; }
p { margin: 0 0 16px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: var(--radius); z-index: 10; }
.skip:focus { left: 8px; }

/* Masthead */
.masthead { background: var(--card); border-bottom: 1px solid var(--rule); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { color: var(--moss); }
.brand-name { font-family: var(--head); font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--paper); }
.nav a[aria-current="page"] { color: var(--moss-dark); background: var(--moss-wash); }

/* Page head: title pressed into one line above the tool */
.pagehead { padding: 32px 0 16px; }
.pagehead h1 { margin-bottom: 8px; }
.pagehead .lede { color: var(--muted); max-width: 70ch; margin: 0; font-size: 18px; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.crumbs a { color: var(--muted); }

/* Workbench = the tool surface */
.bench { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 24px; }
.section { padding: 48px 0; }
.section + .section { border-top: 1px solid var(--rule); }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 32px; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; }
.prose code { background: var(--yolk-wash); padding: 2px 6px; border-radius: 6px; }

/* Unequal two-column block */
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.aside-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; }
.aside-card h3 { margin-bottom: 8px; }
.formula { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--paper); border: 1px dashed var(--rule-strong); border-radius: var(--radius); padding: 12px 16px; font-size: 14px; overflow-x: auto; }

/* Numbered steps */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; max-width: 760px; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 4px 56px; min-height: 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--moss); color: var(--moss); font: 700 18px/36px var(--head); text-align: center; }
.steps strong { display: block; }

/* Related tools as ledger rows */
.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.ledger li { border-bottom: 1px solid var(--rule); }
.ledger a { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 16px 4px; text-decoration: none; color: var(--ink); }
.ledger a:hover { background: var(--card); }
.ledger b { font-family: var(--head); font-size: 18px; }
.ledger span { color: var(--muted); }
.ledger i { font-style: normal; color: var(--moss); font-weight: 700; align-self: center; }

/* FAQ fold */
.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 40px 16px 0; font-weight: 600; font-size: 18px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 8px; top: 12px; font: 400 28px/1 var(--body); color: var(--moss); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 0 16px; color: var(--ink); }
.faq details > div p:last-child { margin: 0; }

/* Tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.data thead th { position: sticky; top: 0; background: var(--card); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 2px solid var(--rule-strong); }
table.data tbody tr:hover { background: var(--paper); }
table.data td.num, table.data th.num { text-align: right; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--yolk-wash); color: #7a4f0e; }
.tag.moss { background: var(--moss-wash); color: var(--moss-dark); }

/* Buttons & inputs (shared with tools) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1.5px solid var(--moss); background: var(--moss); color: #fff; font: 600 16px/1 var(--body); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--moss-dark); border-color: var(--moss-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--moss); }
.btn.ghost:hover { background: var(--moss-wash); color: var(--moss-dark); }

/* Footer */
.foot { margin-top: 64px; background: var(--card); border-top: 1px solid var(--rule); padding: 0 0 32px; font-size: 14px; }
.dataline { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 32px; padding: 12px 0; border-bottom: 3px double var(--rule-strong); color: var(--muted); }
.dataline strong { color: var(--ink); }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; margin-bottom: 24px; }
.foot-brand { font-family: var(--head); font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.foot-links { display: flex; flex-direction: column; gap: 8px; }
.foot-links a { color: var(--ink); text-decoration: none; }
.foot-links a:hover { color: var(--moss); text-decoration: underline; }

/* Combos page */
.az { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 24px; }
.az a { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); text-decoration: none; font-weight: 600; }
.az a:hover { border-color: var(--moss); }
.letter { font-family: var(--head); font-size: 28px; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 3px double var(--rule-strong); }
.combo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.combo { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; scroll-margin-top: 16px; }
.combo h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.combo h3 small { font: 600 12px var(--body); color: var(--muted); white-space: nowrap; }
.combo ul { list-style: none; margin: 0 0 8px; padding: 0; font-size: 14px; }
.combo li { padding: 4px 0; border-bottom: 1px dashed var(--rule); }
.combo li:last-child { border-bottom: 0; }
.combo .more { font-size: 14px; font-weight: 600; }

/* Legal / plain pages */
.plain { padding: 32px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Pal portrait sprite icons (18x17 grid, 299 Pals) */
.pal-ico {
  display: inline-block; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  background-image: url("/_a/pals-sprite.2d33df1dd1.webp");
  background-size: 1800% 1700%; background-repeat: no-repeat;
  background-color: var(--paper); border: 1.5px solid var(--rule-strong);
  vertical-align: middle;
}
.pal-ico.xs { width: 20px; height: 20px; border-width: 1px; }
.pal-ico.sm { width: 26px; height: 26px; border-width: 1px; }
.pal-ico.md { width: 44px; height: 44px; }
.pal-ico.lg { width: 56px; height: 56px; border-width: 2px; border-color: var(--moss); background-color: var(--card); }
.pal-inline { display: inline-flex; align-items: center; gap: 7px; vertical-align: middle; }
.pedigree-node { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; }
.pedigree-child-main { display: flex; align-items: center; gap: 14px; }
.combo-head { display: flex; align-items: center; gap: 10px; }

/* Stat list in aside card */
.stat-list { margin: 0 0 12px; display: grid; gap: 10px; }
.stat-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--rule); }
.stat-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.stat-list dt { color: var(--muted); font-size: 14px; }
.stat-list dd { margin: 0; font-family: var(--head); font-weight: 700; font-size: 18px; color: var(--ink); }

/* Shared form controls & filter bars */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.bp-input, .bp-select {
  height: 44px; padding: 8px 14px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font: 16px/1.3 var(--body);
}
.bp-input { flex: 1 1 260px; }
.bp-input:focus, .bp-select:focus { border-color: var(--moss); outline: 3px solid var(--yolk-wash); outline-offset: 0; }
.filter-count { font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tablewrap-tall { max-height: 580px; overflow-y: auto; }

/* Tool mode tabs */
.bp-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 20px; }
.bp-tab {
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font: 600 14px/1 var(--body); cursor: pointer;
}
.bp-tab:hover { color: var(--ink); }
.bp-tab[aria-selected="true"] { background: var(--card); color: var(--moss-dark); box-shadow: var(--shadow-1); }

/* Searchable Pal combobox */
.bp-picker-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; margin-bottom: 16px; }
.bp-field { position: relative; }
.bp-field label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.bp-field input { width: 100%; }
.bp-swap { min-width: 44px; height: 44px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font-size: 18px; cursor: pointer; }
.bp-swap:hover { border-color: var(--moss); color: var(--moss); background: var(--moss-wash); }
.bp-suggest {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30;
  background: var(--card); border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-2); max-height: 260px; overflow-y: auto; list-style: none; padding: 4px; margin-bottom: 0;
}
.bp-suggest[hidden] { display: none; }
.bp-suggest li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.bp-suggest li:hover, .bp-suggest li[aria-selected="true"] { background: var(--moss-wash); color: var(--moss-dark); }
.bp-suggest li small { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* Quick-pick chips */
.bp-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 20px; }
.bp-chips-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 4px; }
.bp-chip {
  min-height: 32px; padding: 4px 12px; border: 1px solid var(--rule-strong); border-radius: 999px;
  background: var(--paper); color: var(--ink); font: 600 13px/1.2 var(--body); cursor: pointer;
}
.bp-chip:hover { border-color: var(--moss); background: var(--moss-wash); color: var(--moss-dark); }
.bp-chip.active { border-color: var(--moss); background: var(--moss); color: #fff; }

/* Signature focal point: The Pedigree Certificate Card */
.pedigree-card {
  position: relative; background: var(--card); border: 3px double var(--rule-strong); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow-1);
}
.pedigree-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--rule); }
.pedigree-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pedigree-lineage { display: grid; grid-template-columns: 1fr 48px 1fr; align-items: center; gap: 12px; }
.pedigree-node-role { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pedigree-node-name { display: block; font-family: var(--head); font-weight: 700; font-size: 18px; color: var(--ink); margin-top: 2px; }
.pedigree-node-meta { display: block; font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; margin-top: 2px; }
.pedigree-times { text-align: center; font-family: var(--head); font-size: 22px; color: var(--moss); font-weight: 700; }
.pedigree-bracket { display: flex; justify-content: center; padding: 6px 0; color: var(--rule-strong); }
.pedigree-child {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--moss-wash); border: 1.5px solid var(--moss); border-radius: 10px; padding: 16px 20px;
}
.pedigree-child-name { font-family: var(--head); font-weight: 700; font-size: 28px; line-height: 1.15; color: var(--moss-dark); }
.pedigree-child-meta { font-size: 14px; color: var(--muted); margin-top: 4px; }
.pedigree-proof { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.pedigree-alert { margin-top: 12px; padding: 10px 14px; border-radius: 8px; background: var(--yolk-wash); color: #633d08; font-size: 14px; }

/* Reverse lookup list */
.rev-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.rev-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.rev-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; font-size: 14px;
}
.rev-row strong { color: var(--ink); }

/* Path planner */
.bp-owned-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 32px; }
.bp-owned-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--moss-wash); color: var(--moss-dark); font-size: 13px; font-weight: 600;
}
.bp-owned-tag button { border: 0; background: transparent; color: var(--moss-dark); font-weight: 700; cursor: pointer; padding: 0 2px; font-size: 16px; line-height: 1; }
.path-chain { display: grid; gap: 10px; margin-top: 16px; }
.path-step {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px;
}
.path-step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--moss); color: #fff; font: 700 14px/32px var(--head); text-align: center; }
.path-step-eq { font-size: 15px; }
.path-step-eq strong { color: var(--moss-dark); }
.path-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Passive odds bars */
.odds-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.odds-box { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 16px; }
.odds-big { font-family: var(--head); font-weight: 700; font-size: 32px; color: var(--moss-dark); line-height: 1.1; }
.odds-bar { height: 10px; background: var(--rule); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.odds-bar > i { display: block; height: 100%; background: var(--moss); border-radius: 999px; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; gap: 24px; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .masthead-row { flex-direction: column; align-items: stretch; gap: 0; min-height: 0; padding-top: 8px; }
  .brand { padding: 4px 0; }
  .nav { margin: 0 -16px; padding: 4px 12px 8px; gap: 2px; }
  .nav a { font-size: 13px; padding: 6px 9px; }
  .pagehead { padding: 16px 0 12px; }
  .pagehead .lede { font-size: 16px; }
  .bench { padding: 16px; border-radius: var(--radius); margin: 0 -4px; }
  .section { padding: 32px 0; }
  .combo-grid, .rev-list, .odds-grid { grid-template-columns: 1fr; }
  .bp-picker-grid { grid-template-columns: 1fr; }
  .bp-swap { width: 100%; }
  .pedigree-lineage { grid-template-columns: 1fr; gap: 6px; }
  .pedigree-times { font-size: 16px; }
  .pedigree-child-name { font-size: 22px; }
  .btn { width: 100%; }
  .foot-grid { grid-template-columns: 1fr; }
}
