/* Horse name finder – styles */
:root {
  --bg: #f7f2ea;
  --surface: #fffdf9;
  --ink: #2a211b;
  --ink-soft: #6b5d52;
  --line: #e6dccf;
  --brand: #7a3e1d;
  --brand-ink: #fff;
  --accent: #2f5d50;
  --accent-soft: #e3eee9;
  --hit: #f3e2c6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 33, 27, .06), 0 6px 20px rgba(42, 33, 27, .06);
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--bg);
}
button, input, select { font: inherit; color: inherit; }
.wrap { width: min(1240px, 100% - 2rem); margin-inline: auto; }

/* ---- Hero ---- */
.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(255, 220, 170, .25), transparent 60%),
    linear-gradient(160deg, #3b2416 0%, #6b3518 55%, #8a4a22 100%);
  color: #fbf4ea;
  padding: 1.5rem 0 3.5rem;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; letter-spacing: .02em; opacity: .9; }
.brand-icon { width: 28px; height: 28px; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.1;
  margin: 2rem 0 .5rem;
  max-width: 18ch;
}
.lead { margin: 0 0 1.75rem; max-width: 55ch; color: #f1e2cf; font-size: 1.08rem; }
.hero-stats { margin: .75rem 0 0; font-size: .9rem; color: #e8d3ba; }

.searchbar {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: .4rem .45rem .4rem 1.1rem;
  max-width: 720px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.searchbar-icon { width: 22px; height: 22px; color: var(--ink-soft); flex: none; }
.searchbar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  padding: .7rem .25rem; font-size: 1.05rem;
}
.searchbar select {
  border: 0; background: var(--bg); border-radius: 999px; padding: .65rem 1rem; cursor: pointer;
}

/* ---- Layout ---- */
.layout {
  display: grid; grid-template-columns: 300px 1fr; gap: 2rem;
  margin-top: -1.75rem; align-items: start;
}
.filters {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem .5rem; position: sticky; top: 1rem;
  max-height: calc(100vh - 2rem); overflow-y: auto;
}
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.filters-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.35rem; }
.close-filters { display: none; }

.filter-block { border-top: 1px solid var(--line); padding: .85rem 0; }
.filter-block h3 {
  display: inline-flex; align-items: center; gap: .4rem;
  margin: 0 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft);
}
details.filter-block > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
details.filter-block > summary::-webkit-details-marker { display: none; }
details.filter-block > summary::after { content: "+"; font-size: 1.2rem; color: var(--ink-soft); margin-bottom: .6rem; }
details.filter-block[open] > summary::after { content: "–"; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1px solid var(--line); background: var(--surface);
  padding: .35rem .75rem; border-radius: 999px; cursor: pointer; font-size: .9rem;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: #cdbba6; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .count { font-size: .75rem; opacity: .6; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); flex: none; }

.segmented { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 3px; }
.segmented button {
  flex: 1; border: 0; background: transparent; padding: .5rem .4rem; border-radius: 8px; cursor: pointer; font-size: .9rem;
}
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }
.segmented.small button { font-size: .82rem; }

.check { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; font-size: .9rem; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.field { margin: .3rem 0 .9rem; }
.field-label, .field label { display: block; font-size: .85rem; color: var(--ink-soft); margin-bottom: .35rem; }
.field input[type="number"], .field input[type="text"] {
  display: block; width: 100%; margin-top: .3rem;
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; background: #fff; color: var(--ink);
}
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.letters { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.letters button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: .3rem 0; cursor: pointer; font-size: .85rem;
}
.letters button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.badge:not(:empty) {
  display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--brand); color: #fff; font-size: .72rem; letter-spacing: 0; font-weight: 600;
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; justify-content: space-between;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem 1rem;
}
.result-count { margin: 0; font-weight: 600; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar select { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .5rem .7rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  border-radius: 10px; padding: .55rem .95rem; cursor: pointer; border: 1px solid transparent; font-weight: 600; font-size: .92rem;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #64310f; }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.ghost:hover { border-color: #cdbba6; }
.btn[aria-pressed="true"] { background: var(--hit); border-color: #e2c69a; }
.open-filters { display: none; }
.link-btn { border: 0; background: none; color: var(--brand); cursor: pointer; font-size: .88rem; text-decoration: underline; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 1.2rem; padding: .25rem .5rem; color: var(--ink-soft); }

.active-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0; min-height: .5rem; }
.active-filters .chip { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.active-filters .chip::after { content: "✕"; font-size: .7rem; }

/* ---- Results ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 1rem; display: flex; flex-direction: column; gap: .55rem;
  animation: rise .25s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.card-name { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.15; margin: 0; word-break: break-word; }
.card-meta { font-size: .85rem; color: var(--ink-soft); margin: 0; }
.card-meaning { margin: 0; font-size: .95rem; }
.card-meaning::before { content: "„"; }
.card-meaning::after { content: "“"; }
.card-actions { display: flex; gap: .1rem; flex: none; }
.card-actions button { border: 0; background: none; cursor: pointer; font-size: 1.15rem; padding: .25rem .35rem; border-radius: 8px; color: #b9a896; }
.card-actions button:hover { background: var(--bg); color: var(--ink); }
.card-actions .fav[aria-pressed="true"] { color: #c0392b; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; padding-top: .3rem; }
.tag { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: var(--bg); color: var(--ink-soft); }
.tag.hit { background: var(--hit); color: #6b3a10; font-weight: 600; }

.relevance { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--ink-soft); }
.relevance-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.relevance-bar span { display: block; height: 100%; background: linear-gradient(90deg, #c98a4b, var(--brand)); border-radius: inherit; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-soft); }
.empty-title { font-family: var(--font-display); font-size: 1.4rem; color: var(--ink); margin: 0 0 .3rem; }
.more { display: flex; justify-content: center; margin: 1.5rem 0 2rem; }

.skeleton-block, .card.skeleton {
  background: linear-gradient(90deg, #efe7db 25%, #f7f1e8 50%, #efe7db 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--radius);
}
.skeleton-block { height: 90px; margin: .8rem 0; }
.card.skeleton { min-height: 170px; box-shadow: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Spotlight & toast ---- */
.spotlight {
  border: 0; border-radius: 20px; padding: 2.5rem 2rem 2rem; width: min(440px, 92vw);
  text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); background: var(--surface); color: var(--ink);
}
.spotlight::backdrop { background: rgba(30, 20, 12, .55); backdrop-filter: blur(2px); }
.spotlight-close { position: absolute; top: .6rem; right: .6rem; }
.spotlight-kicker { margin: 0; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; }
.spotlight-name { font-family: var(--font-display); font-size: 3rem; margin: .3rem 0; line-height: 1.1; color: var(--brand); }
.spotlight-meta { margin: 0 0 1.5rem; color: var(--ink-soft); }
.spotlight-actions { display: flex; justify-content: center; gap: .6rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; font-size: .9rem; z-index: 60;
}
.footer { color: var(--ink-soft); font-size: .85rem; padding: 1rem 0 2rem; text-align: center; }

/* ---- Mobile ---- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters {
    position: fixed; inset: 0 auto 0 0; width: min(360px, 90vw); max-height: none; height: 100%;
    border-radius: 0 var(--radius) var(--radius) 0; z-index: 50;
    transform: translateX(-105%); transition: transform .25s ease;
  }
  .filters.open { transform: none; }
  .close-filters, .open-filters { display: inline-flex; }
  .backdrop { position: fixed; inset: 0; background: rgba(30, 20, 12, .45); z-index: 40; }
  .toolbar { position: sticky; top: 0; z-index: 30; }
  .result-count { order: 3; width: 100%; font-size: .9rem; }
  .searchbar select { padding: .65rem .6rem; }
}
@media (max-width: 520px) {
  .toolbar-actions { width: 100%; }
  .toolbar-actions select { flex: 1; }
  .hero { padding-bottom: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Color swatches (classes instead of inline styles for CSP) */
.swatch--rappe { background: #1d1a19; }
.swatch--schimmel { background: #ecebe7; }
.swatch--fuchs { background: #b5561f; }
.swatch--brauner { background: #5a3420; }
.swatch--falbe { background: #c9a46a; }
.swatch--palomino { background: #e2b65c; }
.swatch--isabell { background: #e9d6a8; }
.swatch--cremello { background: #f6eedc; }
.swatch--schecke { background: conic-gradient(#5a3420 0 25%, #fff 0 50%, #5a3420 0 75%, #fff 0); }
.swatch--tiger { background: radial-gradient(circle at 30% 30%, #3a2a20 18%, transparent 20%), radial-gradient(circle at 70% 65%, #3a2a20 15%, transparent 17%), #f4f0e8; }

/* Legal / static pages */
.page { max-width: 760px; margin: 2rem auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.page h1 { font-family: var(--font-display); margin-top: 0; }
.page .todo { background: var(--hit); padding: .75rem 1rem; border-radius: 10px; }
.topbar { background: #3b2416; color: #fbf4ea; padding: 1rem 0; }
.topbar a { color: inherit; text-decoration: none; }
.footer a { color: var(--ink-soft); margin: 0 .4rem; }
noscript p { background: var(--hit); padding: 1rem; text-align: center; margin: 0; }

/* =====================================================================
   Stable theme (v2.1): paddock hero, wooden stable signs, horseshoes
   ===================================================================== */
:root {
  --wood-1: #8b5a33;
  --wood-2: #6e4325;
  --wood-3: #563219;
  --brass-1: #f0d58f;
  --brass-2: #c99b45;
  --brass-3: #9c7128;
  --stable-green: #2f5d50;
  --straw: #e9d9b4;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

body {
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(115deg, rgba(160, 120, 60, .045) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(65deg, rgba(160, 120, 60, .035) 0 1px, transparent 1px 19px);
}

/* ---- Hero with paddock scene ---- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #2b1a2e 0%, #5b2c26 38%, #a8552a 72%, #d98c45 100%);
  padding: 1.25rem 0 12rem;
}
.hero-content { position: relative; z-index: 1; }
.hero-scene { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 320px; z-index: 0; }
.brand { gap: .6rem; }
.brand-icon { width: 30px; height: 30px; color: var(--straw); }
.brand-tag { margin-left: .5rem; padding-left: .8rem; border-left: 1px solid rgba(255, 240, 210, .35); font-weight: 400; font-size: .88rem; opacity: .8; }
.hero h1 { max-width: 16ch; text-shadow: 0 2px 18px rgba(0, 0, 0, .35); }
.searchbar-icon { color: var(--brass-3); width: 24px; height: 24px; --shoe-hole: var(--surface); }
.shoe-holes { fill: var(--shoe-hole, #fff); }

.layout { margin-top: -3.5rem; position: relative; z-index: 2; }

/* ---- Leather-stitched panels ---- */
.filters, .toolbar {
  outline: 1.5px dashed rgba(122, 62, 29, .22);
  outline-offset: -7px;
}
.filters-head h2 { display: flex; align-items: center; gap: .45rem; }
.h-icon { width: 20px; height: 20px; color: var(--brand); --shoe-hole: var(--surface); }
.chip[aria-pressed="true"] { background: var(--stable-green); border-color: var(--stable-green); }

/* ---- Results as stable signs ---- */
.card { padding: 0; overflow: hidden; gap: 0; border: 1px solid #e3d5c0; }
.sign {
  position: relative; padding: 1.15rem 1rem 1rem;
  display: flex; justify-content: center;
  background-color: var(--wood-2);
  background-image:
    repeating-linear-gradient(178deg, rgba(0, 0, 0, .09) 0 2px, transparent 2px 9px, rgba(255, 220, 170, .06) 9px 11px, transparent 11px 19px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 74px),
    linear-gradient(180deg, var(--wood-1), var(--wood-2) 60%, var(--wood-3));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
}
.plate {
  position: relative; max-width: 100%;
  padding: .55rem 1.6rem .5rem;
  border-radius: 6px;
  background:
    radial-gradient(circle at 9px 50%, #7a5520 0 2.2px, rgba(255, 240, 200, .7) 2.6px, transparent 3.4px),
    radial-gradient(circle at calc(100% - 9px) 50%, #7a5520 0 2.2px, rgba(255, 240, 200, .7) 2.6px, transparent 3.4px),
    linear-gradient(160deg, var(--brass-1) 0%, var(--brass-2) 45%, #e6c477 60%, var(--brass-3) 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(0, 0, 0, .25);
}
.card-name {
  font-size: clamp(1.25rem, 2.2vw, 1.55rem); text-align: center; letter-spacing: .02em;
  color: #3a240f; text-shadow: 0 1px 0 rgba(255, 245, 215, .7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-actions { position: absolute; top: .3rem; right: .3rem; }
.card-actions button { color: rgba(255, 236, 205, .55); font-size: 1rem; }
.card-actions button:hover { background: rgba(0, 0, 0, .2); color: #fff3df; }
.card-actions .fav[aria-pressed="true"] { color: #ff8f7a; }
.card-body { padding: .85rem 1.1rem 1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }

.fit { display: flex; align-items: center; gap: .55rem; }
.fit-shoes { display: inline-flex; gap: 2px; }
.shoe { width: 18px; height: 18px; color: #e3d6c3; --shoe-hole: var(--surface); }
.shoe.on { color: var(--brass-2); }
.fit-pct { font-size: .78rem; color: var(--ink-soft); }
.tag.hit { background: #f1e1bd; color: #5d3a10; }

/* ---- Spotlight as large stable sign ---- */
.spotlight { padding: 2.2rem 1.75rem 1.75rem; }
.sign--large { border-radius: 12px; margin: .8rem 0 1rem; padding: 1.6rem 1.2rem; }
.sign--large .plate { padding: .7rem 2.2rem; }
.spotlight-name { color: #3a240f; text-shadow: 0 1px 0 rgba(255, 245, 215, .7); font-size: 2.6rem; margin: 0; }

.empty-icon { width: 48px; height: 48px; color: #d6c4aa; --shoe-hole: var(--bg); }

/* ---- Paddock fence above the footer ---- */
.fence-divider {
  height: 46px; margin-top: 2rem;
  background:
    linear-gradient(#7a5233, #7a5233) 0 12px / 100% 6px no-repeat,
    linear-gradient(#7a5233, #7a5233) 0 28px / 100% 6px no-repeat,
    repeating-linear-gradient(90deg, #5e3c22 0 10px, transparent 10px 120px) 0 0 / 100% 46px no-repeat;
  opacity: .55;
}
.footer { padding-top: .5rem; }

@media (max-width: 900px) {
  .hero { padding-bottom: 10rem; }
  .hero-scene { height: 240px; }
  .brand-tag { display: none; }
  .layout { margin-top: -2.5rem; }
}
.hero h1 { max-width: 22ch; }
.layout { margin-top: -1.25rem; }
@media (max-width: 900px) { .layout { margin-top: -1rem; } }
