/*
 * Design tokens reused from the live HDC site (ukhealthdata.org/health-data-connect/),
 * per SPECIFICATION.md's "Styling" section ("Reuse the existing styling developed
 * for HDC. Take it from their website and integrate.").
 *
 * Extracted by fetching the live page's two theme stylesheets:
 *   https://ukhealthdata.org/wp-content/themes/hdruk/assets/css/style.min.css
 *   https://ukhealthdata.org/wp-content/themes/hdruk-child/assets/css/style.min.css
 * and the site logo (public/images/hdc-logo.svg).
 *
 * NOT reused: the site's body font, Museo Sans Rounded, is a commercial
 * licensed font self-hosted under HDR UK's own license — copying those woff
 * files into this repo (or hotlinking their URLs) isn't something this spike
 * should do without checking licensing/hosting terms first. Quicksand
 * (Google Fonts, open license) is used as a similarly rounded stand-in;
 * swap for the real font once licensing is confirmed.
 */

:root {
  --hdc-navy: #1f1646; /* headings */
  --hdc-blue: #385dae; /* body links */
  --hdc-blue-chip-text: #475da7; /* category chip text / readiness dot fill */
  --hdc-orange: #f98e2b; /* primary button */
  --hdc-orange-hover: #f9a92b;
  --hdc-grey-button: #d0d3d4; /* secondary button */
  --hdc-page-bg: #efefef;
  --hdc-border: #d0d3d4;
  --hdc-readiness-unfilled: #bac1d9;
  --hdc-readiness-stroke: #e2e7f6;
  --hdc-container-width: 1280px;
  --hdc-font: "Quicksand", "Museo Sans Rounded", sans-serif;

  /* Category chip background colours — verbatim from the live site's
     --framework/--pathway/--product/--service/--standard/--template
     custom properties, keyed here by the same category strings used in
     /schema/valuesets/categories.md. */
  --hdc-cat-framework: #aaf2db;
  --hdc-cat-pathway: #caf2bf;
  --hdc-cat-product: #ffd5ad;
  --hdc-cat-service: #ffd2cf;
  --hdc-cat-standard: #edd6ff;
  --hdc-cat-template: #d1dcff;
  /* Not present on the live site's category list — added for our extra
     categories found in the wider example export (see schema/GAPS.md). */
  --hdc-cat-training-product: #fff3b0;
  --hdc-cat-fallback: #e4e4e4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hdc-page-bg: #14121f;
    --hdc-border: #3a3550;
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--hdc-font);
  background-color: var(--hdc-page-bg);
  color: #222;
  margin: 0;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  body {
    color: #e7e7ee;
  }
}

h1,
h2,
h3 {
  color: var(--hdc-navy);
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  h1,
  h2,
  h3 {
    color: #b9c2ff;
  }
}

a {
  color: var(--hdc-blue);
}

.u-container {
  max-width: var(--hdc-container-width);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.c-button {
  font-family: var(--hdc-font);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5rem;
  background-color: var(--hdc-orange);
  color: var(--hdc-navy);
  cursor: pointer;
  display: inline-block;
  padding: 0.4rem 1.4rem;
  text-decoration: none;
  border: none;
  border-radius: 999px;
  transition: background-color 0.15s;
}

.c-button:hover,
.c-button:focus {
  background-color: var(--hdc-orange-hover);
}

.c-button--secondary {
  background-color: var(--hdc-grey-button);
  color: var(--hdc-navy);
}

/* Category chips — background keyed by category string, matching the
   live site's convention of naming CSS classes after the category value
   itself (e.g. `<span class="Service">Service</span>`). */
.hdc-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--hdc-font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--hdc-blue-chip-text);
  height: 1.6rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  margin: 0 0.25rem 0.25rem 0;
  background-color: var(--hdc-cat-fallback);
}

.hdc-chip[data-category="Framework"] {
  background-color: var(--hdc-cat-framework);
}
.hdc-chip[data-category="Pathway"] {
  background-color: var(--hdc-cat-pathway);
}
.hdc-chip[data-category="Product"] {
  background-color: var(--hdc-cat-product);
}
.hdc-chip[data-category="Service"] {
  background-color: var(--hdc-cat-service);
}
.hdc-chip[data-category="Standard"] {
  background-color: var(--hdc-cat-standard);
}
.hdc-chip[data-category="Template"] {
  background-color: var(--hdc-cat-template);
}
.hdc-chip[data-category="Training Product"] {
  background-color: var(--hdc-cat-training-product);
}

/* Readiness tier — recreates the live site's 3-dot "signal strength" icon
   (1/3 filled = Exploratory, 2/3 = Emerging, 3/3 = Established), reusing
   the exact inline SVG data URIs from the site's --exploratory/--emerging/
   --established custom properties (small UI icon, not a licensing concern
   the way the webfont is). */
.hdc-readiness {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--hdc-font);
  font-size: 0.85rem;
  color: var(--hdc-navy);
}

.hdc-readiness::before {
  content: "";
  width: 18px;
  height: 18px;
  background-repeat: no-repeat;
  background-size: contain;
}

.hdc-readiness[data-readiness="Exploratory"]::before {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none'%3E%3Ccircle cx='9' cy='9' r='8.5' fill='%23BAC1D9' stroke='%23E2E7F6'/%3E%3Ccircle cx='9' cy='9' r='5.5' fill='%23BAC1D9' stroke='%23E2E7F6'/%3E%3Ccircle cx='9' cy='9' r='2.5' fill='%23475DA7' stroke='%23E2E7F6'/%3E%3C/svg%3E");
}
.hdc-readiness[data-readiness="Emerging"]::before {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none'%3E%3Ccircle cx='9' cy='9' r='8.5' fill='%23BAC1D9' stroke='%23E2E7F6'/%3E%3Ccircle cx='9' cy='9' r='5.5' fill='%23475DA7' stroke='%23E2E7F6'/%3E%3Ccircle cx='9' cy='9' r='2.5' fill='%23475DA7' stroke='%23E2E7F6'/%3E%3C/svg%3E");
}
.hdc-readiness[data-readiness="Established"]::before {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none'%3E%3Ccircle cx='9' cy='9' r='8.5' fill='%23475DA7' stroke='%23E2E7F6'/%3E%3Ccircle cx='9' cy='9' r='5.5' fill='%23475DA7' stroke='%23E2E7F6'/%3E%3Ccircle cx='9' cy='9' r='2.5' fill='%23475DA7' stroke='%23E2E7F6'/%3E%3C/svg%3E");
}

/* Typography for rendered markdown pages (SUMMARY.md, EVALUATION.md) — reuses
   the same tokens as the rest of the site rather than introducing a second
   visual style just for prose pages. */
.markdown-body {
  max-width: 46rem;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}
.markdown-body h1:first-child {
  margin-top: 0;
}
.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  line-height: 1.6;
}
.markdown-body a {
  color: var(--hdc-blue);
}
.markdown-body code {
  background: var(--hdc-cat-fallback);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.9em;
}
.markdown-body pre {
  background: var(--hdc-navy);
  color: #fff;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}
.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.markdown-body blockquote {
  border-left: 3px solid var(--hdc-orange);
  margin-left: 0;
  padding-left: 1rem;
  color: #555;
}
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--hdc-border);
  margin: 2rem 0;
}

/* Entry result cards — shared by the homepage listing and every
   /search/<engine>/ demo page, so the 4 search-engine comparisons and the
   main listing all look identical regardless of which library found the
   result. */
.entry-list {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
}
.entry-card {
  background: #fff;
  border: 1px solid var(--hdc-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.entry-card h2 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
}
.entry-card h2 a {
  color: var(--hdc-navy);
  text-decoration: none;
}
.entry-card__meta {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}
.entry-card[hidden] {
  display: none;
}

/* Page chrome (header/banner/footer) — identical to the Astro spike's
   Base.astro, just moved to a shared stylesheet since Next.js layout.tsx
   doesn't have Astro's per-component scoped <style> blocks. */
header.c-header {
  background: #fff;
  border-bottom: 1px solid var(--hdc-border);
}
.c-header__top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}
/* SPECIFICATION.md's "Search-index-driven listings with pagination" — the
   homepage's page-size selector and pager controls. */
.results-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
}
.results-toolbar select {
  margin-left: 0.35rem;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.c-header__brand-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.c-header__all-spikes {
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  text-decoration: none;
  white-space: nowrap;
}
.c-header__logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--hdc-navy);
  font-weight: 700;
}
.c-header__logo-img {
  height: 2.5rem;
  width: auto;
}
.c-header__nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.c-header__nav a {
  color: var(--hdc-navy);
  text-decoration: none;
  font-weight: 600;
}
main {
  padding: 1.5rem;
}
.c-footer {
  margin-top: 3rem;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: #666;
  border-top: 1px solid var(--hdc-border);
}
/* SPECIFICATION.md's "Individual environments/rendering" — a build-time
   SITE_ENV flag (see src/_data/deploymentConfig.js), shown only when not
   "prod", same convention as the Astro/Next.js spikes. */
.c-env-ribbon {
  text-align: center;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.3rem;
}
.c-env-ribbon[data-env="dev"] {
  background: #6b6478;
  color: #fff;
}
.c-env-ribbon[data-env="preprod"] {
  background: var(--hdc-orange);
  color: var(--hdc-navy);
}
.c-banner {
  background: var(--hdc-orange);
  color: var(--hdc-navy);
}
.c-banner p {
  margin: 0;
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.c-banner a {
  color: var(--hdc-navy);
  text-decoration: underline;
  margin-left: 0.5rem;
}

/* Filter form — shared by the homepage and (once wired) any future
   search-engine comparison page, matching the Astro spike's FilterForm. */
#filters {
  background: #fff;
  border: 1px solid var(--hdc-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}
#filters fieldset {
  display: inline-block;
  vertical-align: top;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
  border: none;
  padding: 0;
}
#filters legend {
  font-weight: 600;
  color: var(--hdc-navy);
  padding: 0;
}
.filter-option {
  display: block;
  font-size: 0.9rem;
}
.filter-option--range {
  display: inline-block;
  margin-right: 0.75rem;
}
.filter-option--range input {
  width: 6rem;
  margin-left: 0.35rem;
}
.filter-hint {
  margin: 0.25rem 0 0 0;
  max-width: 16rem;
}
.filter-freetext {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Entry detail page */
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}
dl {
  margin-top: 1.5rem;
}
.field {
  border-top: 1px solid var(--hdc-border);
  padding: 0.75rem 0;
}
dt {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  opacity: 0.7;
}
dd {
  margin: 0.25rem 0 0 0;
}
dd ul {
  margin: 0;
  padding-left: 1.25rem;
}

/* Typography for rendered markdown pages (summary.md, evaluation.md) */
.markdown-body {
  max-width: 46rem;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}
.markdown-body h1:first-child {
  margin-top: 0;
}
.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  line-height: 1.6;
}
.markdown-body a {
  color: var(--hdc-blue);
}
.markdown-body code {
  background: #eee;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.9em;
}
.markdown-body pre {
  background: var(--hdc-navy);
  color: #fff;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}
.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.markdown-body blockquote {
  border-left: 3px solid var(--hdc-orange);
  margin-left: 0;
  padding-left: 1rem;
  color: #555;
}
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--hdc-border);
  margin: 2rem 0;
}
