/* ============================================================
   MY BEST FRIEND — a field guide to dog breeds
   Palette derived from traditional Japanese pigments.
   ============================================================ */

:root {
  --shu: #E4322B;         /* shu-iro — vermillion */
  --konjo: #1B3B6F;       /* konjo — deep indigo  */
  --yamabuki: #E6B422;    /* yamabuki — gold      */
  --wakatake: #6ABE83;    /* wakatake — young bamboo */
  --sango: #F19A82;       /* sango — coral        */
  --kinari: #F5EFE0;      /* kinari — undyed paper */
  --kinari-2: #EFE7D2;    /* deeper paper         */
  --sumi: #1A1A1A;        /* sumi — ink           */
  --sumi-2: #2B2B2B;
  --ash: #6E655A;

  --border: rgba(26, 26, 26, 0.14);
  --border-strong: rgba(26, 26, 26, 0.65);

  --display: "Shippori Mincho B1", "Times New Roman", serif;
  --body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 0 rgba(26,26,26,0.06), 0 6px 20px -12px rgba(26,26,26,0.18);
  --shadow-md: 0 2px 0 rgba(26,26,26,0.08), 0 20px 40px -20px rgba(26,26,26,0.25);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  color: var(--sumi);
  background: var(--kinari);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 60% 40% at 12% 8%, rgba(228,50,43,0.05), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 20%, rgba(27,59,111,0.05), transparent 60%);
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: rgba(245, 239, 224, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark svg,
.brand-mark img { display: block; border-radius: 50%; }
.footer-brand img { border-radius: 50%; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-en { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand-sub { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ash); margin-top: 2px; }
.nav-links { display: flex; gap: 32px; }
.nav-links a {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--sumi);
  position: relative;
  padding-bottom: 2px;
}
.nav-links a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1.5px;
  background: var(--shu);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-links a:hover::after { transform: scaleX(1); }

/* ============================================================
   COMMON
   ============================================================ */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ash);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.eyebrow-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--shu);
  border-radius: 999px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
}
.btn-primary { background: var(--sumi); color: var(--kinari); }
.btn-primary:hover { background: var(--shu); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { color: var(--sumi); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--sumi); color: var(--kinari); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.section-head {
  max-width: 720px;
  margin: 0 auto 64px;
  text-align: center;
  padding: 0 24px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 72px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 20px;
}
.section-head h2 em {
  font-style: italic;
  color: var(--shu);
  font-weight: 500;
}
.section-lede {
  font-size: 17px;
  color: var(--sumi-2);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 60px 40px 0;
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  max-width: 1360px;
  margin: 0 auto;
  align-items: center;
  min-height: min(760px, calc(100vh - 100px));
  padding-bottom: 80px;
}
.hero-copy { max-width: 620px; }
.hero-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(52px, 7.5vw, 108px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 32px;
}
.hero-title em {
  font-style: italic;
  color: var(--shu);
  font-weight: 500;
  position: relative;
}
.hero-title em::before {
  content: "";
  position: absolute;
  left: -8px; right: -8px;
  bottom: 6px;
  height: 12px;
  background: var(--yamabuki);
  opacity: 0.35;
  z-index: -1;
  transform: skewX(-8deg);
}
.hero-lede {
  font-size: 18px;
  line-height: 1.65;
  color: var(--sumi-2);
  max-width: 500px;
  margin-bottom: 40px;
}
.hero-ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}
.hero-stats {
  display: flex;
  gap: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.hero-stats > div { display: flex; flex-direction: column; }
.hero-stats dt {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ash);
  margin-bottom: 6px;
}
.hero-stats dd {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hero-art {
  position: relative;
  max-width: 620px;
  margin-left: auto;
  animation: heroFloat 9s ease-in-out infinite;
}
.hero-photo {
  width: 100%;
  height: auto;
  display: block;
  border: 1.5px solid var(--sumi);
  border-radius: 3px;
  box-shadow: 0 24px 40px rgba(26,26,26,0.14);
  /* Tone down the pop so it sits in the warm kinari palette:
     - saturate(0.78): softer, less candy-store color
     - contrast(0.94): closer mid-tones, less "sticker" pop
     - sepia(0.10): a warm cast that echoes the paper background */
  filter: saturate(0.78) contrast(0.94) sepia(0.10) brightness(0.98);
}
/* Warm paper overlay on top of the image to unify with the page.
   Two layers: (1) a soft kinari tint, (2) a subtle vignette. */
.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(245,239,224,0) 55%, rgba(245,239,224,0.35) 100%),
    linear-gradient(180deg, rgba(245,239,224,0.14), rgba(228,50,43,0.06));
  mix-blend-mode: multiply;
}
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art { animation: none; }
}

.hero-ribbon {
  position: relative;
  overflow: hidden;
  background: var(--sumi);
  color: var(--kinari);
  padding: 22px 0;
  margin-top: 40px;
}
.hero-ribbon::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, var(--sumi), transparent 8%, transparent 92%, var(--sumi)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30'><path d='M0,30 A30,30 0 0,1 60,30' fill='none' stroke='%23F5EFE0' stroke-width='0.6' opacity='0.15'/></svg>");
  pointer-events: none;
}
.ribbon-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  animation: ribbonScroll 40s linear infinite;
  white-space: nowrap;
  width: max-content;
}
.ribbon-inner span {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
}
.ribbon-inner .dot { color: var(--shu); font-size: 14px; }
@keyframes ribbonScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============================================================
   MATCHER
   ============================================================ */
.matcher {
  padding: 120px 40px;
  background: var(--kinari-2);
  position: relative;
  overflow: hidden;
}
.matcher::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='%231A1A1A' opacity='0.04'><g transform='translate(20,25)'><circle cx='0' cy='-6' r='4'/><circle cx='6' cy='-2' r='4'/><circle cx='4' cy='5' r='4'/><circle cx='-4' cy='5' r='4'/><circle cx='-6' cy='-2' r='4'/></g><g transform='translate(90,60) scale(0.7)'><circle cx='0' cy='-6' r='4'/><circle cx='6' cy='-2' r='4'/><circle cx='4' cy='5' r='4'/><circle cx='-4' cy='5' r='4'/><circle cx='-6' cy='-2' r='4'/></g><g transform='translate(50,95) scale(0.9)'><circle cx='0' cy='-6' r='4'/><circle cx='6' cy='-2' r='4'/><circle cx='4' cy='5' r='4'/><circle cx='-4' cy='5' r='4'/><circle cx='-6' cy='-2' r='4'/></g></g></svg>");
  pointer-events: none;
}
.matcher-frame {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  background: var(--kinari);
  border: 1.5px solid var(--sumi);
  padding: 80px 60px;
  box-shadow: var(--shadow-md);
}
.matcher-frame::before,
.matcher-frame::after {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border: 1.5px solid var(--sumi);
}
.matcher-frame::before { top: -8px; left: -8px; border-right: 0; border-bottom: 0; }
.matcher-frame::after { bottom: -8px; right: -8px; border-left: 0; border-top: 0; }

.quiz-progress {
  position: relative;
  height: 3px;
  background: var(--border);
  margin-bottom: 12px;
}
.quiz-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--shu);
  width: 14%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.quiz-progress-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ash);
  display: block;
  margin-bottom: 40px;
  margin-top: 8px;
}

.quiz-stage { min-height: 340px; }
.quiz-question {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}
.quiz-hint {
  color: var(--ash);
  font-size: 15px;
  margin-bottom: 32px;
}
.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.quiz-option {
  position: relative;
  padding: 22px 24px;
  background: var(--kinari);
  border: 1.5px solid var(--border);
  text-align: left;
  border-radius: var(--radius);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.quiz-option:hover { border-color: var(--sumi); transform: translateY(-2px); }
.quiz-option.is-selected {
  background: var(--sumi);
  color: var(--kinari);
  border-color: var(--sumi);
}
.quiz-option.is-selected .quiz-option-detail { color: rgba(245,239,224,0.75); }
.quiz-option-label {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.quiz-option-detail { font-size: 13px; color: var(--ash); line-height: 1.4; }

.quiz-multi-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border: 1px solid var(--shu);
  color: var(--shu);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Multi-select option: show a check-badge in the top-right corner
   when selected so users know they can pick more. */
.quiz-option[aria-pressed]::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--kinari);
  transition: background 0.2s, border-color 0.2s;
}
.quiz-option[aria-pressed="true"]::after {
  background: var(--shu);
  border-color: var(--shu);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23F5EFE0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
}
.quiz-option[aria-pressed] { padding-right: 44px; }

.quiz-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.matcher-results { margin-top: 40px; }
.matcher-results h3 {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
}
.matcher-note { color: var(--ash); margin-bottom: 32px; font-size: 15px; }
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
  align-items: stretch;
}
.match-card-wrap {
  position: relative;
  display: flex;
  height: 100%;
}
.match-card-wrap > .match-card { flex: 1; height: 100%; }
.match-card {
  background: var(--kinari);
  border: 1.5px solid var(--sumi);
  padding: 20px 20px 60px; /* reserve room for the compare pill at bottom */
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
}
.match-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.match-rank {
  position: absolute;
  top: -12px; left: 16px;
  background: var(--shu);
  color: var(--kinari);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  letter-spacing: 0.08em;
}
.match-illust {
  aspect-ratio: 1 / 1;
  background: var(--kinari-2);
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.match-illust .illust-photo { object-fit: cover; }
.match-name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  line-height: 1.15;
}
.match-score {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ash);
  margin-top: auto; /* push to bottom of card; pill sits to the right of it */
  padding-right: 96px; /* clear the compare pill */
}

/* ============================================================
   LIBRARY
   ============================================================ */
.library {
  padding: 120px 40px;
}
.library-controls {
  max-width: 1200px;
  margin: 0 auto 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  background: var(--kinari);
  border: 1.5px solid var(--sumi);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within {
  border-color: var(--shu);
  box-shadow: 0 0 0 4px rgba(228, 50, 43, 0.12);
}
.search svg { color: var(--ash); flex-shrink: 0; }
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;
}
.search input::placeholder { color: var(--ash); }
.search-clear {
  color: var(--ash);
  font-size: 22px;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-clear:hover { color: var(--sumi); background: var(--kinari-2); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 8px 16px;
  border: 1.5px solid var(--border-strong);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-radius: 999px;
  transition: all 0.2s;
}
.chip:hover { background: var(--sumi); color: var(--kinari); }
.chip.is-active { background: var(--shu); border-color: var(--shu); color: var(--kinari); }

.alphabet {
  max-width: 1200px;
  margin: 0 auto 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  justify-content: center;
}
.alpha-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
  color: var(--ash);
  transition: all 0.2s;
  border-radius: 4px;
}
.alpha-btn:not(:disabled):hover { color: var(--sumi); background: var(--kinari-2); }
.alpha-btn:not(:disabled).is-active { background: var(--sumi); color: var(--kinari); }
.alpha-btn:disabled { color: rgba(26, 26, 26, 0.18); cursor: not-allowed; }

.library-note {
  max-width: 900px;
  margin: 0 auto 40px;
  border-left: 3px solid var(--shu);
  background: var(--kinari-2);
  padding: 20px 28px;
}
.library-note h4 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--shu);
  margin-bottom: 10px;
}
.library-note p {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--sumi-2);
}
.library-note em { color: var(--sumi); font-style: italic; }

/* ============================================================
   SHARE WIDGET
   ============================================================ */
.share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  background: var(--kinari-2);
  border-radius: 2px;
}
.share-label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ash);
  padding: 0 10px 0 8px;
  border-right: 1px solid var(--border);
  align-self: stretch;
  display: inline-flex;
  align-items: center;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sumi);
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border-radius: 2px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.share-btn:hover { background: var(--sumi); color: var(--kinari); }
.share-btn:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }
.share-btn.is-copied { color: var(--shu); }
.share-btn svg { flex-shrink: 0; }

.match-share-host {
  margin: 32px 0 24px;
  display: flex;
  justify-content: center;
}

.bp-hero-cta { flex-wrap: wrap; }
.bp-hero .share { margin-top: 12px; }

.breed-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  align-items: stretch;
}
.breed-card-wrap { display: flex; height: 100%; }
.breed-card-wrap > .breed-card { flex: 1; height: 100%; }
.breed-letter { align-self: start; }
.breed-letter {
  grid-column: 1 / -1;
  padding: 32px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 18px;
  border-top: 1px solid var(--border);
}
.breed-letter:first-of-type { border-top: 0; padding-top: 8px; }
.breed-letter-mark {
  font-family: var(--display);
  font-size: 48px;
  font-weight: 500;
  color: var(--shu);
  line-height: 1;
  letter-spacing: -0.03em;
}
.breed-letter-count {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ash);
}

.breed-card {
  background: var(--kinari);
  border: 1.5px solid var(--sumi);
  padding: 0;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  text-align: left;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.breed-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.breed-card:focus-visible { outline: 3px solid var(--shu); outline-offset: 2px; }

.breed-illust {
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  border-bottom: 1.5px solid var(--sumi);
}
.illust-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.illust-pattern {
  position: absolute;
  inset: 0;
  background: var(--kinari-2);
  z-index: 1;
}
.illust-pattern .pattern-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
}
.illust-sun {
  position: absolute;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  right: -12%;
  top: -18%;
  z-index: 2;
  opacity: 0.85;
  border: 1.5px solid rgba(26,26,26,0.15);
}
.illust-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 3;
  mix-blend-mode: normal;
  transition: opacity 0.4s ease;
}
/* When the manga image succeeds, hide the pattern/sun for a cleaner poster look */
.illust-frame:has(.illust-photo:not([style*="display: none"])) .illust-pattern,
.illust-frame:has(.illust-photo:not([style*="display: none"])) .illust-sun {
  opacity: 0.6;
}

/* ============================================================
   COMPARE — pill, tray, side-by-side overlay
   ============================================================ */
.compare-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 10px;
  background: var(--kinari);
  color: var(--sumi);
  border: 1px solid var(--border-strong, rgba(26, 26, 26, 0.35));
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  user-select: none;
  line-height: 1;
}
/* On cards / match cards / dialog, the pill floats at bottom-right */
.breed-card-wrap,
.match-card-wrap {
  position: relative;
}
.breed-card-wrap > .compare-pill,
.match-card-wrap > .compare-pill {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  box-shadow: 0 3px 10px rgba(26, 26, 26, 0.12);
}
.dialog-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.bp-hero-cta .compare-pill {
  margin-left: 4px;
}
.compare-pill:hover,
.compare-pill:focus-visible {
  background: var(--sumi);
  color: var(--kinari);
  border-color: var(--sumi);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(26, 26, 26, 0.14);
  outline: none;
}
.compare-pill.is-on {
  background: var(--shu);
  color: var(--kinari);
  border-color: var(--shu);
}
.compare-pill.is-on:hover,
.compare-pill.is-on:focus-visible {
  background: var(--sumi);
  border-color: var(--sumi);
}
.compare-pill svg { flex-shrink: 0; }
.compare-pill span { pointer-events: none; }


/* ---- Tray ---- */
.compare-tray {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  animation: cmp-tray-in 220ms ease;
}
.compare-tray[hidden] { display: none; }
@keyframes cmp-tray-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.compare-tray-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--sumi);
  color: var(--kinari);
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(26, 26, 26, 0.32);
}
.compare-tray-label {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding-right: 4px;
  border-right: 1px solid rgba(245, 239, 224, 0.2);
  padding-right: 12px;
}
.compare-tray-count {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
}
.compare-tray-caption {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(245, 239, 224, 0.7);
}
.compare-tray-slots {
  display: flex;
  gap: 8px;
}
.compare-slot {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 3px;
  background: var(--kinari-2);
  overflow: hidden;
  border: 1px solid rgba(245, 239, 224, 0.15);
}
.compare-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.compare-slot-empty {
  background: rgba(245, 239, 224, 0.08);
  border: 1px dashed rgba(245, 239, 224, 0.25);
}
.compare-slot-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--sumi);
  background: var(--kinari);
  color: var(--sumi);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare-slot-remove:hover { background: var(--shu); color: var(--kinari); border-color: var(--shu); }
.compare-tray-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.compare-tray-actions .btn {
  padding: 10px 16px;
  font-size: 12px;
  min-height: 0;
}
.compare-tray-actions .btn-primary {
  background: var(--kinari);
  color: var(--sumi);
}
.compare-tray-actions .btn-primary:hover:not(:disabled) {
  background: var(--shu);
  color: var(--kinari);
}
.compare-tray-actions .btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-ghost-sm {
  padding: 8px 12px;
  font-size: 11.5px;
  border: 1px solid rgba(245, 239, 224, 0.25);
  background: transparent;
  color: rgba(245, 239, 224, 0.85);
}
.btn-ghost-sm:hover {
  border-color: var(--kinari);
  color: var(--kinari);
  background: transparent;
}

/* ---- Toast ---- */
.compare-toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  background: var(--shu);
  color: var(--kinari);
  border-radius: 3px;
  font-family: var(--body);
  font-size: 13px;
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  box-shadow: 0 6px 18px rgba(26, 26, 26, 0.22);
}
.compare-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---- Full overlay ---- */
body.cmp-open { overflow: hidden; }
.compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: var(--kinari);
  overflow: auto;
  animation: cmp-in 200ms ease;
}
@keyframes cmp-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.cmp-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}
.cmp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.cmp-head-copy h2 {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 8px;
}
.cmp-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--sumi);
  background: transparent;
  color: var(--sumi);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cmp-close:hover { background: var(--sumi); color: var(--kinari); }

.cmp-scroll { overflow-x: auto; }
.cmp-grid {
  --label-w: 180px;
  display: grid;
  grid-template-columns: var(--label-w) repeat(var(--cmp-cols), minmax(200px, 1fr));
  min-width: min-content;
}
.cmp-row {
  display: contents;
}
.cmp-row-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ash);
  padding: 14px 18px 14px 0;
  border-bottom: 1px solid var(--border);
  align-self: center;
}
.cmp-row-cell {
  padding: 14px 18px;
  font-family: var(--body);
  font-size: 14.5px;
  color: var(--sumi-2);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  line-height: 1.5;
}
.cmp-section-label {
  grid-column: 1 / -1;
  padding: 28px 0 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--shu);
}

.cmp-row-heads .cmp-row-label { border-bottom: 0; }
.cmp-row-heads .cmp-col-head {
  padding: 0 18px 20px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cmp-col-photo {
  position: relative;
  aspect-ratio: 1;
  background: var(--kinari-2);
  margin-bottom: 12px;
  overflow: hidden;
}
.cmp-col-photo .compare-pill { display: none; }
.cmp-col-photo .illust-frame { position: absolute; inset: 0; }
.cmp-col-name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 4px;
}
.cmp-col-sub {
  font-family: var(--body);
  font-size: 12px;
  color: var(--ash);
  margin-bottom: 12px;
}
.cmp-col-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.cmp-col-link {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sumi);
  text-decoration: none;
  border-bottom: 1px solid var(--sumi);
  padding-bottom: 2px;
}
.cmp-col-link:hover { color: var(--shu); border-color: var(--shu); }
.cmp-col-remove {
  padding: 0;
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ash);
  cursor: pointer;
}
.cmp-col-remove:hover { color: var(--shu); }

.cmp-row-trait .cmp-row-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cmp-bar {
  flex: 1;
  height: 6px;
  background: var(--kinari-2);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.cmp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--shu), #F5A93D);
}
.cmp-bar-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ash);
  min-width: 26px;
  text-align: right;
}

.cmp-row-list .cmp-row-cell ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.cmp-row-list .cmp-row-cell li {
  padding: 3px 0 3px 14px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.5;
}
.cmp-row-list .cmp-row-cell li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--shu);
}

@media (max-width: 960px) {
  .cmp-shell { padding: 24px 20px 60px; }
  .cmp-head-copy h2 { font-size: 28px; }
  .compare-tray { right: 12px; bottom: 12px; left: 12px; }
  .compare-tray-inner { flex-wrap: wrap; justify-content: center; }
}

.breed-info {
  padding: 18px 20px 60px; /* bottom padding reserves room for the compare pill */
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.breed-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.breed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ash);
}
.breed-meta .breed-group { color: var(--shu); font-weight: 600; }
.breed-blurb {
  font-size: 13px;
  color: var(--sumi-2);
  line-height: 1.45;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.breed-seal {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  background: var(--shu);
  color: var(--kinari);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  transform: rotate(-4deg);
  z-index: 3;
  border: 1.5px solid var(--sumi);
}

.empty {
  text-align: center;
  color: var(--ash);
  padding: 80px 0;
  font-family: var(--display);
  font-size: 22px;
  font-style: italic;
}

/* ============================================================
   SOURCES
   ============================================================ */
.sources {
  padding: 120px 40px;
  background: var(--sumi);
  color: var(--kinari);
}
.sources .section-head h2 { color: var(--kinari); }
.sources .section-head h2 em { color: var(--yamabuki); }
.sources .section-lede { color: rgba(245, 239, 224, 0.7); }
.sources .eyebrow { color: rgba(245, 239, 224, 0.5); }
.sources .eyebrow-dot { background: var(--yamabuki); }

.source-list {
  max-width: 900px;
  margin: 0 auto;
  list-style: none;
}
.source-list li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 40px;
  padding: 32px 0;
  border-top: 1px solid rgba(245, 239, 224, 0.12);
  align-items: baseline;
}
.source-list li:last-child { border-bottom: 1px solid rgba(245, 239, 224, 0.12); }
.source-num {
  font-family: var(--display);
  font-size: 48px;
  font-weight: 500;
  color: var(--yamabuki);
  letter-spacing: -0.02em;
}
.source-list h3 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 6px;
}
.source-list p {
  color: rgba(245, 239, 224, 0.7);
  line-height: 1.5;
  font-size: 15px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 40px;
  background: var(--kinari-2);
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand p {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
}
.footer-note {
  font-size: 12.5px;
  color: var(--ash);
  line-height: 1.55;
  max-width: 760px;
}
.footer-disclaimer {
  font-size: 11.5px;
  color: var(--ash);
  line-height: 1.5;
  max-width: 760px;
  font-style: italic;
  padding-top: 10px;
  border-top: 1px dashed rgba(26,26,26,0.15);
}
.footer-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.footer-meta a { color: var(--shu); text-decoration: none; border-bottom: 1px solid var(--shu); padding-bottom: 1px; }
.footer-meta a:hover { color: var(--sumi); border-color: var(--sumi); }

/* ============================================================
   STORAGE NOTICE — dismissable banner
   ============================================================ */
.storage-notice {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 500;
  max-width: 380px;
  padding: 14px 18px;
  background: var(--sumi);
  color: var(--kinari);
  border-radius: 3px;
  box-shadow: 0 6px 20px rgba(26,26,26,0.28);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: sn-in 260ms ease;
}
.storage-notice[hidden] { display: none; }
@keyframes sn-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.storage-notice p {
  font-family: var(--body);
  font-size: 13px;
  line-height: 1.45;
  color: rgba(245,239,224,0.85);
  margin: 0;
  flex: 1;
}
.storage-notice button {
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--shu);
  color: var(--kinari);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  align-self: flex-end;
}
.storage-notice button:hover { background: var(--kinari); color: var(--sumi); }
@media (max-width: 640px) {
  .storage-notice { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ============================================================
   DIALOG
   ============================================================ */
.breed-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 960px;
  width: 92vw;
  max-height: 90vh;
  overflow: visible;
}
.breed-dialog::backdrop {
  background: rgba(26, 26, 26, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dialog-inner {
  background: var(--kinari);
  border: 1.5px solid var(--sumi);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.dialog-close {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 44px; height: 44px;
  background: var(--sumi);
  color: var(--kinari);
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border: 1.5px solid var(--sumi);
  transition: background 0.2s;
}
.dialog-close:hover { background: var(--shu); }

.dialog-hero {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  border-bottom: 1.5px solid var(--sumi);
}
.dialog-illust {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-right: 1.5px solid var(--sumi);
}
.dialog-head { padding: 40px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.dialog-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--shu);
  margin-bottom: 12px;
}
.dialog-name {
  font-family: var(--display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 10px;
}
.dialog-origin {
  font-family: var(--display);
  font-style: italic;
  color: var(--ash);
  font-size: 18px;
  margin-bottom: 24px;
}
.dialog-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.dialog-facts div { display: flex; flex-direction: column; gap: 4px; }
.dialog-facts dt {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ash);
}
.dialog-facts dd {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
}

.dialog-body {
  padding: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.trait-bar-row { display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: center; margin-bottom: 6px; }
.trait-bar-label { font-size: 13px; color: var(--sumi-2); }
.trait-bar {
  position: relative;
  height: 8px;
  background: var(--kinari-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.trait-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--shu), var(--yamabuki));
  border-radius: 999px;
}
.dialog-cta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding-top: 12px;
}
.dialog-section h4 {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ash);
  margin-bottom: 12px;
}
.dialog-section p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--sumi-2);
}
.dialog-section ul { list-style: none; padding: 0; margin: 0; }
.dialog-section li {
  padding: 8px 0;
  border-bottom: 1px dotted var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.dialog-section li:last-child { border-bottom: 0; }
.dialog-section li span:first-child { color: var(--ash); }
.dialog-section li span:last-child { font-family: var(--display); font-weight: 500; }

.trait-bars { display: flex; flex-direction: column; gap: 4px; }

.dialog-callout {
  grid-column: 1 / -1;
  background: var(--kinari-2);
  border-left: 3px solid var(--shu);
  padding: 20px 24px;
  font-family: var(--display);
  font-size: 16px;
  font-style: italic;
  line-height: 1.5;
  color: var(--sumi-2);
}
.dialog-callout::before {
  content: "“";
  font-size: 40px;
  color: var(--shu);
  line-height: 1;
  vertical-align: -12px;
  margin-right: 6px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; min-height: auto; padding: 40px 0 60px; }
  .hero-art { margin: 0 auto; }
  .dialog-hero { grid-template-columns: 1fr; }
  .dialog-illust { border-right: 0; border-bottom: 1.5px solid var(--sumi); aspect-ratio: 16/9; }
  .dialog-body { grid-template-columns: 1fr; }
  .bp-body { grid-template-columns: 1fr; }
  .bp-side { position: static; }
}
@media (max-width: 700px) {
  .nav { padding: 14px 20px; }
  .nav-links { gap: 20px; }
  .brand-sub { display: none; }
  .hero { padding: 40px 20px 0; }
  .matcher, .library, .sources { padding: 80px 20px; }
  .matcher-frame { padding: 40px 24px; }
  .hero-stats { gap: 24px; flex-wrap: wrap; }
  .source-list li { grid-template-columns: 1fr; gap: 8px; }
  .source-num { font-size: 32px; }
  .dialog-facts { grid-template-columns: 1fr; }
  .dialog-body { padding: 24px; }
  .dialog-head { padding: 24px; }
  .breed-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .alpha-btn { width: 32px; height: 32px; font-size: 16px; }
}
@media (max-width: 640px) {
  /* Global: prevent long unbroken text from breaking layout */
  h1, h2, h3, h4, p, span, a, button, div {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  /* Hero */
  .hero { padding: 24px 14px 0; overflow: hidden; }
  .hero-grid { gap: 28px; padding-bottom: 40px; min-height: auto; }
  .hero-title {
    font-size: clamp(28px, 9vw, 40px);
    line-height: 1.04;
    letter-spacing: -0.012em;
    margin-bottom: 20px;
    padding-right: 8px; /* room for italic slant */
  }
  .hero-title em { padding-right: 3px; }
  .hero-title em::before { height: 6px; left: -2px; right: 0; bottom: 3px; }
  .hero-copy { max-width: 100%; }
  .hero-lede { font-size: 14.5px; line-height: 1.55; margin-bottom: 22px; }
  .hero-copy .btn,
  .hero .btn { padding: 12px 14px; font-size: 10.5px; letter-spacing: 0.05em; white-space: normal; }
  .hero-stats { gap: 18px; flex-wrap: wrap; }
  .hero-stat-num { font-size: 30px; }
  .hero-stat-label { font-size: 9.5px; }

  /* Sections */
  .matcher, .library, .sources { padding: 56px 16px; }
  .matcher-frame { padding: 20px 16px; }
  .section-head h2 { font-size: clamp(28px, 8.5vw, 36px); }
  .section-lede { font-size: 14.5px; padding: 0 4px; }

  /* Library grid */
  .breed-grid { grid-template-columns: 1fr; gap: 18px; }
  .breed-card-wrap > .compare-pill { right: 10px; bottom: 10px; padding: 6px 10px; }
  .breed-name { font-size: 18px; }
  .breed-info { padding: 16px 18px 56px; }
  .alphabet { gap: 2px; flex-wrap: wrap; justify-content: center; }
  .alpha-btn { width: 28px; height: 28px; font-size: 14px; }
  .library-controls { padding: 16px; gap: 12px; }
  .filters { gap: 6px; flex-wrap: wrap; }
  .filter-btn { padding: 7px 11px; font-size: 10.5px; letter-spacing: 0.08em; }
  .search input { font-size: 15px; }

  /* Nav — brand on top row, links wrap below on very narrow screens */
  .nav { padding: 10px 14px; flex-wrap: wrap; gap: 6px 12px; }
  .nav-links { gap: 12px; flex-wrap: wrap; }
  .nav-links a { font-size: 10px; letter-spacing: 0.08em; }
  .brand-en { font-size: 15px; }
  .brand-sub { display: none; }

  /* Quiz */
  .quiz-question { font-size: clamp(20px, 5.5vw, 24px); }
  .quiz-hint { font-size: 13px; }
  .quiz-options { grid-template-columns: 1fr; }
  .quiz-option { padding: 14px 16px; }
  .quiz-option-label { font-size: 15px; }
  .quiz-option-detail { font-size: 13px; }
  .quiz-nav { gap: 12px; }
  .quiz-nav .btn { padding: 12px 14px; font-size: 11px; letter-spacing: 0.06em; white-space: normal; }
  .matcher-frame::before,
  .matcher-frame::after { display: none; }

  /* Results grid */
  .match-grid { grid-template-columns: 1fr; }

  /* Dialog */
  .dialog-inner { max-width: 100vw; margin: 0; border-radius: 0; max-height: 100vh; }
  .dialog-body { padding: 20px; grid-template-columns: 1fr; }
  .dialog-head { padding: 20px; }
  .dialog-name { font-size: 26px; line-height: 1.1; }
  .dialog-facts { grid-template-columns: 1fr 1fr; gap: 12px; }
  .dialog-hero { grid-template-columns: 1fr; }
  .dialog-illust { aspect-ratio: 4/3; }

  /* Breed profile page */
  .bp-hero { padding: 20px 16px; grid-template-columns: 1fr; gap: 20px; }
  .bp-hero-photo { max-width: 100%; }
  .bp-title { font-size: clamp(30px, 9vw, 40px); line-height: 1.05; }
  .bp-lede { font-size: 15px; }
  .bp-body { padding: 0 16px 48px; grid-template-columns: 1fr; gap: 28px; }
  .bp-section h2 { font-size: 24px; }
  .bp-section p { font-size: 16px; line-height: 1.65; }
  .bp-hero-cta { flex-wrap: wrap; gap: 10px; }
  .bp-hero-cta .btn { padding: 10px 14px; font-size: 11px; }

  /* Compare overlay */
  .cmp-shell { padding: 16px 12px 60px; }
  .cmp-head { margin-bottom: 20px; padding-bottom: 16px; }
  .cmp-head-copy h2 { font-size: 22px; }
  .cmp-grid { --label-w: 110px; }
  .cmp-row-label { font-size: 10px; padding-right: 8px; }
  .cmp-row-cell { padding: 10px 8px; font-size: 13px; }
  .cmp-col-name { font-size: 15px; }
  .cmp-col-sub { font-size: 11px; }

  /* Compare tray */
  .compare-tray { right: 8px; bottom: 8px; left: 8px; }
  .compare-tray-inner { flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 10px 12px; }
  .compare-tray-actions { flex: 1; justify-content: flex-end; }
  .compare-tray-actions .btn { padding: 8px 12px; font-size: 11px; }
  .compare-tray-count { font-size: 18px; }
  .compare-slot { width: 40px; height: 40px; }

  /* Library note */
  .library-note { margin: 0 0 24px; padding: 16px 18px; }
  .library-note p { font-size: 13.5px; line-height: 1.55; }

  /* Share widget */
  .share { flex-wrap: wrap; padding: 6px; }
  .share-btn { padding: 7px 10px; font-size: 11.5px; }

  /* Footer */
  .footer { padding: 40px 16px; }
  .source-list li { grid-template-columns: 1fr; gap: 6px; }
  .source-num { font-size: 28px; }
}


@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* focus states */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2.5px solid var(--shu);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   BREED PROFILE — full-page encyclopedia entry
   ============================================================ */
.breed-page {
  position: fixed;
  top: 66px; /* clears the sticky nav */
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--kinari);
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}
@media (max-width: 640px) {
  .breed-page { top: 84px; } /* nav wraps to 2 rows on very narrow screens */
}
body.bp-open { overflow: hidden; }

.bp {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}
.bp-hero {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1.5px solid var(--sumi);
  margin-bottom: 48px;
  align-items: center;
}
.bp-hero-photo {
  aspect-ratio: 1;
  border: 1.5px solid var(--sumi);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.bp-hero-photo .illust-frame { position: absolute; inset: 0; }
.bp-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ash);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.bp-title {
  font-family: var(--display);
  font-size: clamp(48px, 6vw, 88px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin-bottom: 20px;
}
.bp-lede {
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  line-height: 1.4;
  color: var(--sumi-2);
  margin-bottom: 32px;
}
.bp-hero-cta { display: flex; gap: 12px; }

.bp-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: start;
}
.bp-side {
  position: sticky;
  top: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.bp-side-card {
  border: 1.5px solid var(--sumi);
  background: var(--kinari-2);
  padding: 24px;
}
.bp-side-card h4 {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ash);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.bp-side-card dl {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bp-side-card dl > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dotted var(--border);
}
.bp-side-card dl > div:last-child { border-bottom: 0; }
.bp-side-card dt {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ash);
  align-self: center;
}
.bp-side-card dd {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  color: var(--sumi);
  text-align: right;
}

.bp-traits { display: flex; flex-direction: column; gap: 12px; }
.bp-trait-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.bp-trait-label {
  font-size: 12px;
  color: var(--sumi-2);
}
.bp-trait-value {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ash);
  letter-spacing: 0.06em;
}
.bp-trait-bar {
  position: relative;
  height: 8px;
  background: var(--kinari);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.bp-trait-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--shu), var(--yamabuki));
  border-radius: 999px;
}
.bp-trait-ticks {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  pointer-events: none;
}
.bp-trait-ticks span { border-right: 1px solid rgba(26,26,26,0.15); }
.bp-trait-ticks span:last-child { border-right: 0; }

.bp-toc { border: 1.5px solid var(--sumi); background: var(--kinari-2); padding: 24px; }
.bp-toc h4 {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ash);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.bp-toc-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bp-toc-links a {
  font-family: var(--display);
  font-size: 15px;
  color: var(--sumi-2);
  padding: 4px 0;
  transition: color 0.2s;
}
.bp-toc-links a:hover { color: var(--shu); }

.bp-main {
  max-width: 680px;
}
.bp-section {
  padding: 36px 0;
  border-bottom: 1px solid var(--border);
}
.bp-section:first-child { padding-top: 0; }
.bp-section:last-child { border-bottom: 0; }
.bp-section h2 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 20px;
}
.bp-section h3 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ash);
  margin-bottom: 12px;
}
.bp-section p {
  font-family: var(--body);
  font-size: 17.5px;
  line-height: 1.72;
  color: var(--sumi-2);
  margin-bottom: 18px;
  max-width: 62ch;
}
.bp-section p:first-of-type::first-line { letter-spacing: 0.01em; }
.bp-section p:last-child { margin-bottom: 0; }
.bp-section p strong { color: var(--sumi); font-weight: 600; }

.bp-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bp-bullets li {
  position: relative;
  padding: 10px 0 10px 26px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--sumi-2);
  border-bottom: 1px dotted var(--border);
}
.bp-bullets li:last-child { border-bottom: 0; }
.bp-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 9px;
  height: 9px;
  background: var(--shu);
  transform: rotate(45deg);
}

.bp-callouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.bp-callout {
  padding: 24px;
  border: 1.5px solid var(--sumi);
  background: var(--kinari-2);
}
.bp-callout-good  { border-left: 4px solid var(--wakatake); }
.bp-callout-watch { border-left: 4px solid var(--shu); }
.bp-callout .bp-bullets li { padding: 6px 0 6px 22px; font-size: 14px; border-bottom: 1px dotted var(--border); }
.bp-callout .bp-bullets li:last-child { border-bottom: 0; }
.bp-callout-good  .bp-bullets li::before { background: var(--wakatake); top: 12px; width: 7px; height: 7px; }
.bp-callout-watch .bp-bullets li::before { background: var(--shu); top: 12px; width: 7px; height: 7px; }

.bp-quote {
  font-family: var(--display);
  font-size: 24px;
  font-style: italic;
  line-height: 1.4;
  color: var(--sumi);
  padding: 28px 32px;
  border-left: 4px solid var(--shu);
  background: var(--kinari-2);
  margin: 32px 0;
}
.bp-quote::before {
  content: "“";
  font-size: 40px;
  color: var(--shu);
  vertical-align: -12px;
  margin-right: 6px;
}

.bp-sources p {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ash);
  line-height: 1.7;
}

@media (max-width: 900px) {
  .bp { padding: 24px 20px 60px; }
  .bp-hero { grid-template-columns: 1fr; gap: 32px; padding-bottom: 32px; margin-bottom: 32px; }
  .bp-hero-photo { max-width: 360px; }
  .bp-body { grid-template-columns: 1fr; }
  .bp-side { position: static; }
  .bp-callouts { grid-template-columns: 1fr; }
}
