/* Public website styles. Palette and type match public/index.html and the apps. */

@font-face {
  font-family: 'Abril Fatface';
  font-weight: 400;
  font-display: swap;
  src: url("/assets/abril-fatface-latin-f8ab6ece.woff2") format('woff2');
}

@font-face {
  font-family: 'Montserrat';
  font-weight: 600 700;
  font-display: swap;
  src: url("/assets/montserrat-latin-25ce00ca.woff2") format('woff2');
}

@font-face {
  font-family: 'Open Sans';
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/open-sans-latin-74a1c9cd.woff2") format('woff2');
}

:root {
  --pink: #fb6f92;
  --deep-pink: #e85d8c;
  --light-pink: #ffc2d4;
  --gold: #ffcdb2;
  --beige: #f7ede2;
  --peach: #ffe8d6;
  --navy: #1d3557;
  --dark-blue: #1e4a54;
  --teal: #4a8f9e;
  --brown: #6b4f3d;
  --black: #2e3131;
  --surface: #fffbff;
  --on-surface-variant: #49454f;
  --outline: rgba(46, 49, 49, 0.12);
  --radius: 20px;
  --display: 'Abril Fatface', Georgia, serif;
  --heading: 'Montserrat', -apple-system, sans-serif;
  --body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Chart series colors: checked for colorblind separation against --surface. */
  --series-f: #e85d8c;
  --series-m: #2563a8;
}

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

body {
  font-family: var(--body);
  color: var(--black);
  background: var(--surface);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); }
img { max-width: 100%; }

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header and footer ---------- */

.wordmark {
  font-family: var(--display);
  font-size: 26px;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark .wm-name { color: var(--pink); font-style: italic; }
.wordmark .wm-baby { color: var(--black); }

.site-header {
  background: var(--beige);
  padding: 12px 0;
}

.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.button {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-family: var(--heading);
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 24px;
}

.button-small {
  font-size: 14px;
  padding: 8px 18px;
}

.site-footer {
  margin-top: 64px;
  padding: 40px 0 48px;
  background: var(--beige);
  color: var(--on-surface-variant);
  font-size: 14px;
  text-align: center;
}

.site-footer p { margin-top: 10px; }

/* ---------- Name hero ---------- */

.name-hero {
  background: linear-gradient(170deg, var(--beige) 0%, var(--peach) 60%, var(--gold) 100%);
  padding: 36px 0 44px;
  text-align: center;
}

.eyebrow {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dark-blue);
}

.name-hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(52px, 13vw, 96px);
  line-height: 1.1;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.meaning {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(20px, 4vw, 26px);
  color: var(--deep-pink);
  margin-top: 4px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.fact {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: 0 8px 22px rgba(46, 49, 49, 0.08);
}

.fact dt {
  font-size: 13px;
  color: var(--on-surface-variant);
}

.fact dd {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 22px;
  color: var(--navy);
}

.stripe {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 8px;
}

.stripe span:nth-child(1) { background: var(--navy); }
.stripe span:nth-child(2) { background: var(--pink); }
.stripe span:nth-child(3) { background: var(--teal); }
.stripe span:nth-child(4) { background: var(--dark-blue); }
.stripe span:nth-child(5) { background: var(--brown); }

/* ---------- Name body ---------- */

.name-body { padding-top: 36px; }
.name-body section { margin-top: 44px; }

.name-body h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(24px, 4.5vw, 30px);
  line-height: 1.25;
  color: var(--navy);
  margin-bottom: 12px;
}

.name-body h3 {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 16px;
  margin: 20px 0 10px;
}

.name-body p + p { margin-top: 14px; }

.lead {
  font-size: 19px;
  color: var(--on-surface-variant);
}

.note {
  font-size: 13px;
  color: var(--on-surface-variant);
  margin-top: 12px;
}

.origins {
  list-style: none;
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.origins li {
  border-left: 4px solid var(--teal);
  background: #fff;
  border-radius: 0 12px 12px 0;
  padding: 10px 14px;
}

.origins span {
  display: block;
  font-size: 14px;
  color: var(--on-surface-variant);
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips li,
.chips-links a {
  border-radius: 999px;
  font-size: 15px;
}

.chips li {
  background: var(--peach);
  padding: 6px 14px;
}

.chips-links li {
  background: none;
  padding: 0;
}

.chips-links a {
  display: block;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--outline);
  font-weight: 600;
  text-decoration: none;
}

.chips-links a:hover,
.chips-links a:focus-visible {
  border-color: var(--pink);
  color: var(--deep-pink);
}

.summary {
  background: var(--beige);
  border-radius: var(--radius);
  padding: 24px;
}

/* ---------- Popularity chart ---------- */

.chart { margin-top: 20px; }

.chart figcaption {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--on-surface-variant);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
}

.legend { display: inline-flex; gap: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }

.legend-key {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}

.legend-key.series-f { color: var(--series-f); }
.legend-key.series-m { color: var(--series-m); }

.chart-plot {
  position: relative;
  margin-top: 8px;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 300;
  touch-action: pan-y;
}

.chart .grid { stroke: var(--outline); stroke-width: 1; }
.chart .crosshair { stroke: var(--on-surface-variant); stroke-width: 1; }

.chart .tick {
  font-family: var(--body);
  font-size: 12px;
  fill: var(--on-surface-variant);
}

.chart .tick-x { text-anchor: middle; }
.chart .tick-y { text-anchor: end; dominant-baseline: middle; }

.chart .line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.chart .line.series-f { stroke: var(--series-f); }
.chart .line.series-m { stroke: var(--series-m); }

.chart-tooltip {
  position: absolute;
  top: 4px;
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--outline);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(46, 49, 49, 0.12);
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.chart-tooltip strong,
.chart-tooltip span { display: block; }

.chart-tooltip .legend-key { margin-right: 6px; vertical-align: middle; }
.chart-tooltip[hidden] { display: none; }

.rank-table { margin-top: 16px; }

.rank-table summary {
  cursor: pointer;
  font-family: var(--heading);
  font-weight: 600;
  color: var(--navy);
}

.rank-table table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.rank-table th,
.rank-table td {
  text-align: right;
  padding: 6px 8px;
  border-bottom: 1px solid var(--outline);
}

.rank-table th:first-child { text-align: left; }
.rank-table thead th { font-weight: 600; color: var(--on-surface-variant); }

/* ---------- Famous people ---------- */

.people {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.person {
  display: flex;
  gap: 14px;
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 6px 18px rgba(46, 49, 49, 0.07);
}

.person-photo {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--peach);
}

.person-photo img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  object-position: center 20%;
}

.person-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 30px;
  color: var(--deep-pink);
}

.name-body .person h3 { margin: 0; }
.person-title { font-size: 13px; font-weight: 600; color: var(--teal); }
.person p { font-size: 14px; }
.name-body .person p + p { margin-top: 2px; }

/* ---------- App call to action ---------- */

.app-cta {
  margin-top: 48px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  scroll-margin-top: 16px;
}

.app-cta > div:first-child { flex: 1 1 280px; }
.name-body .app-cta h2 { color: #fff; margin-bottom: 6px; }
.app-cta p { color: rgba(255, 255, 255, 0.86); }

.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-badges img {
  display: block;
  height: 48px;
  width: auto;
}

/* ---------- Ad slot: fixed height so loading an ad never shifts the page ---------- */

.ad-slot {
  margin-top: 44px;
  min-height: 280px;
  border-radius: 12px;
  background: var(--beige);
}

@media (max-width: 560px) {
  .chart .tick { font-size: 22px; }
  .chart .tick-x:nth-of-type(even) { display: none; }
  .people { grid-template-columns: 1fr; }
  .app-cta { padding: 22px; }
}

@media (prefers-reduced-motion: no-preference) {
  .chips-links a { transition: border-color 0.15s ease, color 0.15s ease; }
}

/* ---------- Site navigation and search ---------- */

.site-header-row { flex-wrap: wrap; gap: 10px 16px; }

.site-nav {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.site-nav a {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible { color: var(--deep-pink); }

.search { display: flex; gap: 10px; }

.search input {
  font: inherit;
  font-size: 14px;
  width: 150px;
  padding: 7px 14px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: #fff;
  color: var(--black);
}

.search-large {
  justify-content: center;
  margin-top: 20px;
}

.search-large input {
  font-size: 16px;
  width: min(320px, 100%);
  padding: 11px 18px;
}

.search-large .button {
  border: 0;
  cursor: pointer;
  font-size: 15px;
}

.eyebrow a {
  color: inherit;
  text-decoration: none;
}

.eyebrow a:hover,
.eyebrow a:focus-visible { text-decoration: underline; }

/* ---------- List pages ---------- */

.list-hero h1 { font-size: clamp(32px, 7vw, 52px); }

.list-intro {
  max-width: 560px;
  margin: 12px auto 0;
  color: var(--on-surface-variant);
}

.name-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.name-grid a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  background: #fff;
  border: 1px solid var(--outline);
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
}

.name-grid a:hover,
.name-grid a:focus-visible {
  border-color: var(--pink);
  color: var(--deep-pink);
}

.name-grid .rank {
  min-width: 2.2em;
  font-size: 12px;
  font-weight: 400;
  color: var(--on-surface-variant);
  font-variant-numeric: tabular-nums;
}

.letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.letters a {
  min-width: 36px;
  padding: 6px 10px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--outline);
  border-radius: 10px;
  font-family: var(--heading);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.letters a[aria-current] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
  font-family: var(--heading);
  font-weight: 600;
  font-size: 14px;
}

.year-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0 32px;
}

.year-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.year-table th,
.year-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--outline);
  text-align: right;
}

.year-table th:nth-child(2),
.year-table tbody th { text-align: left; }
.year-table td:first-child,
.year-table th:first-child { text-align: left; width: 3.5em; color: var(--on-surface-variant); }
.year-table thead th { font-weight: 600; font-size: 13px; color: var(--on-surface-variant); }

.prose p { max-width: 640px; }

/* A ranked list of names with a meaning beside each */
.meaning-table { max-width: 720px; margin-top: 24px; }
.meaning-table td:last-child,
.meaning-table thead th:last-child { text-align: left; }
.meaning-table td:first-child,
.meaning-table th:first-child { width: 6em; }

.related-lists { margin: 16px 0 8px; }

.browse { margin-top: 48px; }
.browse h3 { margin: 22px 0 10px; font-size: 15px; }

@media (max-width: 640px) {
  .site-nav { order: 3; margin-left: 0; }
  .site-header .search { order: 4; margin-left: auto; }
  .site-header .search input { width: 130px; }
  .name-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ---------- Text pages (about, contact, legal) ---------- */

.prose ul {
  max-width: 640px;
  margin-top: 10px;
  padding-left: 22px;
}

.prose p + ul + p { margin-top: 14px; }
.prose ul + p { margin-top: 14px; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
}
