/* imewiki – editorial "name atelier" theme. No build step; plain CSS. */
:root {
  --paper: #fbf6ee;
  --paper-2: #f2eadc;
  --card: #fffdf9;
  --ink: #23434c;        /* text: deep petrol instead of black */
  --ink-2: #527079;
  --ink-3: #6f8990;
  --line: #e4dac8;
  --deep: #1d5f6b;       /* solid dark surfaces (hero card, pressed buttons) */
  --on-deep: #fdf8ef;
  --accent: #f27a1a;
  --accent-ink: #1f3a42;
  --accent-text: #c2540a; /* orange for small text on light backgrounds */
  --accent-soft: #fde6cf;
  --m: #2f6f9e;
  --f: #c2477a;
  --u: #6b8a3a;
  --star: #f0a81c;
  --m-ink: #1f5b7e; --m-wash: #e7f0f5;   /* boys: deep blue, pale sky tint */
  --f-ink: #a3375f; --f-wash: #fbe9ef;   /* girls: berry, soft rose tint */
  --u-ink: #23434c; --u-wash: #eef1e6;
  --shadow: 0 1px 0 rgba(29, 95, 107, .05), 0 8px 24px -12px rgba(29, 95, 107, .28);
  --radius: 18px;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* Light is the default; dark applies only when chosen with the theme button. */
:root[data-theme="dark"] {
  --paper: #12292f; --paper-2: #18343b; --card: #1b3a42; --ink: #f4ede1; --ink-2: #b7c7c9;
  --ink-3: #86a0a4; --line: #2d4d55; --deep: #f4ede1; --on-deep: #12292f;
  --accent: #ff9440; --accent-ink: #12292f; --accent-text: #ffa45c; --accent-soft: #4b3421;
  --m: #8fc1e6; --f: #f09abb; --u: #b9cf80; --shadow: 0 8px 24px -12px rgba(0,0,0,.5); color-scheme: dark;
  --m-ink: #9fcdec; --m-wash: #1a3f4f; --f-ink: #f4a9c6; --f-wash: #3f2a39; --u-ink: #f4ede1; --u-wash: #24413f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }  /* full-bleed tints (name page heading) must not cause sideways scroll */
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--paper) 82%, transparent); border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 14px; height: 64px; }
.logo { font: 600 26px/1 var(--serif); text-decoration: none; letter-spacing: -.02em; display: flex; align-items: center; gap: 2px; }
.logo i { color: var(--accent); font-style: italic; }
/* centre the wordmark on its capitals and baseline, not on the font's line box (browsers without text-box fall back to the line box) */
@supports (text-box: trim-both cap alphabetic) { .logo .wm { text-box: trim-both cap alphabetic; } }
.logo small { font: 500 11px var(--sans); color: var(--ink-3); margin-left: 6px; letter-spacing: .08em; text-transform: uppercase; }
.logo img { width: 34px; height: 34px; margin-right: 8px; align-self: center; filter: drop-shadow(0 4px 8px rgba(226, 72, 110, .25)); }
.top .spacer { flex: 1; }
.hsearch {
  position: relative; display: flex; align-items: center; gap: 8px; flex: 0 1 300px; margin-left: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 40px;
  color: var(--ink-3); transition: opacity .2s, transform .2s;
}
.hsearch:focus-within { border-color: var(--deep); }
.hsearch input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; color: var(--ink); font-weight: 600; }
.is-index:not(.hs-show) .hsearch { opacity: 0; pointer-events: none; transform: translateY(-4px); }
.hs-list {
  position: absolute; top: 46px; left: 0; right: 0; min-width: 260px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 50;
}
.hs-list a { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.hs-list a b { font: 500 18px var(--serif); }
.hs-list a small { color: var(--ink-3); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-list a.on, .hs-list a:hover { background: var(--paper-2); }
.hs-list .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; }
.surname-pill {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 6px 4px 14px; box-shadow: var(--shadow);
}
.surname-pill label { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.surname-pill input { border: 0; background: transparent; width: 120px; outline: none; font-weight: 600; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
}
.icon-btn:hover { border-color: var(--ink-3); }
.icon-btn .badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink); font: 700 11px/20px var(--sans);
}
.icon-btn .badge:empty { display: none; }

/* ---------- country menu (header) ---------- */
.cswitch { position: relative; }
.cswitch summary {
  list-style: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow);
  font: 600 13px/1 var(--sans); color: var(--ink-2); cursor: pointer; white-space: nowrap; user-select: none;
}
.cswitch summary::-webkit-details-marker { display: none; }
.cswitch summary:hover, .cswitch[open] summary { border-color: var(--ink-3); }
.cs-code { display: none; font-weight: 700; letter-spacing: .06em; color: var(--ink); }
.cs-name { font-weight: 500; }
.cs-caret { font-size: 11px; color: var(--ink-3); }
.cs-list {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 260px; margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.cs-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px;
}
.cs-list a:hover, .cs-list a[aria-current="page"] { background: var(--paper-2); }
.cs-soon {
  font: 600 10px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 7px; font-style: normal;
}
@media (max-width: 760px) { .cswitch { order: 1; } }  /* phones: after the logo, before the theme and favourites buttons */
@media (max-width: 560px) { .cs-name { display: none; } .cs-code { display: inline; } }

/* ---------- placeholder page for a country that is not live yet ---------- */
.soon { padding: 72px 0 40px; }
.soon-card { max-width: 720px; }
.soon h1 { font: 400 clamp(40px, 6vw, 72px)/1 var(--serif); letter-spacing: -.035em; margin: 0 0 18px; }
.soon h1 em { color: var(--accent); }
.soon .lead { font-size: 18px; color: var(--ink-2); margin: 0; max-width: 32em; }
.soon .toolbar { justify-content: flex-start; margin-top: 28px; }

/* ---------- hero ---------- */
.hero { padding: 48px 0 18px; display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: end; }
.hero h1 { font: 400 clamp(40px, 6vw, 76px)/.98 var(--serif); letter-spacing: -.035em; margin: 0 0 18px; }
.hero h1 em { color: var(--accent); }
.hero .today { margin: 0 0 14px; font-size: 15px; color: var(--ink-2); }
.hero .today span { color: var(--accent-text); font-weight: 600; }
.hero .today a { color: var(--ink); font-weight: 600; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.hero p.lead { color: var(--ink-2); font-size: 18px; max-width: 34em; margin: 0; }
.marquee {
  --mq-grad-m: linear-gradient(135deg, #133556 0%, #23628f 55%, #2a95ad 100%);
  --mq-grad-f: linear-gradient(135deg, #7d2148 0%, #c2416f 55%, #f07a3c 100%);
  position: relative; isolation: isolate; color: #fff; border-radius: 28px; padding: 24px 28px 22px;
  min-height: 236px; overflow: hidden; display: flex; flex-direction: column;
  background: var(--mq-grad-m); box-shadow: 0 22px 44px -26px rgba(19, 53, 86, .65);
  transition: box-shadow .6s;
}
/* the girls' gradient sits on top and fades in/out, so the colour change is smooth */
.marquee::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--mq-grad-f); opacity: 0; transition: opacity .7s ease; }
.marquee.mq-f::before { opacity: 1; }
.marquee.mq-f { box-shadow: 0 22px 44px -26px rgba(125, 33, 72, .7); }
.marquee .blob { position: absolute; z-index: -1; border-radius: 50%; filter: blur(28px); opacity: .55; pointer-events: none; }
.marquee .b1 { width: 220px; height: 220px; right: -60px; top: -70px; background: #ffb067; animation: drift1 14s ease-in-out infinite alternate; }
.marquee .b2 { width: 160px; height: 160px; left: -50px; bottom: -70px; background: #ffffff; opacity: .18; animation: drift2 18s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(-40px, 30px) scale(1.1); } }
@keyframes drift2 { to { transform: translate(50px, -20px) scale(.9); } }
.marquee .mq-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.marquee .kicker { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.marquee .mq-rank { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28); backdrop-filter: blur(6px); }
.marquee .big { display: block; margin: 14px 0 4px; color: #fff; text-decoration: none;
  font: 400 clamp(44px, 5.4vw, 68px)/1 var(--serif); letter-spacing: -.035em; transition: opacity .28s, transform .28s; }
.marquee .big .nm { text-shadow: 0 2px 18px rgba(0, 0, 0, .18); }
.marquee.mq-f .big .nm { font-variation-settings: "SOFT" 100; }
.marquee .big .sur { opacity: .6; font-style: italic; font-size: .55em; }
.marquee .meaning { font: italic 18px var(--serif); opacity: .88; transition: opacity .28s, transform .28s; min-height: 1.4em; }
.marquee .mq-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marquee .mq-count { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; }
.marquee a.go { color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); transition: background .2s; }
.marquee a.go:hover { background: rgba(255, 255, 255, .3); }
.marquee .mq-dots { display: flex; gap: 5px; margin-top: 12px; flex-wrap: wrap; }
.marquee .mq-dots button { width: 8px; height: 8px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .35); transition: width .25s, background .25s; }
.marquee .mq-dots button[aria-current="true"] { width: 22px; border-radius: 99px; background: #fff; }
.marquee .mq-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .12); }
.marquee .mq-timer i { display: block; height: 100%; width: 0; background: rgba(255, 255, 255, .7); }
.marquee.tick .mq-timer i { animation: mq-timer 5.2s linear forwards; }
.marquee.paused .mq-timer i { animation-play-state: paused; }
@keyframes mq-timer { to { width: 100%; } }
.marquee.fade .big, .marquee.fade .meaning { opacity: 0; transform: translateY(8px); }

/* ---------- search + filters ---------- */
.searchbar { display: flex; gap: 10px; margin: 26px 0 12px; flex-wrap: wrap; }
.search {
  flex: 1 1 320px; display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1.5px solid var(--deep); border-radius: 16px; padding: 0 16px; height: 56px; box-shadow: 4px 4px 0 var(--deep);
}
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 18px; min-width: 0; }
.search kbd { font: 12px var(--sans); color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; height: 56px; }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 0 14px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--deep); color: var(--on-deep); }
.select { height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 0 12px; font-weight: 600; font-size: 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: thin; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px;
  font-size: 14px; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; white-space: nowrap;
}
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .n { font-size: 11px; opacity: .6; }
/* every letter is always visible: a fixed grid, 15 per row on desktop, 10 on tablets, 6 on phones */
.letters { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 8px; padding: 8px 4px 16px; }
.letters button { min-width: 0; width: 100%; }
.letters button {
  flex: none; min-width: 0; height: 48px; padding: 0 6px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); box-shadow: 0 2px 0 var(--line); color: var(--ink);
  font: 600 22px/1 var(--serif); letter-spacing: -.01em;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s, background .18s, color .18s;
}
.letters button:hover { transform: translateY(-2px); border-color: var(--ink-3); box-shadow: 0 5px 0 var(--line); }
.letters button[aria-pressed="true"] {
  background: linear-gradient(140deg, var(--deep) 0%, #2d8a92 100%); color: var(--on-deep); border-color: var(--deep);
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--deep) 70%, transparent); transform: translateY(-1px);
}
.letters button:disabled { opacity: .3; cursor: default; transform: none; box-shadow: none; }
.letters button:disabled { opacity: .25; cursor: default; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 16px; flex-wrap: wrap; }
.count { color: var(--ink-2); font-size: 14px; }
.count b { color: var(--ink); }
.stat-big b { font-variant-numeric: tabular-nums; }
.modes { display: inline-flex; gap: 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--deep); color: var(--on-deep); border-color: var(--deep); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.clear { font-size: 13px; color: var(--accent-text); background: none; border: 0; text-decoration: underline; padding: 0; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding-bottom: 40px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s; min-height: 156px; overflow: hidden;
}
.card:hover { transform: translateY(-2px); border-color: var(--ink-3); }
.card .g { position: absolute; left: 0; top: 18px; width: 4px; height: 30px; border-radius: 0 4px 4px 0; }
.g-m { background: var(--m); } .g-f { background: var(--f); } .g-u { background: linear-gradient(var(--m), var(--f)); }
.card h3 { margin: 0; font: 500 30px/1.05 var(--serif); letter-spacing: -.025em; padding-right: 34px; word-break: break-word; }
.card h3 .sur { color: var(--ink-3); font-style: italic; font-weight: 300; font-size: .72em; display: block; }
.card .mean { color: var(--ink-2); font-style: italic; font-family: var(--serif); font-size: 15px; }
.card .meta { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.card .meter { flex: 1; height: 4px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.card .meter i { display: block; height: 100%; background: var(--deep); opacity: .7; border-radius: 4px; }
.card .tag { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.star {
  position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 999px; border: 0;
  background: transparent; display: grid; place-items: center; color: var(--ink-3); z-index: 2;
}
.star:hover { background: var(--paper-2); color: var(--star); }
.star svg { width: 22px; height: 22px; }
.star[aria-pressed="true"] { color: var(--star); }
.star[aria-pressed="true"] svg { fill: currentColor; animation: pop .35s; }
@keyframes pop { 40% { transform: scale(1.35) rotate(-8deg); } }
.empty { grid-column: 1 / -1; text-align: center; padding: 60px 0; color: var(--ink-2); }
.empty .big { font: 400 40px var(--serif); color: var(--ink); }
.sentinel { height: 1px; }

/* ---------- discover (swipe) ---------- */
.discover { display: none; flex-direction: column; align-items: center; padding: 10px 0 60px; }
body.mode-discover .discover { display: flex; }
body.mode-discover .grid, body.mode-discover .letters { display: none; }
.deck { position: relative; width: min(420px, 100%); height: 460px; }
.dcard {
  position: absolute; inset: 0; background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: var(--shadow); padding: 30px; display: flex; flex-direction: column; touch-action: none; user-select: none;
  transition: transform .3s, opacity .3s;
}
.dcard.behind { transform: scale(.94) translateY(18px); opacity: .6; }
.dcard .glabel { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.dcard h2 { font: 400 64px/1 var(--serif); letter-spacing: -.035em; margin: 18px 0 2px; word-break: break-word; }
.dcard h2 .sur { display: block; font-size: .5em; font-style: italic; color: var(--ink-3); }
.dcard .mean { font: italic 20px var(--serif); color: var(--ink-2); margin: 10px 0; }
.dcard .about { color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.dcard .stamp {
  position: absolute; top: 28px; right: 26px; padding: 6px 12px; border: 3px solid; border-radius: 10px;
  font: 800 20px var(--sans); letter-spacing: .1em; opacity: 0; transform: rotate(12deg);
}
.dcard .stamp.yes { color: var(--star); } .dcard .stamp.no { color: var(--ink-3); left: 26px; right: auto; transform: rotate(-12deg); }
.dcard a.more { margin-top: auto; font-size: 14px; }
.dactions { display: flex; gap: 14px; margin-top: 22px; align-items: center; justify-content: center; }
.round { display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 20px 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); box-shadow: var(--shadow); font: 600 15px var(--sans); color: var(--ink);
  transition: transform .15s, background .2s, border-color .2s, color .2s; }
.round .ic { font-size: 22px; line-height: 1; }
.round.no .ic { color: var(--ink-3); }
.round.yes { border-color: var(--star); }
.round.yes .ic { color: var(--star); }
.round:hover, .round:focus-visible { transform: translateY(-2px); }
.deckbox.lean-yes .round.yes { background: var(--star); color: #1f3a42; } .deckbox.lean-yes .round.yes .ic { color: #1f3a42; }
.deckbox.lean-no .round.no { background: var(--paper-2); border-color: var(--ink-3); }
.dhint { margin: 12px 0 0; color: var(--ink-3); font-size: 13px; text-align: center; }
.dhint .arrow { display: inline-block; font-weight: 700; color: var(--accent-text); }
.dhint .arrow.l { animation: nudge-l 1.6s ease-in-out infinite; } .dhint .arrow.r { animation: nudge-r 1.6s ease-in-out infinite; }
@keyframes nudge-l { 50% { transform: translateX(-4px); } } @keyframes nudge-r { 50% { transform: translateX(4px); } }

/* ---------- favourites drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18, 52, 60, .4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--paper); z-index: 41;
  transform: translateX(102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column;
  border-left: 1px solid var(--line); box-shadow: -20px 0 50px -30px rgba(0,0,0,.4);
}
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { transform: none; }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font: 500 28px var(--serif); }
.drawer .list { flex: 1; overflow: auto; padding: 10px 20px; }
.fav-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.fav-row a { flex: 1; text-decoration: none; font: 500 22px var(--serif); }
.fav-row a span { color: var(--ink-3); font-style: italic; font-weight: 300; }
.fav-row small { display: block; font: italic 13px var(--serif); color: var(--ink-2); }
.fav-row button { border: 0; background: none; color: var(--ink-3); font-size: 20px; }
.drawer footer { padding: 16px 20px 22px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.drawer footer .row { display: flex; gap: 8px; flex-wrap: wrap; }
.drawer footer .row .btn { flex: 1; justify-content: center; }
.drawer .emptyfav { text-align: center; color: var(--ink-2); padding: 40px 10px; }
.drawer .emptyfav .big { font: 400 54px var(--serif); color: var(--star); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: var(--deep); color: var(--on-deep);
  padding: 10px 18px; border-radius: 12px; font-size: 14px; transition: .25s; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.banner { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px; padding: 12px 16px; margin: 16px 0 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- name page ---------- */
.crumbs { padding: 22px 0 0; font-size: 14px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }
.namehead { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding: 18px 0 26px; border-bottom: 1.5px solid var(--deep); }
.namehead h1 { margin: 0; font: 400 clamp(64px, 12vw, 150px)/.9 var(--serif); letter-spacing: -.045em; }
.namehead h1 .sur { display: block; font-size: .36em; font-style: italic; font-weight: 300; color: var(--ink-3); letter-spacing: -.02em; margin-top: 8px; }
.namehead .sub { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; text-decoration: none; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.bigstar { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 22px; border-radius: 999px; border: 1.5px solid var(--deep); background: var(--card); font-weight: 700; box-shadow: 4px 4px 0 var(--deep); }
.bigstar svg { width: 22px; height: 22px; }
/* a colour ring that sweeps once around the edge every ~7 s and rests the other 6 s (not constant, so it stays calm) */
@property --fav-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.bigstar { position: relative; isolation: isolate; }
.bigstar::before {
  content: ""; position: absolute; inset: -3px; z-index: -1; border-radius: inherit; padding: 3px;
  background: conic-gradient(from var(--fav-a), var(--accent) 0deg, var(--star) 70deg, var(--m) 150deg, var(--f) 220deg, var(--u) 290deg, var(--accent) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; pointer-events: none; animation: fav-sweep 7s ease-in-out infinite;
}
@keyframes fav-sweep {
  0% { opacity: 0; --fav-a: 0deg; }
  3% { opacity: 1; }
  14% { opacity: 1; --fav-a: 360deg; }
  19%, 100% { opacity: 0; --fav-a: 360deg; }
}
.bigstar[aria-pressed="true"] { background: var(--star); border-color: var(--deep); color: #1f3a42; }
.bigstar[aria-pressed="true"] svg { fill: currentColor; }
.layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; padding: 28px 0 60px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel h2 { font: 600 12px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
.meaning-big { font: 400 italic clamp(28px, 4vw, 40px)/1.15 var(--serif); margin: 0 0 12px; letter-spacing: -.02em; }
.meaning-big::before { content: "„"; color: var(--accent); }
.meaning-big::after { content: "“"; color: var(--accent); }
.prose { font-size: 17px; color: var(--ink); }
.prose p { margin: 0 0 10px; }
.origin { color: var(--ink-2); font-family: var(--serif); font-size: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 15px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }
.taglist { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-big { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 8px; }
.stat-big div b { display: block; font: 500 34px/1 var(--serif); letter-spacing: -.02em; }
.stat-big div span { font-size: 12px; color: var(--ink-3); }
.chart { width: 100%; height: auto; display: block; margin-top: 12px; }
.chart text { fill: var(--ink-2); font: 11px var(--sans); }
.chart .s1 { stop-color: var(--g-ink, var(--deep)); } .chart .s2 { stop-color: var(--g-ink2, var(--deep)); }
.chart .h1 { stop-color: #ffa04a; } .chart .h2 { stop-color: var(--accent); } .chart .axis { stroke: var(--line); }
.preview { display: grid; gap: 10px; }
.preview .line { font: 400 26px var(--serif); letter-spacing: -.01em; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.preview .line small { font: 12px var(--sans); color: var(--ink-3); }
.monogram { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--deep); color: var(--on-deep); font: 500 28px var(--serif); letter-spacing: .04em; flex: none; }
.preview-top { display: flex; gap: 16px; align-items: center; }
.preview input { width: 100%; height: 46px; border: 1.5px solid var(--deep); border-radius: 12px; background: var(--paper); padding: 0 14px; font-weight: 600; }
.note { font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.famous li { margin-bottom: 4px; }
.famous a, .srclist a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.srclist { margin: 0 0 10px; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
.srclist li { margin-bottom: 4px; }
.ipa { color: var(--ink-3); font-weight: 400; font-family: var(--sans); margin-left: 6px; }
.related a { text-decoration: none; }

/* ---------- footer / about ---------- */
.foot { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--ink-3); font-size: 13px; }
.foot a { color: var(--ink-2); }
.about-page { max-width: 760px; padding: 30px 0 60px; }
.about-page h1 { font: 400 56px/1 var(--serif); letter-spacing: -.03em; }
.about-page h2 { font: 500 26px var(--serif); margin-top: 32px; }
.about-page li { margin-bottom: 6px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; gap: 24px; }
  .layout { grid-template-columns: 1fr; }
  .namehead { grid-template-columns: 1fr; }
  .surname-pill label { display: none; }
  .surname-pill input { width: 90px; }
  .logo small { display: none; }
  .marquee { min-height: 0; padding: 20px 20px 18px; }
  .searchbar .select { flex: 1 1 40%; }
  .seg { flex: 1 1 100%; } .seg button { flex: 1; }
}
@media (max-width: 760px) {
  .top .wrap { flex-wrap: wrap; height: auto; min-height: 60px; padding-top: 10px; padding-bottom: 10px; row-gap: 8px; }
  .hsearch { order: 5; flex: 1 1 100%; margin: 0; }
  .is-index:not(.hs-show) .hsearch { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .logo { font-size: 22px; }
  .logo img { width: 30px; height: 30px; margin-right: 6px; }
  .top .wrap { gap: 8px; }
  .surname-pill { padding-left: 10px; }
  .surname-pill input { width: 72px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 14px 12px 12px; min-height: 140px; }
  .card h3 { font-size: 24px; }
  .seg, .select { height: 46px; }
  .search { height: 50px; }
  .seg button { padding: 0 10px; }
  .deck { height: 440px; }
  .dcard h2 { font-size: 52px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- front page: top baby names ---------- */
.tops { margin: 30px 0 8px; }
.tops-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 20px; margin-bottom: 14px; }
.tops-head h2 { margin: 0; font: 500 clamp(26px, 3.2vw, 34px)/1.1 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
.tops-head .note { margin: 0; max-width: 46em; }
.tops-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.toplist { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; box-shadow: var(--shadow); min-width: 0; }
.toplist h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font: 600 12px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.toplist h3 .dot { width: 9px; height: 9px; border-radius: 50%; }
.toplist ol { list-style: none; margin: 0; padding: 0; }
.toplist li { display: grid; grid-template-columns: 30px 1fr auto 52px; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.toplist li:last-child { border-bottom: 0; }
.toplist .rk { font: 500 20px var(--serif); color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.toplist li:nth-child(-n+3) .rk { color: var(--accent-text); }
.toplist a { display: flex; align-items: baseline; gap: 8px; min-width: 0; text-decoration: none; }
.toplist a b { font: 500 22px var(--serif); letter-spacing: -.015em; }
.toplist a:hover b { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.toplist a small { color: var(--ink-3); font: italic 14px var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist .ct { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.toplist .mv { font-size: 15px; line-height: 1; font-weight: 800; text-align: center; }
.mv.up { color: #2e7d4f; } .mv.down { color: #b0472a; } .mv.same { color: var(--ink-3); } .mv.new { color: var(--accent-text); }
:root[data-theme="dark"] .mv.up { color: #8fd3a8; } :root[data-theme="dark"] .mv.down { color: #ffa98a; }
.toplist .more { display: inline-block; margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--accent-text); }
.rising { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-width: 0; }
.rising-label { flex: none; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.rising .chips { padding: 4px 2px; min-width: 0; }
.rising .chip .dot { width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 760px) {
  .tops-grid { grid-template-columns: 1fr; }
  .toplist li:nth-child(n+6) { display: none; }
  .rising { flex-direction: column; align-items: flex-start; }
  .rising .chips { width: 100%; }
}
@media (max-width: 420px) { .toplist a small { display: none; } .toplist li { grid-template-columns: 26px 1fr auto 44px; } }

/* ---------- girls' vs boys' names: colour, tint and letterform ----------
   Fraunces' SOFT axis rounds the letterforms for girls' names; boys' names stay crisp and a touch heavier. */
.gc-f h3, .gc-f h2, .gp-f .namehead h1, .g-f-list a b, .gn-f { color: var(--f-ink); font-variation-settings: "SOFT" 100; }
.gc-m h3, .gc-m h2, .gp-m .namehead h1, .g-m-list a b, .gn-m { color: var(--m-ink); font-variation-settings: "SOFT" 0; }
.gc-m h3, .gp-m .namehead h1 { font-weight: 500; }
.gc-f h3 { font-weight: 450; }
.card.gc-f { background: linear-gradient(160deg, var(--f-wash) 0%, var(--card) 62%); }
.card.gc-m { background: linear-gradient(160deg, var(--m-wash) 0%, var(--card) 62%); }
.card.gc-u { background: linear-gradient(160deg, var(--u-wash) 0%, var(--card) 62%); }
.dcard.gc-f { background: linear-gradient(170deg, var(--f-wash) 0%, var(--card) 55%); }
.dcard.gc-m { background: linear-gradient(170deg, var(--m-wash) 0%, var(--card) 55%); }
.g-f-list { background: linear-gradient(170deg, var(--f-wash) 0%, var(--card) 40%); }
.g-m-list { background: linear-gradient(170deg, var(--m-wash) 0%, var(--card) 40%); }
/* name page: tinted heading band, gender colour on the accents that carry the name */
.gp-f .namehead, .gp-m .namehead, .gp-u .namehead { position: relative; border-bottom-color: currentColor; }
.gp-f .namehead { color: var(--f-ink); } .gp-m .namehead { color: var(--m-ink); } .gp-u .namehead { color: var(--u-ink); }
.gp-f .namehead > *, .gp-m .namehead > *, .gp-u .namehead > * { color: var(--ink); position: relative; }
.gp-f .namehead::before, .gp-m .namehead::before, .gp-u .namehead::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--f-wash) 100%);
}
.gp-m .namehead::before { background: linear-gradient(180deg, transparent 0%, var(--m-wash) 100%); }
.gp-u .namehead::before { background: linear-gradient(180deg, transparent 0%, var(--u-wash) 100%); }
.gp-f .namehead h1 { color: var(--f-ink); } .gp-m .namehead h1 { color: var(--m-ink); }
.gp-f .monogram { background: var(--f-ink); color: var(--card); } .gp-m .monogram { background: var(--m-ink); color: var(--card); }
.gp-f .bigstar { border-color: var(--f-ink); box-shadow: 4px 4px 0 var(--f-ink); }
.gp-m .bigstar { border-color: var(--m-ink); box-shadow: 4px 4px 0 var(--m-ink); }
.gp-f .meaning-big { color: var(--f-ink); } .gp-m .meaning-big { color: var(--m-ink); }

/* ---------- name page: gender tokens ---------- */
.gp-f { --g-ink: var(--f-ink); --g-ink2: #d9688f; --g-wash: var(--f-wash); --g-grad: linear-gradient(100deg, #9b2c58 0%, #d24a7c 45%, #f27a1a 100%); }
.gp-m { --g-ink: var(--m-ink); --g-ink2: #3f8fbf; --g-wash: var(--m-wash); --g-grad: linear-gradient(100deg, #16395c 0%, #2f6f9e 50%, #2fa3b8 100%); }
.gp-u { --g-ink: var(--u-ink); --g-ink2: #4f8a8c; --g-wash: var(--u-wash); --g-grad: linear-gradient(100deg, #23434c 0%, #4f8a8c 55%, #f27a1a 100%); }
:root[data-theme="dark"] .gp-f { --g-ink2: #b8557d; --g-grad: linear-gradient(100deg, #ffb3cf 0%, #f07aa6 50%, #ffa45c 100%); }
:root[data-theme="dark"] .gp-m { --g-ink2: #4f87b0; --g-grad: linear-gradient(100deg, #bfe1f7 0%, #7fbde6 50%, #6fd3df 100%); }
:root[data-theme="dark"] .gp-u { --g-grad: linear-gradient(100deg, #f4ede1 0%, #9fd0cc 55%, #ffa45c 100%); }

/* the name itself: gradient lettering with one light sweep on load */
.namehead h1 .nm-txt {
  background: var(--g-grad, var(--ink)); background-size: 220% 100%; background-position: 0% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  padding-bottom: .06em; /* keep descenders inside the clipped background */
  animation: nm-rise .8s cubic-bezier(.2, .8, .2, 1) both, nm-sweep 1.8s ease-out .35s both;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .namehead h1 .nm-txt { color: var(--g-ink, var(--ink)); -webkit-text-fill-color: currentColor; background: none; }
}
@keyframes nm-rise { from { opacity: 0; transform: translateY(14px); letter-spacing: -.01em; } }
@keyframes nm-sweep { from { background-position: 100% 0; } }
.namehead .sub .pill { animation: fade-up .5s cubic-bezier(.2, .8, .2, 1) both; }
.namehead .sub .pill:nth-child(2) { animation-delay: .05s; } .namehead .sub .pill:nth-child(3) { animation-delay: .1s; }
.namehead .sub .pill:nth-child(4) { animation-delay: .15s; } .namehead .sub .pill:nth-child(n+5) { animation-delay: .2s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }

/* pills: gender dot pill tinted, all pills lift slightly on hover */
.gp-f .namehead .pill:first-child { background: var(--f-wash); border-color: color-mix(in srgb, var(--f-ink) 30%, transparent); color: var(--f-ink); }
.gp-m .namehead .pill:first-child { background: var(--m-wash); border-color: color-mix(in srgb, var(--m-ink) 30%, transparent); color: var(--m-ink); }
a.pill { transition: transform .15s, border-color .15s; } a.pill:hover { transform: translateY(-1px); border-color: var(--g-ink, var(--ink-3)); }

/* panels on the name page: gradient hairline on top, headings in the gender colour */
[class*="gp-"] .panel { position: relative; overflow: hidden; animation: fade-up .6s cubic-bezier(.2, .8, .2, 1) both; }
[class*="gp-"] .panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--g-grad); opacity: .85; }
[class*="gp-"] .layout > div > .panel:nth-child(2), [class*="gp-"] aside .panel:nth-child(2) { animation-delay: .08s; }
[class*="gp-"] .layout > div > .panel:nth-child(n+3), [class*="gp-"] aside .panel:nth-child(n+3) { animation-delay: .14s; }
[class*="gp-"] .panel h2 { color: var(--g-ink); }
[class*="gp-"] .stat-big b { color: var(--g-ink); font-variant-numeric: tabular-nums; }
.gp-f .stat-big b { font-variation-settings: "SOFT" 100; }
[class*="gp-"] .meaning-big { font-variation-settings: inherit; }
.gp-f .meaning-big { font-variation-settings: "SOFT" 100; }
[class*="gp-"] .monogram { background: var(--g-grad); color: #fff; box-shadow: 0 8px 20px -10px var(--g-ink); }
[class*="gp-"] .preview .line span { color: var(--g-ink); }
[class*="gp-"] .famous li::marker { color: var(--g-ink); }
[class*="gp-"] .crumbs { color: var(--g-ink); }
[class*="gp-"] .kv dt { color: var(--ink-3); }

/* charts: bars grow in one after another, values follow. They wait at zero until the page has settled (common.js adds .go)
   and the chart is on screen (.in-view), so font swaps and reflow cannot shift them mid-growth. Without JS nothing is held back. */
.chart .bar { transform-box: fill-box; transform-origin: 50% 100%; }
.js .chart:not(.go) .bar { transform: scaleY(0); }
.js .chart:not(.go) .val { opacity: 0; }
.chart.go.in-view .bar { animation: bar-grow .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * .12s + .2s); }
.chart.go.in-view .val { animation: fade-in .4s ease-out both; animation-delay: calc(var(--i, 0) * .12s + .8s); }
@keyframes bar-grow { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: reduce) { .js .chart:not(.go) .bar { transform: none; } .js .chart:not(.go) .val { opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }

/* name chips (related names, counterpart) coloured by their own gender */
.nchip { display: inline-block; margin: 0 4px 6px 0; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; font: 500 16px var(--serif); background: var(--card); transition: transform .15s, background .15s; }
.nchip.gn-f { background: var(--f-wash); border-color: color-mix(in srgb, var(--f-ink) 25%, transparent); }
.nchip.gn-m { background: var(--m-wash); border-color: color-mix(in srgb, var(--m-ink) 25%, transparent); }
.nchip:hover { transform: translateY(-1px); }
.kv dd.related { line-height: 1.2; }

/* index cards: popularity meter and hover glow in the gender colour */
.gc-f .meter i { background: linear-gradient(90deg, #d24a7c, var(--f-ink)); }
.gc-m .meter i { background: linear-gradient(90deg, #2fa3b8, var(--m-ink)); }
.card.gc-f:hover { border-color: color-mix(in srgb, var(--f-ink) 45%, var(--line)); box-shadow: 0 14px 30px -18px var(--f-ink); }
.card.gc-m:hover { border-color: color-mix(in srgb, var(--m-ink) 45%, var(--line)); box-shadow: 0 14px 30px -18px var(--m-ink); }
.fav-row a.gn-f { color: var(--f-ink); font-variation-settings: "SOFT" 100; } .fav-row a.gn-m { color: var(--m-ink); }

/* front page top lists: rows slide in once */
.toplist li { animation: fade-up .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--r, 0) * .04s); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.foot-logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.foot-logo img { width: 26px; height: 26px; }

/* ---------- swipe deck (deck.js) ---------- */
.deckbox { display: flex; flex-direction: column; align-items: center; width: 100%; position: relative; }
.deckbox .deck { position: relative; width: min(420px, 100%); height: 440px; touch-action: pan-y; }
.deckbox.compact .deck { height: 300px; }
.deckbox.compact .dcard { padding: 24px; }
.deckbox.compact .dcard h2 { font-size: 48px; margin-top: 12px; }
.dcard .glabel { display: flex; align-items: center; gap: 6px; }
.dcard .glabel .dot { width: 8px; height: 8px; border-radius: 50%; }
.dcard .stamp { font-size: 15px; white-space: nowrap; }
.dcard.done { align-items: center; justify-content: center; text-align: center; gap: 10px; }
.dcard .done-big { font: 400 64px var(--serif); color: var(--accent-text); }
.dcard a.more { color: var(--g-ink, var(--ink)); font-weight: 600; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.dcard.gc-f a.more { color: var(--f-ink); } .dcard.gc-m a.more { color: var(--m-ink); }
.dcard { cursor: grab; } .dcard:active { cursor: grabbing; }
/* one-time demonstration: the card sways right then left while a hand shows the gesture */
.dcard.hinting { animation: card-sway 2.4s cubic-bezier(.45, 0, .2, 1) .2s both; }
.dcard.hinting .stamp.yes { animation: stamp-flash-yes 2.4s .2s both; }
.dcard.hinting .stamp.no { animation: stamp-flash-no 2.4s .2s both; }
@keyframes card-sway { 20% { transform: translateX(70px) rotate(5deg); } 30% { transform: translateX(70px) rotate(5deg); }
  60% { transform: translateX(-70px) rotate(-5deg); } 70% { transform: translateX(-70px) rotate(-5deg); } 100% { transform: none; } }
@keyframes stamp-flash-yes { 18%, 32% { opacity: 1; } 0%, 45%, 100% { opacity: 0; } }
@keyframes stamp-flash-no { 58%, 72% { opacity: 1; } 0%, 48%, 100% { opacity: 0; } }
.deckbox::after { content: "👆"; position: absolute; left: 50%; top: 52%; font-size: 44px; opacity: 0; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); transform: translateX(-50%); z-index: 5; }
.deckbox.compact::after { top: 45%; }
.deckbox.show-hand::after { animation: hand-swipe 2.4s cubic-bezier(.45, 0, .2, 1) .2s both; }
@keyframes hand-swipe { 0% { opacity: 0; transform: translateX(-50%); } 8% { opacity: 1; } 20%, 30% { transform: translateX(calc(-50% + 70px)); }
  60%, 70% { transform: translateX(calc(-50% - 70px)); } 92% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%); } }
@media (max-width: 560px) { .round { height: 50px; padding: 0 16px 0 12px; font-size: 14px; } .deckbox .deck { height: 420px; } }
.dcard { touch-action: pan-y; }  /* vertical page scroll still works; horizontal drags swipe the card */

/* ---------- name page: related names + similar-names deck ---------- */
.mn-block { margin: 6px 0 34px; }
.mn-h { font: 500 clamp(26px, 3vw, 32px)/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 14px; text-wrap: balance; }
.mn-h span { display: block; margin-top: 4px; font: 500 13px var(--sans); letter-spacing: .02em; color: var(--ink-3); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.mcard { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px 18px 14px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); text-decoration: none;
  transition: transform .18s, box-shadow .18s, border-color .18s; animation: fade-up .5s cubic-bezier(.2, .8, .2, 1) both; }
.mcard b { font: 500 26px/1.05 var(--serif); letter-spacing: -.02em; }
.mcard small { color: var(--ink-2); font: italic 15px var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .mc-meta { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-3); }
.mcard .mc-meta i { font-style: normal; font-size: 18px; color: var(--accent-text); transition: transform .18s; }
.mcard:hover { transform: translateY(-3px); }
.mcard:hover .mc-meta i { transform: translateX(4px); }
.mcard.gc-f { background: linear-gradient(160deg, var(--f-wash), var(--card) 70%); } .mcard.gc-f b { color: var(--f-ink); font-variation-settings: "SOFT" 100; }
.mcard.gc-m { background: linear-gradient(160deg, var(--m-wash), var(--card) 70%); } .mcard.gc-m b { color: var(--m-ink); }
.mcard.gc-f:hover { border-color: color-mix(in srgb, var(--f-ink) 45%, var(--line)); box-shadow: 0 16px 30px -18px var(--f-ink); }
.mcard.gc-m:hover { border-color: color-mix(in srgb, var(--m-ink) 45%, var(--line)); box-shadow: 0 16px 30px -18px var(--m-ink); }
.mcard:nth-child(2) { animation-delay: .04s; } .mcard:nth-child(3) { animation-delay: .08s; } .mcard:nth-child(n+4) { animation-delay: .12s; }
.mn-discover { display: grid; grid-template-columns: 1fr minmax(300px, 420px); gap: 28px; align-items: center;
  padding: 26px; border-radius: 26px; border: 1px solid var(--line);
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%), var(--card); }
.mn-discover p { color: var(--ink-2); max-width: 42ch; margin: 0 0 14px; }
.mn-chips { display: flex; flex-wrap: wrap; }
@media (max-width: 760px) { .mn-discover { grid-template-columns: 1fr; padding: 18px; } }

/* ---------- front page: discover strip ---------- */
.home-discover { margin: 34px 0 10px; }

/* surname at the same size as the first name, dimmed (name page and swipe cards) */
.namehead h1 .sur { display: block; font-size: 1em; font-style: normal; font-weight: 300; letter-spacing: -.045em;
  color: color-mix(in srgb, var(--ink-3) 70%, transparent); margin-top: 0; line-height: .95; overflow-wrap: anywhere; }
.namehead h1 .sur:empty { display: none; }
.dcard h2 .sur { font-size: 1em; font-style: normal; font-weight: 300; color: color-mix(in srgb, var(--ink-3) 70%, transparent); overflow-wrap: anywhere; }
.deckbox.compact .dcard h2 { font-size: 44px; }

/* ---------- scrollable rows: edge fades and arrows; alphabet wraps on phones ---------- */
.hscroll { position: relative; min-width: 0; }
.hscroll .hs-btn { position: absolute; top: 50%; transform: translateY(-60%); z-index: 2; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); font: 600 20px/1 var(--sans); color: var(--ink);
  display: none; place-items: center; padding: 0 0 2px; }
.hscroll .hs-btn.l { left: -4px; } .hscroll .hs-btn.r { right: -4px; }
.hscroll.can-l .hs-btn.l, .hscroll.can-r .hs-btn.r { display: grid; }
.hscroll.can-r > .chips { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
.hscroll.can-l.can-r > .chips { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 56px), transparent); }
.hscroll.can-l:not(.can-r) > .chips { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px); mask-image: linear-gradient(90deg, transparent, #000 48px); }
.rising .hscroll { flex: 1; width: 100%; }
@media (max-width: 760px) {
  .letters { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; padding-bottom: 14px; }
  .letters button { height: 42px; font-size: 17px; padding: 0 2px; border-radius: 12px; }
}
.dcard .stamp { top: auto; bottom: 64px; }
.dcard .stamp.yes { right: 22px; } .dcard .stamp.no { left: 22px; }
.deckbox.compact .deck { height: 270px; }

/* entrance animations wait until their element is on screen (common.js adds .rv, then .in-view) */
.rv:not(.in-view), .rv:not(.in-view) * { animation-play-state: paused !important; }

/* surname on the same line as the first name when there is room, otherwise on the next line */
.namehead h1 .sur { display: inline-block; margin-left: .22em; }
.namehead h1 .sur:empty { display: none; }

/* ---------- phones: header in two clear rows, so the surname box is never cut off ---------- */
.top-break { display: none; }
@media (max-width: 760px) {
  .top .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 8px; column-gap: 8px; }
  .top .spacer { display: none; }
  .logo { order: 1; margin-right: auto; }
  [data-theme-btn] { order: 2; } [data-open-favs] { order: 3; }
  .top-break { display: block; order: 4; flex: 0 0 100%; height: 0; }
  .hsearch { order: 5; flex: 1.4 1 0; min-width: 0; margin: 0; }
  .surname-pill { order: 6; flex: 1 1 0; min-width: 0; padding-left: 12px; }
  .surname-pill input { width: 100%; min-width: 0; text-overflow: ellipsis; }
}

/* ---------- popular-with-babies card: swipe + arrows ---------- */
.marquee { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.marquee .mq-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.marquee .mq-ctrl .mq-dots { margin-top: 0; min-width: 0; }
.marquee .mq-arrows { display: inline-flex; gap: 6px; flex: none; }
.marquee .mq-arrows button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .16);
  color: #fff; font: 600 22px/1 var(--sans); padding: 0 0 3px; display: grid; place-items: center; transition: background .2s; }
.marquee .mq-arrows button:hover, .marquee .mq-arrows button:active { background: rgba(255, 255, 255, .32); }
#results { scroll-margin-top: 84px; }

.marquee .mq-pos { display: none; font-size: 13px; font-weight: 600; opacity: .9; font-variant-numeric: tabular-nums; }
.top { transition: transform .25s ease; }
@media (max-width: 760px) {
  body.header-hidden .top { transform: translateY(-100%); }
  #results { scroll-margin-top: 168px; }
  .marquee .mq-pos { display: inline; margin-right: auto; }
  .marquee .mq-ctrl .mq-dots { display: none; }
}
@media (prefers-reduced-motion: reduce) { .top { transition: none; } }
