/* Staibles — shared stylesheet
 *
 * One definition of the design system and every shared component. Written on
 * 12 September after browse.py and templates/preview.html had each carried their
 * own copy of nearly identical CSS.
 *
 * That duplication had already caused two failures. A class named `.empty` was
 * defined for a no-results paragraph (padding: 40px 0) and also applied to the
 * empty score bar, which inherited 80px of padding — three attempts at fixing it
 * by reasoning about flex and grid sizing were all wrong, and Web Inspector found
 * it in one look. Separately the homepage carried £95 for a figure the card showed
 * as £190, because a change was applied to one copy and not the other.
 *
 * The listing page would have been a third copy. Hence this file.
 *
 * Conventions:
 *   - Colours and type come from :root. Never hard-code a hex value.
 *   - Component classes are prefixed by what they are, not where they appear.
 *   - British English in comments and content.
 */

:root {
  --green: #06463A;
  --green-deep: #04342C;
  --green-soft: #0B5A49;
  --paper: #FAFAF7;
  --card: #FFFFFF;
  --ink: #1A2421;
  --muted: #5B6560;
  --gold: #BA7517;
  --gold-bright: #EF9F27;
  --gold-pale: #FAEEDA;
  --line: #E4E2DA;
  --ok: #0F6E56;
  --warn: #854F0B;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Archivo", system-ui, sans-serif;

  /* How far an in-page anchor stops short of the viewport top. Zero by
   * default, because only a page with a FIXED or STICKY masthead needs it —
   * on every other page the browser's own behaviour is already correct, and
   * a blanket offset would leave anchors mysteriously low. A page that needs
   * it sets this to its own masthead height plus breathing room; see
   * index.html, which is the only one today. */
  --anchor-offset: 0;
}

* { box-sizing: border-box; margin: 0; padding: 0 }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-soft) }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 18px }
.wrap-narrow { max-width: 880px; margin: 0 auto; padding: 0 22px }

/* ---------------------------------------------------------------- masthead */

header { background: var(--green); color: #EDF2EF; padding: 20px 0 }
.brand { font-family: var(--serif); font-size: 22px; letter-spacing: -.01em }
.brand em { color: var(--gold-bright); font-style: normal }
.tagline { font-size: 12.5px; color: #A9C1B8; margin-top: 2px }

/* A banner for anything not published. Loud on purpose: an internal page that
 * looks like a live one is how an uncontacted operator's listing gets deployed. */
.warn {
  background: var(--gold-pale);
  border-bottom: 1px solid var(--gold);
  color: var(--warn);
  font-size: 13px;
  padding: 9px 0;
}

/* --------------------------------------------------------- the silks device
 *
 * Diagonal stripes in the house green and gold. A brand device, not data:
 * registered colours are not held for every listing.
 *
 * Registered silks have been limited since the early 1970s to 18 colours and
 * simple geometric patterns — stripes, hoops, chevrons, quartered, spots. So the
 * brand device and the eventual real-silks system share a vocabulary, and
 * rendering a listing's actual colours later is a data problem, not a redesign.
 * The API returns them as structured parameters, not images:
 *   body=cross-of-lorraine:red,white&sleeves=solid:royalblue&cap=solid:royalblue
 */
.silk {
  height: 5px;
  background: repeating-linear-gradient(115deg,
    var(--green) 0 9px, var(--gold) 9px 18px);
}

/* -------------------------------------------------------------- the card */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-pad { padding: 14px 15px; display: flex; flex-direction: column; flex: 1 }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px }
.card-top h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.card-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; margin-top: 3px }

.heart {
  flex-shrink: 0; width: 31px; height: 31px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); cursor: pointer;
  font-size: 15px; color: var(--muted); font-family: var(--sans);
}
.heart.on { background: var(--gold-pale); border-color: var(--gold); color: var(--gold) }

/* ---------------------------------------------------------------- tags
 * Ownership type is always the first tag and always dark: a score must never be
 * visible without the kind of product that produced it. */

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 4px; background: #F1F0EA; color: var(--muted) }
.tag.type { background: var(--green); color: #fff; font-weight: 500 }

/* --------------------------------------------------------------- scores
 *
 * The pair is one control. Both boxes are always present and always the same
 * size, even when one is empty — a card shipped with a single score trains
 * everyone to treat that score as THE score, and the space is far harder to
 * reclaim later than to hold now.
 *
 * `.score-bar.dashed` is the empty state, and it is a dashed rule rather than a
 * filled track at 0%. A bar at zero asserts the score is nothing, which is
 * "unknown is never zero" broken through CSS rather than arithmetic.
 *
 * Note the class is `dashed`, not `empty`. See the file header.
 */

.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; align-items: start; flex: none }
.score-box {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 10px 13px; text-align: center;
  background: var(--paper); min-height: 106px; height: auto;
}
.score-box.live { border-color: var(--gold); background: var(--gold-pale) }
.score-n { font-family: var(--serif); font-size: 24px; line-height: 1; color: var(--green) }
.score-n small { font-size: 12.5px; color: var(--muted); font-family: var(--sans) }
.score-n.none { color: #B4B0A5 }
.score-l { font-size: 10.5px; color: var(--muted); margin-top: 4px; letter-spacing: .03em; text-transform: uppercase }
.score-s {
  font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.3;
  min-height: 2.6em; display: flex; align-items: center; justify-content: center;
}
.score-s.none { color: #8C877B; font-style: italic }
.score-bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden }
.score-bar i { display: block; height: 100%; background: var(--gold) }
.score-bar.dashed {
  background: transparent; border-top: 2px dashed #D6D2C6;
  height: 2px; border-radius: 0; margin-top: 6px;
}

/* --------------------------------------------------------------- band scale */

.bandscale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px }
.bandcell {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 6px; text-align: center; opacity: .55;
}
.bandcell.on { opacity: 1; border-color: var(--gold); border-width: 2px; background: var(--gold-pale) }
.band-l { font-family: var(--serif); font-size: 19px; color: var(--green); line-height: 1 }
.band-r { font-size: 11.5px; color: var(--muted); margin-top: 2px }
.band-w { font-size: 12px; font-weight: 500; margin-top: 2px }
.scalenote p { font-size: 14px; color: var(--muted); line-height: 1.55; margin-bottom: 7px }
.scalenote strong { color: var(--ink); font-weight: 500 }

/* ----------------------------------------------------------------- price
 * The share-size chip is load-bearing, not decoration. Without it "£54" and
 * "£613" look like alternatives when one buys a 3,500th of a horse and the other
 * buys a hundredth. */

.price {
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex: none;
}
.price-v { font-family: var(--serif); font-size: 18px }
.price-v small { font-family: var(--sans); font-size: 12.5px; color: var(--muted) }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px }
.chip-lead, .chip-muted {
  font-size: 11px; padding: 4px 9px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--muted); background: var(--paper);
}
.chip-lead { background: var(--gold-pale); border-color: var(--gold); color: var(--warn); font-weight: 500 }

.card-meta { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.45; flex: 1 }

/* ------------------------------------------------------------------- CTA
 * Nothing leaves the site from a browse card. The enquiry and the promo code
 * live on the listing page, so the outbound click that eventually becomes an
 * invoice is made by someone who has read the terms. */

.cta { display: flex; gap: 7px; margin-top: 13px }
.btn {
  flex: 1; text-align: center; padding: 10px; border-radius: 7px;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; font-family: var(--sans); text-decoration: none;
}
.btn-primary { background: var(--green); color: #fff }
.btn-secondary { background: #fff; color: var(--green); border-color: #C9D3CE }
.btn-narrow { flex: 0 0 96px }

/* ------------------------------------------------------------------ tables */

table { width: 100%; border-collapse: collapse; font-size: 14.5px }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 13px;
  padding: 0 10px 9px 0; border-bottom: 1px solid var(--line);
}
td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top }
td.num { text-align: right; white-space: nowrap; width: 112px }
td.why { color: var(--muted); font-size: 13.5px; line-height: 1.5 }
td.src { color: var(--muted); font-size: 12.5px; line-height: 1.45; width: 190px }
tr.unknown td { color: var(--muted) }
tr.unknown td.num { font-style: italic }
.nominal { color: var(--muted); font-size: 12px; font-style: italic; white-space: nowrap }

/* --------------------------------------------------------------- sections */

section { padding: 36px 0; border-bottom: 1px solid var(--line) }
h2 { font-family: var(--serif); font-size: 23px; font-weight: 500; letter-spacing: -.01em; margin-bottom: 8px }
.lede { color: var(--muted); font-size: 15px; margin-bottom: 20px; max-width: 62ch }

/* ---------------------------------------------------------------- metrics */

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 26px 0 }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px }
.metric-v { font-family: var(--serif); font-size: 28px; color: var(--green); letter-spacing: -.02em }
.metric-l { font-size: 14px; font-weight: 500; margin-top: 3px }
.metric-note { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.45 }

/* -------------------------------------------------------- badge allocation */

.badgebox {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--gold); border-radius: 8px; padding: 20px 22px;
}
.badgebox p { font-size: 15px; line-height: 1.6 }
.badgebox p + p { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line) }

/* -------------------------------------------------------- cookie consent
 *
 * The banner is one decision taken once, so it looks and reads the same on every
 * page. Markup and script are in build/templates/consent.html; only the styling
 * lives here, and check.py asserts the markup has not drifted between copies.
 *
 * Note the three hand-written pages (index, methodology, privacy) do not load this
 * stylesheet yet and still carry their own copy of these rules. Migrating them is
 * the last piece of the stylesheet consolidation.
 */

#cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
  background: var(--green-deep); color: #EDF2EF;
  border-top: 2px solid var(--gold); box-shadow: 0 -8px 28px rgba(0, 0, 0, .22);
}
#cookie-banner .cb-inner {
  max-width: 1080px; margin: 0 auto; padding: 18px 22px; display: flex; gap: 22px;
  align-items: center; justify-content: space-between; flex-wrap: wrap;
}
#cookie-banner .cb-text { font-size: 14px; line-height: 1.55; max-width: 660px; color: #DCE6E1 }
#cookie-banner .cb-text a { color: var(--gold-bright); text-decoration: underline }
#cookie-banner .cb-actions { display: flex; gap: 10px; flex-shrink: 0 }
.cb-btn {
  font-family: var(--sans); font-size: 14px; font-weight: 500; padding: 10px 18px;
  border-radius: 6px; cursor: pointer; border: 1px solid transparent; transition: opacity .15s;
}
.cb-btn:hover { opacity: .86 }
.cb-decline { background: transparent; color: #DCE6E1; border-color: rgba(255, 255, 255, .35) }
.cb-accept { background: var(--gold); color: #fff }

@media (max-width: 620px) {
  #cookie-banner .cb-inner { padding: 16px; gap: 14px }
  #cookie-banner .cb-actions { width: 100% }
  .cb-btn { flex: 1 }
}

/* -------------------------------------------------------- anchor targets
 *
 * A sticky masthead covers the top of whatever an in-page link scrolls to: the
 * browser puts the target at the viewport top, and the header is already there.
 * scroll-margin-top holds it clear.
 *
 * The value is a variable rather than a number because the mastheads differ.
 * index.html's is sticky and about 74px tall; every other page's scrolls away and
 * needs no offset at all. A single shared number would push anchors down by 90px
 * on pages that never had the problem.
 *
 * `[id]` rather than `section` or a class: any element can be an anchor target,
 * and nothing has to be remembered when one is added. Note this selector form was
 * invisible to build/cssaudit.py until this rule was written — it read `[id]` as
 * an element named "id" and reported nothing. Fixed there; the default of 0 also
 * makes the rule inert on any page that has not opted in, so it changes nothing
 * it was not asked to change.
 */

[id] { scroll-margin-top: var(--anchor-offset) }

/* ----------------------------------------------------------------- footer */

footer { padding: 34px 0 50px; color: var(--muted); font-size: 12.5px; line-height: 1.6 }

@media (max-width: 640px) {
  h1 { font-size: 27px }
  td.src { width: auto }
  .bandscale { gap: 3px }
  .band-w { display: none }
  .band-r { font-size: 10px }
}
