/* The hub's own pages: the homepage (body.home), search results
   (body.results, from the /search Worker) and privacy (body.privacy).
   The family's base, skip link, focus ring, header band and footer are in
   /shared/opencommons.css, loaded first; the design language page has its
   own /designlanguage.css. Every page uses the family's --max-width from
   the shared stylesheet, so the hub's columns line up with the sites'. */

/* --- Every hub page ------------------------------------------------------ */

/* Pin the wordmark's tracking and leading so the homepage's h1 and the
   other pages' linked p render identically. */
.site-title { font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.site-title span { opacity: 0.7; font-weight: 600; }

footer { background: #f5f5f5; margin-top: 2rem; font-size: var(--text-sm); color: var(--color-muted); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 3rem;
  justify-content: space-between;
  align-items: baseline;
}

/* --- Homepage ------------------------------------------------------------ */

/* The search hero continues the header band. */
.hero { background: var(--color-header-bg); color: var(--color-header-text); }
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem var(--spacing) 2.75rem;
}
.hero :focus-visible { outline-color: #fff; }
.hero h2 {
  font-size: var(--text-4xl);
  line-height: var(--text-4xl-leading);
  letter-spacing: -0.03em;
  max-width: 20ch;
  margin: 0 0 0.6rem;
}
.hero-intro {
  max-width: 36rem;
  margin: 0 0 1.75rem;
  font-size: var(--text-lg);
  line-height: var(--text-lg-leading);
  opacity: 0.85;
}

.search { max-width: none; }
.search-row { display: flex; gap: 0.5rem; max-width: 52rem; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 6px;
  font-size: var(--text-lg);
  color: var(--color-text);
  background: #fff;
}
.search-go {
  flex: none;
  padding: 0 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: var(--color-link-hover);
  color: #fff;
  font-size: var(--text-lg);
  font-weight: 600;
  cursor: pointer;
}
.search-go:hover { background: #0a2f53; }
.search-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.9rem;
}
.search-in-label { font-size: var(--text-sm); opacity: 0.8; margin-right: 0.25rem; }
.search-in button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem 0.4rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.search-in button:hover { background: #fff; color: var(--color-link); }
.search-in button svg { width: 20px; height: 20px; border-radius: 4px; outline: 1px solid rgba(255, 255, 255, 0.5); }

/* The homepage's main spans the page so the hero can run edge to edge; the
   list below it keeps the column. */
.registers {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--spacing) 2rem;
}

.sites {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.5rem;
}
/* Rules only between rows: none above the first row or below the last. */
.sites li { border-top: 1px solid var(--color-border); }
.sites li:nth-child(-n+2) { border-top: 0; }
.site {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 1rem 0;
  color: inherit;
  text-decoration: none;
}
.site:hover { color: inherit; }
.site svg { width: 32px; height: 32px; }
.site-name {
  display: block;
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-link);
}
.site:hover .site-name { text-decoration: underline; }
.site-desc {
  display: block;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.site-stat {
  text-align: right;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.site-stat small {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-muted);
}

@media (max-width: 640px) {
  .hero-inner { padding: 1rem var(--spacing) 2rem; }
  .hero h2 { font-size: var(--text-3xl); line-height: var(--text-3xl-leading); }
  .hero-intro { font-size: var(--text-base); margin-bottom: 1.25rem; }
  /* 16px stops iOS zooming into the field on focus. */
  .search input, .search-go { font-size: 16px; }
  .search-row { gap: 0.4rem; }
  /* Tight padding and a hint a step smaller, so the whole hint fits
     beside the button on a 360px phone; the field itself stays at 16px. */
  .search input { padding: 0.8rem 0.5rem; }
  .search input::placeholder { font-size: var(--text-base); }
  .search-go { padding: 0 0.5rem; }
  .sites { grid-template-columns: 1fr; }
  .sites li:nth-child(2) { border-top: 1px solid var(--color-border); }
}

/* --- Search results ------------------------------------------------------ */

.results .header-inner { gap: 1.5rem; justify-content: space-between; }
.header-search { display: flex; flex: 1; max-width: 26rem; }
.header-search input {
  flex: 1; min-width: 0; padding: 0.45rem 0.75rem; border: 0; border-radius: 6px 0 0 6px;
  background: rgba(255, 255, 255, 0.15); color: #fff;
}
.header-search input::placeholder { color: rgba(255, 255, 255, 0.7); }
.header-search button {
  border: 0; border-radius: 0 6px 6px 0; padding: 0 0.9rem;
  background: #fff; color: var(--color-link); font-weight: 600; cursor: pointer;
}
.header-search button:hover { background: var(--color-accent-bg); }

.results main { max-width: var(--max-width); margin: 0 auto; padding: 2rem var(--spacing) 2.5rem; }
.results-title { font-size: 1.75rem; margin: 0 0 1.5rem; overflow-wrap: anywhere; }
.results-sub { margin: -1.25rem 0 1.5rem; color: var(--color-muted); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.5rem; align-items: start; }
.layout > div { min-width: 0; }

/* The jump-to rail is the stats panel: #f5f7fa, 6px, muted label. */
.rail {
  position: sticky; top: 1.5rem; background: var(--color-panel-bg); border: 1px solid var(--color-border);
  border-radius: 6px; padding: 1rem; font-size: var(--text-sm);
}
.rail h2 { font-size: var(--text-sm); color: var(--color-muted); margin: 0 0 0.5rem; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; border-top: 1px solid var(--color-border); }
.rail li:first-child { border-top: 0; }
.rail li.none, .rail li.none a { color: var(--color-muted); }
.rail .n { font-variant-numeric: tabular-nums; font-weight: 600; }

.group { margin: 0 0 2rem; scroll-margin-top: 1rem; }
.group-head { display: flex; align-items: center; gap: 0.6rem; border-bottom: 2px solid var(--color-border); padding-bottom: 0.5rem; }
.group-head svg { width: 24px; height: 24px; flex: none; }
.group-head h2 { font-size: var(--text-lg); margin: 0; flex: 1; }
.group-head h2 .n { color: var(--color-muted); font-weight: 400; font-size: var(--text-base); margin-left: 0.15rem; }
.group-head .all { font-size: var(--text-sm); white-space: nowrap; }
.hits { list-style: none; margin: 0; padding: 0; }
.hits li { padding: 0.7rem 0; border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; }
.hits a.t { font-weight: 600; }
.hits .m { display: block; color: var(--color-muted); font-size: var(--text-sm); line-height: 1.45; margin-top: 0.1rem; }

.badge {
  display: inline-block; border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1.5;
  color: #fff; background: #0b6e4f; padding: 0 0.5rem; vertical-align: 1px; margin-left: 0.35rem; white-space: nowrap;
}
.badge.grey { background: #8a8a8a; }
.facts .badge { margin-left: 0; }

.results-tabs { margin-top: -0.5rem; }
.results-note { margin: -0.5rem 0 1.5rem; color: var(--color-muted); }
.results-tabs + .results-sub { margin-top: -0.5rem; }
.nudge {
  display: flex; align-items: center; gap: 0.5rem; margin: 0 0 1.75rem; padding: 0.75rem 1rem;
  border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-panel-bg);
}
.nudge svg { flex: none; }
.nomatch-all { color: var(--color-muted); font-size: var(--text-sm); margin: 0.5rem 0 1rem; }
.nomatch { color: var(--color-muted); font-size: var(--text-sm); margin: 0 0 1rem; }
.nomatch svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 0.3rem; }

.best { border: 1px solid var(--color-link); border-radius: 6px; padding: 1.25rem; margin: 0 0 2rem; background: var(--color-accent-bg); overflow-wrap: anywhere; }
.best-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); font-weight: 700; margin: 0 0 0.35rem; }
.best h2 { font-size: var(--text-2xl); margin: 0 0 0.15rem; display: flex; align-items: center; gap: 0.6rem; }
.best h2 svg { width: 32px; height: 32px; flex: none; }
.best > p { margin: 0 0 1rem; color: var(--color-muted); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--color-muted); font-weight: 600; font-size: var(--text-sm); padding-top: 0.1rem; }
.facts dd { margin: 0; min-width: 0; }
.go { font-weight: 600; }

.related h2.section { font-size: var(--text-xl); margin: 0 0 0.75rem; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.card { border: 1px solid var(--color-border); border-radius: 6px; padding: 1rem; display: flex; flex-direction: column; gap: 0.3rem; overflow-wrap: anywhere; }
.card-head { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-sm); color: var(--color-muted); font-weight: 600; margin: 0; }
.card-head svg { width: 20px; height: 20px; flex: none; }
.card .big { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.card .m { color: var(--color-muted); font-size: var(--text-sm); }
.card .go { margin-top: auto; padding-top: 0.5rem; font-size: var(--text-sm); }
.card .quiet { color: var(--color-muted); font-size: var(--text-sm); margin: 0; }

.sources { list-style: none; margin: 2rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--color-border); font-size: var(--text-xs); line-height: var(--text-xs-leading); color: var(--color-muted); }
.sources li + li { margin-top: 0.3rem; }

@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rail { position: static; order: -1; margin-bottom: 1.5rem; padding: 0.75rem; }
  .rail ul { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .rail li, .rail li:first-child { border: 0; padding: 0.2rem 0.6rem; background: #fff; border-radius: 999px; }
  .rail h2 { display: none; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .results .header-inner { flex-wrap: wrap; row-gap: 0.5rem; padding-bottom: 0.9rem; }
  /* min-width: 0 lets the form shrink below the input's intrinsic width,
     which with the button is wider than a 360px phone's content box. */
  .header-search { flex-basis: 100%; max-width: none; min-width: 0; }
  /* 16px stops iOS zooming into the field on focus. */
  .header-search input { font-size: 16px; padding: 0.55rem 0.6rem; }
  /* As on the homepage: tighter padding and the hint a step smaller, so
     it fits whole at 360px; what is typed stays at 16px. */
  .header-search input::placeholder { font-size: var(--text-base); }
  .header-search button { padding: 0 0.7rem; }
  .results main { padding-top: 1.25rem; }
  .results-title { font-size: var(--text-2xl); }
  .group-head .all { display: none; }
  .best { padding: 1rem; }
  .best h2 { font-size: var(--text-xl); }
  .nudge { align-items: flex-start; }
  .nudge svg { margin-top: 0.15rem; }
}

/* --- Privacy ------------------------------------------------------------- */

.privacy main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--spacing) 3rem;
}
/* The page takes the family width like every other; its text keeps a
   700px reading column, left-aligned inside it. */
.privacy main > * { max-width: 700px; }
.privacy main h1 { margin: 0 0 1rem; font-size: var(--text-3xl); line-height: var(--text-3xl-leading); }
.privacy main h2 { margin: 2.5rem 0 0.5rem; font-size: var(--text-xl); line-height: var(--text-xl-leading); }
.privacy main h3 { margin: 1.75rem 0 0.5rem; font-size: var(--text-lg); line-height: var(--text-lg-leading); }
.privacy main h4 { margin: 1.25rem 0 0.35rem; font-size: 1rem; }
.privacy main p, .privacy main li { max-width: 72ch; }
.privacy main ul { padding-left: 1.25rem; }
.privacy main li + li { margin-top: 0.35rem; }
.privacy main pre { background: var(--color-panel-bg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.75rem 1rem; overflow-x: auto; }
.intro { font-size: var(--text-lg); line-height: var(--text-lg-leading); }
.contact { padding: 1rem 1.25rem; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-panel-bg); }
.contact p { margin: 0; }
.contact p + p { margin-top: 0.5rem; }
.summary { padding: 1rem 1.25rem; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-panel-bg); margin: 1.5rem 0; }
.summary p { margin: 0 0 0.5rem; }
.summary ul { margin: 0; }
.toc { columns: 2; column-gap: 2rem; }
.toc li { break-inside: avoid; }
.updated { margin-top: 2.5rem; color: var(--color-muted); }

@media (max-width: 640px) {
  .toc { columns: 1; }
}
