/* ============================================================
   belnom.com — styles.css
   Dreamy direction. Design tokens + components + page recipes.
   ============================================================ */

/* Outfit, self-hosted (variable, weights 400–700) so there's no render-blocking
   third-party request to fonts.googleapis.com / fonts.gstatic.com. Files in
   public/fonts/; the latin subset is preloaded in header.ejs. */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/outfit-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/outfit-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Tokens --- */
:root {
  /* Surfaces */
  --color-bg-base: #FFF8F3;
  --gradient-bg: linear-gradient(180deg, #FDE7E7 0%, #F2E6FA 100%);
  --color-surface: rgba(255, 255, 255, 0.7);
  --color-surface-solid: #FFFFFF;
  --color-overlay: rgba(255, 255, 255, 0.5);

  /* Accent + ink */
  --color-accent: #FFB8C8;
  --color-accent-secondary: #B596C8;
  --color-ink: #3D2B4F;
  --color-ink-muted: #6B5A78;
  --color-ink-on-accent: #FFFFFF;
  --color-purple: #7E4A8B;
  --color-purple-hover: #6B3D78;

  /* States */
  --color-focus-ring: #B596C8;
  --color-error-bg: #FFE0E5;
  --color-error-text: #8B3955;

  /* Typography */
  --font-sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.5rem;
  --text-hero: 3rem;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.08em;
  --tracking-wider: 0.12em;
  --leading-tight: 1.05;
  --leading-snug: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* Space (4-base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(125, 74, 139, 0.05);
  --shadow-md: 0 4px 12px rgba(125, 74, 139, 0.10);
  --shadow-lg: 0 12px 32px rgba(125, 74, 139, 0.14);
  --shadow-glow: 0 0 24px rgba(255, 184, 200, 0.4);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 220ms;
  --duration-slow: 350ms;

  /* Layout */
  --container-max: 1100px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Base --- */
/* scroll-padding-top offsets fragment/anchor navigation so the target clears the
   sticky header (.nav). Mobile collapses search to a 2nd row, so the header is
   taller there and needs a larger offset. */
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
@media (max-width: 767px) { html { scroll-padding-top: 10rem; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  background: var(--gradient-bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; }

h1, h2, h3, h4 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p { line-height: var(--leading-relaxed); }
strong { font-weight: var(--weight-semibold); }
a { transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--color-purple); }

/* --- Layout helpers --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.stack > * + * { margin-top: var(--space-4); }
.text-center { text-align: center; }
.text-muted { color: var(--color-ink-muted); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--color-purple);
  color: white;
  padding: var(--space-3) var(--space-5);
  border-radius: 0 0 var(--radius-md) 0;
  font-weight: var(--weight-semibold);
  transform: translateY(-100%);
  transition: transform var(--duration-fast) var(--ease-out);
  z-index: 1000;
}
.skip-link:focus-visible { transform: translateY(0); color: white; }

/* ============================================================
   Components
   ============================================================ */

/* --- Pill --- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface);
  color: var(--color-ink);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
  cursor: pointer;
}
.pill:hover {
  background: var(--color-surface-solid);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--color-ink);
}
.pill--accent {
  background: var(--color-accent);
  color: var(--color-ink);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-size: var(--text-xs);
}
.pill--accent:hover { background: var(--color-accent); transform: none; }

/* --- Card --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition:
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--space-3) var(--space-5);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
  text-decoration: none;
}
.btn-primary {
  background: var(--color-purple);
  color: var(--color-ink-on-accent);
}
.btn-primary:hover {
  background: var(--color-purple-hover);
  color: var(--color-ink-on-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--color-ink);
}
.btn-ghost:hover {
  background: var(--color-surface);
  color: var(--color-purple);
}

/* --- Inputs --- */
.input {
  background: var(--color-surface-solid);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: var(--space-3) var(--space-5);
  font: inherit;
  color: var(--color-ink);
  width: 100%;
  transition: box-shadow var(--duration-fast) var(--ease-out);
}
.input::placeholder { color: var(--color-ink-muted); }
.input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(181, 150, 200, 0.4);
}
.input-group {
  display: flex;
  background: var(--color-surface-solid);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  margin: 0 auto;
}
.input-group .input {
  flex: 1;
  background: transparent;
  padding: var(--space-2) 0;
  box-shadow: none;
}
.input-group .input:focus { box-shadow: none; }
.input-group .btn {
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
}

/* --- Nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}
@supports not (backdrop-filter: blur(8px)) {
  .nav { background: rgba(255, 248, 243, 0.92); }
}
.nav-inner {
  position: relative;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--color-purple);
  letter-spacing: var(--tracking-tight);
}
.nav-logo:hover { color: var(--color-purple-hover); }
.nav-logo-icon {
  width: 1.5em;
  height: 1.5em;
  display: block;
  flex-shrink: 0;
}
/* Nav links are collapsed behind the hamburger at ALL widths (not just mobile)
   so the header stays compact and leaves room for the search bar. */
.nav-links {
  position: absolute;
  top: 100%;
  right: var(--space-3);
  background: var(--color-surface-solid);
  border-radius: var(--radius-lg);
  flex-direction: column;
  align-items: stretch;
  padding: var(--space-3);
  box-shadow: var(--shadow-lg);
  gap: var(--space-1);
  min-width: 180px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  display: none;
}
.nav-links.open { display: flex; }
.nav-links a {
  color: var(--color-ink);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition:
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}
.nav-links a:hover {
  background: var(--color-surface);
  color: var(--color-purple);
}
/* Hamburger is always visible now — the nav links live behind it at every
   width (see .nav-links above). */
.nav-toggle {
  display: inline-flex;
  background: transparent;
  border: none;
  padding: var(--space-2);
  color: var(--color-ink);
  font-size: 1.25rem;
}

/* --- Site footer --- */
.site-footer {
  margin-top: var(--space-16);
  padding: var(--space-10) 0 var(--space-8);
  background: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.6);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  justify-content: center;
  margin-bottom: var(--space-3);
}
.footer-links a {
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}
.footer-links a:hover { color: var(--color-purple); }
.copyright {
  text-align: center;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}


/* ============================================================
   Listing pages — split view + floating letters
   ============================================================ */
.page-listing {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
}
.page-listing > h1 {
  font-size: var(--text-2xl);
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
}
.page-listing > .lead {
  color: var(--color-ink-muted);
  margin-bottom: var(--space-8);
  font-size: var(--text-sm);
}

.listing-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}
@media (min-width: 768px) {
  .listing-split {
    grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
    gap: var(--space-8);
  }
}

.listing-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.listing-section {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--space-3);
  align-items: start;
}
.listing-letter {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  opacity: 0.85;
  line-height: 1;
  letter-spacing: var(--tracking-tight);
}
.listing-names {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.listing-names li { padding: 0; }

/* Enriched A–Z list: each name keeps the list layout but gains its meaning and
   rank inline below, so the substantive content lives in the HTML rather than
   behind a JS fetch. */
.listing-top-section {
  margin-bottom: var(--space-6);
}
.listing-rank-heading {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-4);
}
.listing-az-heading {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-4);
}
.listing-ranked {
  list-style: none;
  margin: 0;
  padding: 0;
}
.name-row .name-link {
  padding-bottom: var(--space-1);
}
.name-row-meaning {
  display: block;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}
.name-row-rank {
  display: block;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  margin-top: 2px;
}
.name-link {
  display: block;
  padding: var(--space-2) 0;
  color: var(--color-ink);
  font-weight: var(--weight-medium);
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  border-left: 2px solid transparent;
  padding-left: 0;
  transition:
    color var(--duration-fast) var(--ease-out),
    padding-left var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}
.name-link:hover {
  color: var(--color-purple);
  padding-left: var(--space-2);
}
.name-link.active {
  color: var(--color-purple);
  border-left-color: var(--color-accent);
  padding-left: var(--space-2);
  font-weight: var(--weight-semibold);
}

/* --- Pet listing --- */
.pet-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
}
.pet-filter-btn {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}
.pet-filter-btn:hover {
  background: var(--color-surface-solid);
  color: var(--color-purple);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.pet-filter-btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}
.pet-filter-btn.is-active {
  background: var(--color-purple);
  color: var(--color-ink-on-accent);
  border-color: transparent;
  font-weight: var(--weight-semibold);
}
.pet-filter-btn.is-active:hover {
  background: var(--color-purple-hover);
  color: var(--color-ink-on-accent);
}
/* A pet-name <li> stacks the clickable name over its short description.
   The description is rendered as visible text (crawlable for SEO); clicking
   the name still opens the detail panel with the same description + votes. */
.pet-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-1) 0;
}
.pet-name .name-link { padding: var(--space-1) 0; }
.pet-name-desc {
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

/* --- Detail panel --- */
.listing-detail {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
}
@media (min-width: 768px) {
  .listing-detail {
    position: sticky;
    top: calc(var(--space-16) + var(--space-3));
    align-self: start;
    min-height: 240px;
    max-height: calc(100vh - var(--space-16) - var(--space-6));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
.listing-detail .empty-state {
  text-align: center;
  color: var(--color-ink-muted);
  font-size: var(--text-base);
  padding: var(--space-6) 0;
}
.listing-detail .name-display {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  margin: var(--space-2) 0;
}
.listing-detail .divider {
  width: 32px;
  height: 1px;
  background: var(--color-accent);
  margin: var(--space-3) 0;
}
.listing-detail .meaning {
  font-size: var(--text-lg);
  color: var(--color-ink);
  margin: var(--space-3) 0 var(--space-4);
}
.listing-detail .gender-pill {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: rgba(255, 255, 255, 0.7);
  color: var(--color-purple);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.listing-detail.is-loading { opacity: 0.5; transition: opacity var(--duration-fast); }
.listing-description {
  max-width: 720px;
  margin: var(--space-10) auto var(--space-8);
  color: var(--color-ink);
}
.listing-description h2 {
  font-size: var(--text-xl);
  color: var(--color-purple);
  margin-bottom: var(--space-4);
}
.listing-description h3,
.listing-description h2.find-more-heading {
  font-size: var(--text-lg);
  color: var(--color-purple);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}
.listing-description p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}
.listing-description .links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.listing-description .links-grid a {
  display: block;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: var(--text-sm);
  color: var(--color-ink);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.listing-description .links-grid a:hover {
  background: var(--color-surface-solid);
  color: var(--color-purple);
}
.listing-description .list_org {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
}
.listing-description .list_org ul {
  list-style: disc;
  padding-left: var(--space-5);
}
.listing-description .list_org li {
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}
.listing-description .list_org a { color: var(--color-purple); }
.listing-description .list_org a:hover { color: var(--color-purple-hover); text-decoration: underline; }

/* ============================================================
   Bottom sheet (mobile only) — listing-detail in mobile mode
   ============================================================ */
@media (max-width: 767px) {
  .listing-detail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 200;
    margin: 0;
    border-radius: 0;
    background: var(--gradient-bg);
    transform: translateY(100%);
    transition: transform var(--duration-slow) var(--ease-out);
    box-shadow: 0 -8px 32px rgba(125, 74, 139, 0.18);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-6) var(--space-5) var(--space-20, 5rem);
  }
  .listing-detail.sheet-open {
    transform: translateY(0);
  }
  .listing-detail::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-accent);
    margin: 0 auto var(--space-4);
    opacity: 0.6;
  }
  .listing-detail .empty-state { display: none; }
  .listing-detail.sheet-open .empty-state { display: block; }
}

/* Sheet lock — prevent body scroll while sheet open */
.sheet-lock {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Backdrop — real DOM element created by JS, sibling of body */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 79, 0.4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
}
.sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 768px) {
  .sheet-backdrop { display: none !important; }
}

/* Sheet close button — visible only on mobile when sheet is open */
.sheet-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(255, 255, 255, 0.75);
  color: var(--color-ink);
  font-size: 1.1rem;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
  transition: background var(--duration-fast) var(--ease-out);
}
.sheet-close:hover,
.sheet-close:focus-visible {
  background: var(--color-surface-solid);
}
@media (max-width: 767px) {
  .listing-detail.sheet-open .sheet-close {
    display: inline-flex;
  }
}

/* ============================================================
   Animations
   ============================================================ */
.fade-in {
  animation: fade-in var(--duration-slow) var(--ease-out);
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.listing-detail > *:not(.empty-state) {
  animation: detail-in var(--duration-normal) var(--ease-out);
}
@keyframes detail-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Home — hero, category cards, pill sections
   ============================================================ */
.hero {
  padding: var(--space-16) 0 var(--space-12);
}
.hero .container { text-align: center; }
.hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-3);
}
.hero-accent {
  background: linear-gradient(135deg, var(--color-purple) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero-lead {
  font-size: var(--text-lg);
  color: var(--color-ink-muted);
  margin-bottom: var(--space-6);
}
.hero-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  max-width: 600px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .hero-cards { grid-template-columns: repeat(4, 1fr); }
}
.cat-card {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  text-decoration: none;
  color: var(--color-ink);
  transition:
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}
.cat-card:hover {
  background: var(--color-surface-solid);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: var(--color-purple);
}
.cat-emoji { font-size: 2rem; }
.cat-title { font-weight: var(--weight-semibold); font-size: var(--text-lg); }
.cat-sub { font-size: var(--text-xs); color: var(--color-ink-muted); }

.browse-sections {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.browse-section {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}
.browse-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-2);
}
.browse-header h2 {
  font-size: var(--text-lg);
  color: var(--color-purple);
  font-weight: var(--weight-bold);
  letter-spacing: 0;
}
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.pill-grid .pill {
  text-transform: none;
  letter-spacing: 0;
}

/* ============================================================
   Name detail standalone page
   ============================================================ */
.name-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
  text-align: center;
}
.name-page-header,
.listing-detail-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.name-page-header > :first-child,
.listing-detail-header > :first-child {
  grid-column: 1;
  justify-self: start;
}
.name-page-header > .save-btn,
.listing-detail-header > .save-btn {
  grid-column: 2;
  justify-self: center;
  margin-top: 0;
}
@media (max-width: 540px) {
  .name-page-header,
  .listing-detail-header {
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .name-page-header > :first-child,
  .listing-detail-header > :first-child {
    justify-self: auto;
  }
}
.name-page .name-display {
  font-size: var(--text-3xl);
  margin: var(--space-3) 0 var(--space-5);
}
.name-page .name-display {
  text-align: left;
}
.name-page .name-fact,
.listing-detail .name-fact {
  font-size: var(--text-lg);
  color: var(--color-ink);
  margin: 0;
}
.name-page .divider {
  width: 32px;
  height: 1px;
  background: var(--color-accent);
  margin: var(--space-4) auto;
}
.name-page .meaning-label,
.listing-detail .meaning-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-ink-muted);
  font-weight: var(--weight-semibold);
  margin: var(--space-3) 0 var(--space-3);
}
.name-page .meaning-label { text-align: center; }
.name-page .meaning {
  font-size: var(--text-lg);
  max-width: 50ch;
  margin: 0 auto var(--space-4);
}
.name-page .gender-pill {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: rgba(255, 255, 255, 0.7);
  color: var(--color-purple);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.name-page .back-link {
  margin-top: 0;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  text-align: left;
}
.name-page .back-link a { color: var(--color-ink-muted); }
.name-page .back-link a:hover { color: var(--color-purple); }

/* ============================================================
   Search page
   ============================================================ */
.search-page {
  padding: var(--space-12) var(--space-5);
  text-align: center;
}
.search-title {
  font-size: clamp(2rem, 5vw, 2.5rem);
  margin-bottom: var(--space-2);
}
.search-lead {
  color: var(--color-ink-muted);
  margin-bottom: var(--space-6);
}
.search-input-group {
  margin: 0 auto var(--space-8);
}
.search-suggestions {
  margin-top: var(--space-6);
  text-align: center;
}
.search-suggestions .pill-grid { justify-content: center; }
.search-suggestions .pill {
  border: none;
  cursor: pointer;
}

/* ============================================================
   Static pages (terms, cookie, contact, 404, error)
   ============================================================ */
.static-page {
  max-width: 65ch;
  margin: 0 auto;
  padding: var(--space-12) var(--space-5);
}
.static-page h1 {
  font-size: var(--text-2xl);
  color: var(--color-purple);
  margin-bottom: var(--space-4);
}
.static-page h2 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--color-purple);
}
.static-page p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}
.static-page ul {
  list-style: disc;
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.error-page {
  text-align: center;
  padding: var(--space-16) var(--space-5);
}
.error-page .error-emoji { font-size: 4rem; margin-bottom: var(--space-4); }
.error-page h1 { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
.error-page p { color: var(--color-ink-muted); margin-bottom: var(--space-6); }

/* ============================================================
   A11y polish
   ============================================================ */
.name-link:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
}
.pill:focus-visible,
.cat-card:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* Keep transition noise out of aria-live region content — but allow the
   region itself (e.g., bottom sheet container) to animate. */
[aria-live] > *:not(.empty-state) { transition: none; }

/* High contrast support */
@media (prefers-contrast: more) {
  :root {
    --color-ink-muted: #5A4570;
  }
  .name-link, .pill, .btn { border: 1px solid var(--color-ink); }
}

/* ============================================================
   Responsive refinements
   ============================================================ */

/* Touch devices — disable lift/glow effects that stick on tap */
@media (hover: none) {
  .pill:hover,
  .card:hover,
  .cat-card:hover,
  .btn-primary:hover,
  .browse-section:hover {
    transform: none;
    box-shadow: none;
  }
  .name-link:hover {
    padding-left: 0;
    color: var(--color-ink);
  }
}

/* Small mobile (< 480px) — tighter spacing */
@media (max-width: 479px) {
  .container { padding: 0 var(--space-4); }
  .hero { padding: var(--space-10) 0 var(--space-8); }
  .hero-lead { font-size: var(--text-base); }
  .browse-section { padding: var(--space-5) var(--space-4); }
  .browse-sections { gap: var(--space-5); padding-bottom: var(--space-8); }
  .page-listing { padding: var(--space-6) var(--space-4); }
  .listing-list { gap: var(--space-5); }
  .listing-section { gap: var(--space-2); }
  .listing-letter { font-size: var(--text-2xl); }
  .name-page { padding: var(--space-6) var(--space-3); }
}

/* Very narrow (< 380px) — stack listing-letter above names */
@media (max-width: 379px) {
  .listing-section {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
  .listing-letter {
    font-size: var(--text-2xl);
    border-bottom: 1px dashed rgba(126, 74, 139, 0.25);
    padding-bottom: var(--space-1);
    margin-bottom: var(--space-1);
  }
  .hero-cards { grid-template-columns: 1fr; gap: var(--space-3); }
  .cat-card { flex-direction: row; justify-content: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
  .cat-emoji { font-size: 1.5rem; }
}

/* Bottom sheet — use dynamic viewport units when available */
@supports (height: 100dvh) {
  @media (max-width: 767px) {
    .listing-detail { max-height: 75dvh; }
  }
}

/* Landscape phones — give the bottom sheet more room */
@media (max-width: 767px) and (max-height: 500px) and (orientation: landscape) {
  .listing-detail {
    max-height: 92vh;
  }
  @supports (height: 100dvh) {
    .listing-detail { max-height: 92dvh; }
  }
}

/* Tablet landscape & up (>= 1024px) — extra breathing room */
@media (min-width: 1024px) {
  .hero { padding: var(--space-20) 0 var(--space-16); }
  .browse-sections { padding-top: var(--space-16); }
  .listing-split { gap: var(--space-12); }
  .listing-letter { font-size: var(--text-hero); }
}

/* Print — clean reading view */
@media print {
  body { background: white; color: black; }
  .nav, .site-footer, .listing-detail, .hero-cards { display: none; }
  .container, .page-listing, .static-page { padding: 0; max-width: 100%; }
  .name-link { color: black; text-decoration: underline; padding-left: 0 !important; border: none !important; }
  .listing-letter { color: black; opacity: 1; }
  .pill { border: 1px solid #999; background: none; }
  a { color: black; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #555; }
  a[href^="/"]::after { content: ""; }
}

/* ============================================================
   Enrichment sections on name detail page
   ============================================================ */
.fact-section {
  margin-top: var(--space-8);
  text-align: left;
}
.fact-section h2 {
  font-size: var(--text-lg);
  color: var(--color-purple);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-5);
}

.fact-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  margin: 0;
}
.fact-grid dt {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
  font-weight: var(--weight-medium);
}
.fact-grid dd {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-ink);
  font-weight: var(--weight-semibold);
}
.fact-grid dd.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
  color: var(--color-purple);
  font-weight: var(--weight-medium);
}

.popularity-card {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.popularity-card strong {
  color: var(--color-purple);
  font-weight: var(--weight-semibold);
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.related-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.related-label {
  flex: 0 0 100%;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-ink-muted);
  font-weight: var(--weight-semibold);
}
@media (min-width: 480px) {
  .related-label { flex: 0 0 90px; }
}
.related-pill {
  text-transform: none;
  letter-spacing: 0;
}

/* ============ Shortlist (name picker) ============ */
/* ============ Shortlist: about / how-it-works / FAQ ============ */
.shortlist-about {
  padding-block: var(--space-16) var(--space-20);
  border-top: 1px solid rgba(125, 74, 139, 0.10);
}
.shortlist-about .prose {
  max-width: 720px;
  margin-inline: auto;
}
.shortlist-about .prose > p {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-ink-muted);
  margin: 0 0 var(--space-5);
}
.shortlist-about h2 {
  font-size: var(--text-2xl);
  color: var(--color-ink);
  letter-spacing: var(--tracking-tight);
  text-align: center;
  margin: var(--space-16) 0 var(--space-8);
}
.shortlist-about h2::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  margin: var(--space-4) auto 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-secondary));
}

/* Home intro + naming guide — prose blocks */
.home-intro {
  padding-block: var(--space-8);
}
.home-guide {
  padding-block: var(--space-12) var(--space-16);
  border-top: 1px solid rgba(125, 74, 139, 0.10);
}
.home-intro .prose,
.home-guide .prose {
  max-width: 720px;
  margin-inline: auto;
}
.home-intro .prose > p,
.home-guide .prose > p {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-ink-muted);
  margin: 0 0 var(--space-5);
}
.home-intro .prose > p:last-child,
.home-guide .prose > p:last-child {
  margin-bottom: 0;
}
.home-guide h2 {
  font-size: var(--text-2xl);
  color: var(--color-ink);
  letter-spacing: var(--tracking-tight);
  text-align: center;
  margin: 0 0 var(--space-8);
}

/* How it works — numbered step cards */
.how-steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}
.how-steps li {
  counter-increment: step;
  position: relative;
  padding: var(--space-5) var(--space-6) var(--space-5) calc(var(--space-16) + var(--space-2));
  background: var(--color-surface-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--color-ink);
  line-height: var(--leading-normal);
  transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out);
}
.how-steps li:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.how-steps li::before {
  content: counter(step);
  position: absolute;
  left: var(--space-5);
  top: var(--space-5);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-secondary));
  color: var(--color-ink-on-accent);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  box-shadow: var(--shadow-sm);
}

/* FAQ — question / answer cards */
.faq {
  margin: 0;
  display: grid;
  gap: var(--space-4);
}
.faq-item {
  background: var(--color-surface-solid);
  border: 1px solid rgba(125, 74, 139, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out);
}
.faq-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.faq-item dt {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-purple);
  letter-spacing: var(--tracking-tight);
}
.faq-item dd {
  margin: 0;
  color: var(--color-ink-muted);
  line-height: var(--leading-relaxed);
}
@media (max-width: 540px) {
  .shortlist-about { padding-block: var(--space-12) var(--space-16); }
  .shortlist-about .prose > p { font-size: var(--text-base); }
  .shortlist-about h2 { font-size: var(--text-xl); margin-top: var(--space-12); }
  .how-steps li { padding-left: calc(var(--space-12) + var(--space-4)); }
  .how-steps li::before { width: 32px; height: 32px; font-size: var(--text-base); }
}

.shortlist-page {
  padding-top: var(--space-8);
  padding-bottom: var(--space-10);
  display: grid;
  gap: var(--space-6);
  position: relative;
}
.shortlist-header h1 {
  font-size: 1.75rem;
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
}
.shortlist-filters {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
}
.swipe-btn--filter { position: relative; }
.filter-count-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--color-purple);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.filter-count-badge[hidden] { display: none; }
.filter-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 460px);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--color-surface-solid);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  animation: filterModalIn 0.18s ease;
}
.filter-modal[hidden] { display: none; }
@keyframes filterModalIn {
  from { opacity: 0; transform: translate(-50%, -46%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}
.filter-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.filter-modal-head h2 {
  margin: 0;
  font-size: var(--text-xl);
}
.filter-modal-close {
  background: var(--color-accent);
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-ink);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.filter-modal .shortlist-filters {
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.filter-modal-done {
  align-self: stretch;
}
.filter-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 79, 0.4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.filter-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
.filter-collapse {
  border: 1px solid #ccc;
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
}
.filter-collapse + .filter-collapse {
  margin-top: var(--space-3);
}
.filter-collapse > summary {
  cursor: pointer;
  font-weight: var(--weight-bold);
  color: var(--color-purple);
  padding: var(--space-3) 0;
  list-style: none;
}
.filter-collapse > summary::-webkit-details-marker { display: none; }
.filter-collapse > summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s ease;
}
.filter-collapse[open] > summary::before { transform: rotate(90deg); }
.filter-collapse[open] { padding-bottom: var(--space-3); }
.origin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.origin-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.origin-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.origin-chip > span {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-overlay);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  color: var(--color-ink);
  text-transform: capitalize;
  transition: all 0.15s ease;
}
.origin-chip input:checked + span {
  background: var(--color-accent);
  color: var(--color-ink);
  border-color: var(--color-accent);
}
.origin-chip input:focus-visible + span {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.swipe-area {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
}
.swipe-card {
  width: 100%;
  max-width: 420px;
  min-height: 280px;
  margin: 0 0 var(--space-5);
  background: var(--color-surface-solid);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-5);
  border: 1px solid rgba(125, 74, 139, 0.08);
  box-shadow:
    0 28px 64px rgba(125, 74, 139, 0.22),
    0 10px 24px rgba(125, 74, 139, 0.13);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.swipe-placeholder {
  color: var(--color-ink-muted);
  font-size: var(--text-lg);
}
.swipe-empty {
  font-style: italic;
}
.swipe-name {
  font-size: var(--text-3xl);
  margin: var(--space-2) 0;
  color: var(--color-purple);
  letter-spacing: var(--tracking-tight);
}
.swipe-origin,
.swipe-gender-line {
  font-size: var(--text-lg);
  color: var(--color-ink-muted);
  text-transform: capitalize;
  margin: 0;
}
.swipe-label {
  font-weight: var(--weight-medium);
  color: var(--color-ink-muted);
  opacity: 0.65;
  text-transform: none;
}
.swipe-meaning {
  font-size: var(--text-base);
  color: var(--color-ink);
  max-width: 32em;
  margin: var(--space-2) 0;
}
.swipe-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-3);
}
.swipe-facts > div {
  text-align: center;
}
.swipe-facts dt {
  font-size: var(--text-xs);
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.swipe-facts dd {
  margin: 0;
  font-weight: var(--weight-bold);
  color: var(--color-ink);
}
.swipe-flash-like { box-shadow: 0 0 0 4px var(--color-accent), var(--shadow-lg); }
.swipe-flash-skip { box-shadow: 0 0 0 4px var(--color-ink-muted), var(--shadow-lg); }

.swipe-actions {
  display: flex;
  gap: var(--space-5);
  align-items: center;
}
.swipe-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  background: var(--color-surface-solid);
  color: var(--color-ink);
}
.swipe-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.swipe-btn:active { transform: translateY(0); }
.swipe-btn--skip { color: var(--color-ink-muted); }
.swipe-btn--like { background: var(--color-accent); color: var(--color-ink-on-accent); }
.swipe-btn--filter { color: var(--color-ink-muted); }
.swipe-btn--filter:hover, .swipe-btn--filter:focus-visible { color: var(--color-purple); }
.swipe-btn--filter svg { display: block; opacity: 0.45; transition: opacity 0.15s ease; }
.swipe-btn--filter:hover svg, .swipe-btn--filter:focus-visible svg { opacity: 1; }
.swipe-hint {
  font-size: var(--text-sm);
  margin: 0;
}

.list-toggle-btn {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 50;
  background: var(--color-purple);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--space-3) var(--space-5);
  font-weight: var(--weight-bold);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.list-toggle-btn[hidden] { display: none; }
.list-toggle-btn:hover { background: var(--color-purple-hover); }
.list-toggle-count {
  background: var(--color-accent);
  color: var(--color-ink);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-2);
  min-width: 1.5em;
  text-align: center;
  font-size: var(--text-sm);
}

.list-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100vw, 420px);
  background: var(--color-surface-solid);
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  animation: slidePanel 0.2s ease;
}
.list-panel[hidden] { display: none; }
@keyframes slidePanel { from { transform: translateX(100%); } to { transform: translateX(0); } }
.list-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
  border-bottom: 1px solid var(--color-overlay);
  background: var(--color-surface-solid);
  position: sticky;
  top: 0;
  z-index: 1;
}
.list-panel-header h2 { margin: 0; font-size: var(--text-xl); }
.list-panel-close {
  background: var(--color-accent);
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-ink);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex-shrink: 0;
}
.list-panel-close:hover,
.list-panel-close:focus-visible {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}
.list-panel-close:active { transform: scale(0.95); }
.list-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 79, 0.4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.list-panel-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
.list-items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
}
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-overlay);
  gap: var(--space-3);
}
.list-item-text { flex: 1; min-width: 0; }
.list-item-text a { color: var(--color-purple); text-decoration: none; }
.list-item-text a:hover { text-decoration: underline; }
.btn-icon {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-ink-muted);
  font-size: 16px;
}
.btn-icon:hover { background: var(--color-overlay); color: var(--color-error-text); }
.list-panel-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-overlay);
  background: var(--color-surface-solid);
}
.list-panel-footer .btn { width: 100%; text-align: center; }
.btn-link {
  background: none;
  border: none;
  color: var(--color-ink-muted);
  text-decoration: underline;
  cursor: pointer;
  padding: var(--space-2);
  font-size: var(--text-sm);
}
.btn-link:hover { color: var(--color-error-text); }
.list-panel-footer .btn-link { grid-column: 1 / -1; }
.is-disabled { opacity: 0.4; pointer-events: none; }

@media (max-width: 540px) {
  .swipe-name { font-size: var(--text-2xl); margin: var(--space-1) 0; }
  .swipe-card { padding: var(--space-6) var(--space-4); min-height: 280px; gap: var(--space-2); }
  .swipe-meaning { margin: var(--space-1) 0; }
  /* Hide the stats row (syllables, length, US peak, numerology) on mobile
     to keep the card focused on the name, origin and meaning. */
  .swipe-facts { display: none; }
  .list-toggle-btn { bottom: var(--space-4); right: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .swipe-card, .swipe-btn, .list-panel { transition: none; animation: none; }
}

/* ============ Print list ============ */
.print-list {
  padding-top: var(--space-8);
  padding-bottom: var(--space-10);
}
.print-header h1 { margin-bottom: var(--space-2); }
.print-meta { margin-bottom: var(--space-4); }
.print-name {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-overlay);
}
.print-name:last-child { border-bottom: none; }
.print-name-header h2 {
  font-size: var(--text-2xl);
  color: var(--color-purple);
  margin: 0 0 var(--space-1) 0;
}
.print-origin {
  color: var(--color-ink-muted);
  text-transform: capitalize;
  margin: 0 0 var(--space-3) 0;
}
.print-meaning { margin: 0 0 var(--space-3) 0; }
.print-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-2) 0 var(--space-3);
}
.print-facts dt { font-weight: var(--weight-bold); color: var(--color-ink-muted); }
.print-facts dd { margin: 0; }

@media print {
  body { background: white; color: black; font-size: 11pt; }
  .nav, .footer, .print-hide,
  .list-toggle-btn, .list-panel { display: none !important; }
  .print-name { page-break-inside: avoid; border-bottom: 1px solid #ccc; }
  .print-name-header h2 { color: black; }
  .print-origin { color: #666; }
  a { color: black; text-decoration: none; }
  .container { max-width: none; padding: 0; }
}

/* ============ Shortlist — dopamine layer ============ */
.swipe-card {
  position: relative;
  cursor: grab;
  user-select: none;
  touch-action: none;
  will-change: transform;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease, background 0.3s ease;
}
.swipe-card.dragging { cursor: grabbing; transition: none; }
.swipe-card.fly-left {
  transform: translate(-140vw, 60px) rotate(-25deg) !important;
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.45s ease;
}
.swipe-card.fly-right {
  transform: translate(140vw, 60px) rotate(25deg) !important;
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.45s ease;
}

/* Gender-tinted gradient on card */
.swipe-card[data-gender="boy"] {
  background: linear-gradient(180deg, #FFFFFF 0%, #E6EDFF 100%);
}
.swipe-card[data-gender="girl"] {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFE4EE 100%);
}
.swipe-card[data-gender="unisex"] {
  background: linear-gradient(180deg, #FFFFFF 0%, #F1E5FF 100%);
}

/* Decision stamps (NOPE / LOVE) during drag */
.swipe-card .decision-stamp {
  position: absolute;
  top: var(--space-6);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: 0.15em;
  padding: var(--space-2) var(--space-4);
  border: 3px solid currentColor;
  border-radius: var(--radius-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}
.swipe-card .decision-stamp--nope {
  right: var(--space-4);
  color: var(--color-ink-muted);
  transform: rotate(15deg);
}
.swipe-card .decision-stamp--love {
  left: var(--space-4);
  color: #E2467A;
  transform: rotate(-15deg);
}
.swipe-card[data-direction="left"] .decision-stamp--nope { opacity: 1; }
.swipe-card[data-direction="right"] .decision-stamp--love { opacity: 1; }

/* Like button glow on hover */
.swipe-btn--like {
  box-shadow: 0 0 0 0 rgba(255, 184, 200, 0.5), var(--shadow-md);
}
.swipe-btn--like:hover {
  box-shadow: 0 0 0 8px rgba(255, 184, 200, 0.3), var(--shadow-lg);
}

/* Count badge pulse */
@keyframes count-pop {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.45); background: var(--color-accent-secondary); }
}
.list-toggle-count.pulse { animation: count-pop 0.35s var(--ease-out); }

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 9px;
  height: 13px;
  border-radius: 2px;
  top: 50%;
  left: 50%;
  animation: confetti-burst 1.1s cubic-bezier(0.15, 0.6, 0.5, 1) forwards;
}
@keyframes confetti-burst {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(0.6);
    opacity: 0;
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--space-10) + 4rem);
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--color-purple);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s var(--ease-out), opacity 0.3s ease;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .swipe-card,
  .swipe-card.fly-left,
  .swipe-card.fly-right { transition: opacity 0.15s ease; }
  .swipe-card.fly-left,
  .swipe-card.fly-right { transform: none !important; }
  .confetti-piece { display: none; }
  .toast { transition: opacity 0.2s ease; }
  .list-toggle-count.pulse { animation: none; }
}

/* Home: inline search result below hero form */
.hero-result {
  margin-top: var(--space-8);
  background: var(--color-surface-solid);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow-md);
  text-align: left;
}
.hero-result .name-page { margin: 0; }
@media (max-width: 540px) {
  .hero-result { padding: var(--space-5) var(--space-4); }
}

/* ============ Global save-to-list ============ */
.saved-badge {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 50;
  background: var(--color-purple);
  color: white;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: background 0.15s ease, transform 0.15s ease;
}
.saved-badge[hidden] { display: none; }
.saved-badge:hover {
  background: var(--color-purple-hover);
  color: white;
  transform: translateY(-1px);
}
.saved-badge-icon { color: var(--color-accent); }
.saved-badge-count {
  background: var(--color-accent);
  color: var(--color-ink);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-2);
  min-width: 1.5em;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.saved-badge.pulse { animation: count-pop 0.35s var(--ease-out); }
@media (max-width: 540px) {
  .saved-badge { bottom: var(--space-4); right: var(--space-4); }
}

.save-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface-solid);
  color: var(--color-ink);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  margin-top: var(--space-4);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.save-btn:hover {
  background: var(--color-accent);
  color: var(--color-ink-on-accent);
}
.save-btn[aria-pressed="true"] {
  background: var(--color-accent);
  color: var(--color-ink);
  border-color: var(--color-accent);
}
.save-btn[aria-pressed="true"] .save-icon { color: #E2467A; }
.save-btn .save-icon { font-size: var(--text-lg); line-height: 1; }
.save-btn.flash-saved { animation: save-pop 0.3s ease; }
@keyframes save-pop {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.12); }
}

.name-history {
  width: 100%;
  margin-top: var(--space-10, 2.5rem);
  text-align: left;
}

.name-history h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-4, 1rem);
  color: var(--color-text, inherit);
  text-align: left;
}

.name-history p {
  line-height: 1.7;
  margin-bottom: var(--space-3, 0.75rem);
  text-align: left;
}

.name-history p:last-child {
  margin-bottom: 0;
}


/* ============ Vote cluster (in list panel) ============ */
.list-item { gap: var(--space-2); align-items: flex-start; }
.vote-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
}
.vote-cluster {
  display: inline-flex;
  gap: var(--space-2);
}
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-overlay);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-ink);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.vote-btn:hover { background: var(--color-surface-solid); transform: translateY(-1px); }
.vote-btn:active { transform: scale(0.95); }
.vote-btn--like:hover { background: #DBF3D4; }
.vote-btn--like.is-active {
  background: #C4EAB9;
  border-color: #6BA85A;
  color: #2F6B3B;
}
.vote-btn--dislike:hover { background: #FFE0E5; }
.vote-btn--dislike.is-active {
  background: #FFC4CF;
  border-color: #C25A75;
  color: #8B3955;
}
.vote-icon { font-size: 14px; line-height: 1; }
.vote-count { font-weight: var(--weight-bold); min-width: 1em; text-align: right; }
.vote-voters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  max-width: 240px;
}
.voter-chip {
  font-size: var(--text-xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-overlay);
  color: var(--color-ink-muted);
  white-space: nowrap;
}
.voter-chip--like { background: #E7F6E2; color: #2F6B3B; }
.voter-chip--dislike { background: #FFE0E5; color: #8B3955; }

/* Flash when save button blocked by 15-cap */
.save-btn.flash-full {
  animation: save-shake 0.5s ease;
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border-color: var(--color-error-text);
}
@keyframes save-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Voter bar inside the shortlist panel */
.voter-bar {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-overlay);
  background: rgba(255, 232, 240, 0.4);
}
.voter-bar:empty { display: none; }
.voter-bar-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.voter-bar-summary strong {
  color: var(--color-purple);
  font-weight: var(--weight-bold);
}
.voter-bar-change {
  margin-left: auto;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}
.voter-bar-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.voter-bar-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.voter-bar-row {
  display: flex;
  gap: var(--space-2);
}
.voter-bar-input {
  flex: 1;
  min-width: 0;
}
.voter-bar-submit { flex-shrink: 0; }
.voter-bar-error {
  font-size: var(--text-sm);
  color: var(--color-error-text);
  margin: 0;
}
.flash-needed {
  animation: voter-pulse 0.7s ease;
  outline: 2px solid var(--color-accent);
}
@keyframes voter-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 184, 200, 0); }
  50% { box-shadow: 0 0 0 8px rgba(255, 184, 200, 0.6); }
}

/* Hero feature CTA on home */
.hero-feature {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: 560px;
  margin: var(--space-6) auto var(--space-8);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, #FFE0EA 0%, #F2E6FA 100%);
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: var(--color-ink);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-md);
  text-align: left;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}
.hero-feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, #FFD3E1 0%, #ECDAF7 100%);
  color: var(--color-ink);
}
.hero-feature-burst {
  font-size: 2rem;
  flex-shrink: 0;
  display: inline-block;
  animation: feature-sparkle 2.4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes feature-sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  20% { transform: scale(1.15) rotate(-8deg); }
  60% { transform: scale(0.95) rotate(8deg); }
}
.hero-feature-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-feature-text strong {
  font-size: var(--text-lg);
  color: var(--color-purple);
  font-weight: var(--weight-bold);
}
.hero-feature-sub {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
  line-height: var(--leading-snug);
}
.hero-feature-arrow {
  font-size: var(--text-2xl);
  color: var(--color-purple);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.hero-feature:hover .hero-feature-arrow { transform: translateX(4px); }
@media (max-width: 540px) {
  .hero-feature { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .hero-feature-burst { font-size: 1.5rem; }
  .hero-feature-text strong { font-size: var(--text-base); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-feature-burst { animation: none; }
  .hero-feature, .hero-feature-arrow { transition: none; }
}

/* Swipe progress + streak chip */
.swipe-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.swipe-streak {
  background: linear-gradient(135deg, #FFB8C8 0%, #FFD085 100%);
  color: var(--color-ink);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
@keyframes streak-pop {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.2) rotate(-4deg); }
  70% { transform: scale(0.95) rotate(2deg); }
}
.swipe-streak.pop { animation: streak-pop 0.45s var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  .swipe-streak.pop { animation: none; }
}

/* Shortlist panel — sort/group filters + group headings */
.list-filters {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-overlay);
  background: rgba(255, 255, 255, 0.5);
}
.list-filter {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.list-filter > span {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-accent-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.list-filter select.input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-accent-secondary) !important;
  background: rgba(255, 255, 255, 0.85);
  font-weight: var(--weight-semibold);
  -webkit-appearance: menulist;
  appearance: menulist;
}
.list-filter select.input option {
  color: var(--color-ink);
  background: var(--color-surface-solid);
}
.list-group-heading {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-accent-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-bottom: 1px solid var(--color-overlay);
  padding-bottom: var(--space-1);
}
.list-group-heading:first-child { margin-top: 0; }

/* Combined Download dropdown in the shortlist panel footer */
.download-menu {
  position: relative;
}
.download-menu-toggle {
  width: 100%;
  text-align: center;
}
.download-menu-items {
  position: absolute;
  bottom: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  background: var(--color-surface-solid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  z-index: 10;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-overlay);
}
.download-menu-items[hidden] { display: none; }
.download-menu-items a {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--color-ink);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: left;
  text-decoration: none;
  transition: background 0.12s ease;
}
.download-menu-items a:hover,
.download-menu-items a:focus-visible {
  background: var(--color-overlay);
  color: var(--color-purple);
}
.download-menu-items a.is-disabled { opacity: 0.4; pointer-events: none; }

/* Anticipation loader + reveal animations for the swipe card */
.swipe-loader {
  display: flex;
  gap: 10px;
  margin-bottom: var(--space-3);
}
.loader-dot {
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  border-radius: 50%;
  animation: loader-pulse 1s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(255, 184, 200, 0.5);
}
.loader-dot:nth-child(2) { animation-delay: 0.15s; background: var(--color-accent-secondary); }
.loader-dot:nth-child(3) { animation-delay: 0.3s; background: var(--color-purple); }
@keyframes loader-pulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.25); }
}
.loader-text {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
  font-weight: var(--weight-semibold);
  margin: 0;
  letter-spacing: 0.02em;
  animation: loader-text-fade 1.4s ease-in-out infinite;
}
@keyframes loader-text-fade {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Simple fade-in for the new card content when it lands. The dramatic
   anticipation lives in the loader/wait phase, not on the reveal itself.
   We exclude the LOVE/NOPE stamps so they stay hidden by default. */
.swipe-card.revealing > *:not(.decision-stamp) {
  animation: card-content-fade 0.25s ease both;
}
@keyframes card-content-fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .loader-dot, .loader-text { animation: none; }
  .swipe-card.revealing > *:not(.decision-stamp) { animation: none; }
  .swipe-card.revealing .swipe-name,
  .swipe-card.revealing .swipe-gender-line,
  .swipe-card.revealing .swipe-origin,
  .swipe-card.revealing .swipe-meaning,
  .swipe-card.revealing .swipe-facts { animation: none; }
}

/* Anticipation animation layer (centered on the swipe card) */
.anticipation-layer {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  width: 0;
  height: 0;
  transition: opacity 0.25s ease;
}
.anticipation-layer.fade-out { opacity: 0; }
.particle {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  animation: particle-orbit 1.4s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
  will-change: transform, opacity;
  transform-origin: center;
}
@keyframes particle-orbit {
  0% {
    transform: translate(var(--sx), var(--sy)) scale(0) rotate(0deg);
    opacity: 0;
  }
  18% {
    opacity: 1;
    transform: translate(var(--sx), var(--sy)) scale(1) rotate(calc(var(--rot) * 0.2));
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--ex), var(--ey)) scale(0.65) rotate(var(--rot));
    opacity: 0;
  }
}
.particle--rect {
  width: 10px;
  height: 14px;
  border-radius: 2px;
}
.particle--bubble {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), rgba(181, 150, 200, 0.45) 60%, rgba(126, 74, 139, 0.2));
  box-shadow: inset 0 0 4px rgba(255,255,255,0.7);
}

@media (prefers-reduced-motion: reduce) {
  .anticipation-layer { display: none; }
  .particle { animation: none; }
}

.name-history--preview h2 {
  font-size: 1.25rem;
}

.history-read-more {
  display: inline-block;
  margin-top: var(--space-2, 0.5rem);
  padding: 0;
  font: inherit;
  font-weight: var(--weight-semibold, 600);
  color: var(--color-accent, currentColor);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.history-read-more:hover {
  text-decoration: underline;
}

.name-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2, 0.5rem);
  margin: var(--space-3, 0.75rem) 0 var(--space-4, 1rem);
}

.origin-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2, 0.5rem);
}

/* Modal-mode panel for /shortlist and home search.
   Desktop: centered modal with backdrop.
   Mobile: existing bottom-sheet (mobile @media for .listing-detail wins). */
@media (min-width: 768px) {
  .listing-detail.listing-detail--modal {
    position: fixed;
    top: 50%;
    left: 50%;
    bottom: auto;
    right: auto;
    align-self: auto;
    transform: translate(-50%, -50%) scale(0.96);
    width: min(640px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    background: var(--gradient-bg);
    text-align: left;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(125, 74, 139, 0.3);
    transition:
      transform var(--duration-slow) var(--ease-out),
      opacity var(--duration-slow) var(--ease-out);
    margin: 0;
    padding: var(--space-6);
    min-height: auto;
  }
  .listing-detail.listing-detail--modal.sheet-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
  body.modal-open .sheet-backdrop {
    display: block !important;
  }
  .listing-detail.listing-detail--modal.sheet-open .sheet-close {
    display: inline-flex;
    background: rgba(125, 74, 139, 0.12);
  }
  .listing-detail.listing-detail--modal .sheet-close:hover,
  .listing-detail.listing-detail--modal .sheet-close:focus-visible {
    background: rgba(125, 74, 139, 0.22);
  }
}

.listing-filter {
  margin-bottom: var(--space-5, 1.25rem);
}
.listing-filter-input {
  width: 100%;
  max-width: 420px;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
}
.listing-filter-empty {
  margin-top: var(--space-3, 0.75rem);
  font-size: var(--text-sm, 0.875rem);
}

/* --- Language switcher --- */
.lang-switch { display: inline-flex; gap: 0.25rem; align-items: center; font-size: 0.875rem; margin-left: 1rem; }
.lang-switch a { text-decoration: none; opacity: 0.7; padding: 0.125rem 0.375rem; border-radius: 4px; color: inherit; }
.lang-switch a[aria-current="true"] { opacity: 1; font-weight: 600; }
.lang-switch a:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }

/* --- Contact card --- */
.contact-card {
  max-width: 560px;
  margin: var(--space-12, 3rem) auto;
  padding: var(--space-10, 2.5rem) var(--space-8, 2rem);
  text-align: center;
  background: var(--color-surface-solid, #fff);
  border-radius: 24px;
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.08));
  position: relative;
  overflow: hidden;
}
.contact-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--color-purple, #7E4A8B), var(--color-accent, #FF8FA8));
}
.contact-card-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(126, 74, 139, 0.12), rgba(255, 143, 168, 0.16));
  color: var(--color-purple, #7E4A8B);
  font-size: 2rem;
  margin-bottom: var(--space-4, 1rem);
}
.contact-card-title {
  margin: 0 0 var(--space-3, 0.75rem);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
}
.contact-card-lead {
  margin: 0 auto var(--space-6, 1.5rem);
  max-width: 44ch;
  color: var(--color-ink-muted, #5a5466);
  line-height: 1.55;
}
.contact-card-email {
  display: inline-block;
  padding: var(--space-3, 0.75rem) var(--space-7, 1.75rem);
  background: var(--color-purple, #7E4A8B);
  color: white;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 6px 16px rgba(126, 74, 139, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.contact-card-email:hover {
  transform: translateY(-1px);
  background: var(--color-purple-hover, #6A3F76);
  box-shadow: 0 10px 22px rgba(126, 74, 139, 0.32);
  color: white;
}
.contact-card-note {
  margin: var(--space-5, 1.25rem) 0 0;
  font-size: 0.875rem;
}
@media (max-width: 480px) {
  .contact-card { margin: var(--space-6, 1.5rem) var(--space-3, 0.75rem); padding: var(--space-7, 1.75rem) var(--space-5, 1.25rem); }
}

/* Mobile: pull each page's title up toward the sticky topbar so the
   content below (filters, cards, lists) gets more above-the-fold visibility.
   Placed last so it wins by source order over the wrappers' base/shorthand
   paddings without needing higher specificity. */
@media (max-width: 767px) {
  .page-listing { padding-top: var(--space-3); }
  .shortlist-page { padding-top: var(--space-3); }
  .hero { padding-top: var(--space-6); }
  .error-page { padding-top: var(--space-8); }
  /* Tighten the gap between the lead text and the swipe card (only the top
     gap; the card→filters gap from the grid stays intact). */
  .swipe-area { margin-top: calc(-1 * var(--space-3)); }
}

/* ============================================================
   Global nav search — input + autocomplete dropdown
   ============================================================ */

/* Positioned container so the dropdown can anchor to it. The nav now collapses
   its links behind the hamburger at all widths, so the in-flow header row is
   logo | search | hamburger; the search expands to fill the middle. */
.nav-search {
  position: relative;
  flex: 1 1 auto;
  /* min-width:0 lets the search box absorb the squeeze at narrow widths so it
     shrinks instead of compressing the logo/hamburger. */
  min-width: 0;
  max-width: 420px;
}
/* Pin the siblings so the flexible search box is the one that gives way. */
.nav-logo { flex-shrink: 0; }
.nav-toggle { flex-shrink: 0; }

/* Full-width inside the container; pill style matches existing .input */
.nav-search-input {
  width: 100%;
  padding-right: var(--space-10);
}
.nav-search-icon {
  position: absolute;
  right: var(--space-4);
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}
.nav-search-icon svg { display: block; }
.nav-search-icon:hover,
.nav-search-icon:focus-visible {
  color: var(--color-purple);
}

/* Autocomplete dropdown — absolutely positioned below the input.
   z-index 300: above .nav (100), .sheet-backdrop (150), .listing-detail (200),
   .filter-modal (200) / .list-panel (200), keeping it always on top. */
.nav-search-suggest {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--color-surface-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-1) 0;
  /* [hidden] collapses the list when JS sets the attribute */
}
.nav-search-suggest[hidden] { display: none; }

/* Individual result rows */
.search-suggest-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.search-suggest-item:hover,
.search-suggest-item[aria-selected="true"] {
  background: rgba(181, 150, 200, 0.15);
}

/* Name — prominent */
.search-suggest-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  color: var(--color-ink);
  line-height: var(--leading-snug);
}

/* Origin / gender — smaller, muted */
.search-suggest-meta {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
  line-height: var(--leading-snug);
}

/* Meaning snippet — single line, ellipsis */
.search-suggest-meaning {
  font-size: var(--text-sm);
  color: var(--color-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--leading-snug);
}

/* "No results" row */
.search-suggest-empty {
  padding: var(--space-3) var(--space-4);
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

/* "View all results" footer row */
.search-suggest-all {
  border-top: 1px solid rgba(181, 150, 200, 0.2);
  padding: var(--space-2) var(--space-4);
}
.search-suggest-all a {
  color: var(--color-purple);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  text-decoration: none;
  display: block;
}
.search-suggest-all a:hover {
  color: var(--color-purple-hover);
  text-decoration: underline;
}

/* Mobile (<= 767px):
   Strategy — add flex-wrap only at mobile inside the existing @media block so
   the desktop flex row (logo | search | links) is never affected. We give
   .nav-search order:3 + flex-basis:100% so it drops to its own second row
   below the logo+toggle pair. We do NOT touch .nav-inner globally; the wrap
   is enabled only at this breakpoint via a targeted addition below. */
@media (max-width: 767px) {
  /* Enable row wrapping on mobile only, so .nav-search can own a full row. */
  .nav-inner {
    flex-wrap: wrap;
  }

  .nav-search {
    order: 3;       /* logo=1(natural), toggle=2(natural), search drops below */
    flex: 1 1 100%;
    max-width: 100%;
    padding-bottom: var(--space-2);
  }
  /* Form gains a bottom padding here; keep the icon centered on the input only. */
  .nav-search-icon { bottom: var(--space-2); }
}

/* ============================================================
   Search results page — .page-search extras
   ============================================================ */

/* Result count line */
.page-search .search-count {
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
  margin-top: 0;
}

/* Pagination row */
.search-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

/* Page indicator (e.g. "Page 2 of 5") */
.search-page-indicator {
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}
