/* peptidefix.io demo styles.
   Monochrome: black type on cream, white and grey surfaces, no colour accent.
   Pills for chips/buttons, 20px for cards and panels. Light and dark via prefers-color-scheme. */

:root {
  --bg: #f8f7f4;
  --bg-raised: #ffffff;
  --bg-muted: #efeeea;
  --text: #111111;
  --text-2: #4f4e4a;
  --text-3: #6b6a64;
  --line: #e4e2dc;
  --line-strong: #c8c6bf;
  --accent: #111111;
  --accent-ink: #ffffff;
  --accent-soft: #ebeae5;
  --radius: 20px;
  --max: 1120px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight", "Inter", -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --bg-raised: #1b1b1a;
    --bg-muted: #242422;
    --text: #f3f1ea;
    --text-2: #b5b3ab;
    --text-3: #8a8880;
    --line: #2c2c29;
    --line-strong: #43423e;
    --accent: #f3f1ea;
    --accent-ink: #121211;
    --accent-soft: #2a2a27;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
/* The accent is the text colour now, so text links show hover by underline.
   Row and card links keep their background change instead. */
.nav a:hover, .site-footer a:hover, .paper h3 a:hover,
.paper-mini a:hover, .supplier .site:hover, .block a:hover, .cite a:hover {
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
p { margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--mono); font-size: 0.8125rem; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

h1, h2, h3, .wordmark { font-family: var(--font-display); }
h1, h2, h3 { letter-spacing: -0.01em; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.wordmark {
  font-weight: 700; letter-spacing: -0.02em; font-size: 1.1875rem;
  display: inline-flex; align-items: center; gap: 10px;
}
.wordmark:hover { color: var(--text); }
.wordmark-text span { color: var(--text-3); }

/* Logo: leucine as a skeletal formula, lines only (atom labels would be specks
   at this size). The backbone holds still; each branch fades in turn. */
.logo {
  height: 28px; width: auto; flex: none;
  fill: currentColor; stroke: currentColor; stroke-width: 6;
  stroke-linecap: round; stroke-linejoin: round;
}
.logo path { fill: none; }
.logo circle { stroke: none; }
.logo .branch { animation: pf-branch 4.8s ease-in-out infinite; }
.logo .branch:nth-of-type(2) { animation-delay: 1.2s; }
.logo .branch:nth-of-type(3) { animation-delay: 2.4s; }
.logo .branch:nth-of-type(4) { animation-delay: 3.6s; }
@keyframes pf-branch {
  0%, 25%, 100% { opacity: 1; }
  12% { opacity: 0.12; }
}
.nav { display: flex; gap: 22px; font-size: 0.9375rem; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* Sections */
section { padding: 56px 0; }
section + section { border-top: 1px solid var(--line); }
.section-head { margin-bottom: 28px; max-width: 60ch; }
.section-head p { margin-top: 8px; color: var(--text-2); }

/* Hero */
.hero { padding: 52px 0 44px; }
.search { position: relative; margin-top: 28px; max-width: 520px; }
.search input {
  width: 100%; height: 52px; padding: 0 18px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.search input::placeholder { color: var(--text-3); }
.search-results {
  position: absolute; left: 0; right: 0; top: 56px;
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(20 20 18 / 0.08);
  overflow: hidden; z-index: 5;
}
.search-results:empty { display: none; }
.search-results { max-height: min(70vh, 560px); overflow-y: auto; }
.search-results a {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-top: 1px solid var(--line);
}
.search-results a:first-child { border-top: 0; }
.search-results a:hover { background: var(--bg-muted); color: var(--text); }
.search-results .kind { color: var(--text-3); font-size: 0.8125rem; }

/* Under the masthead: one full-width search box, then the countries in a row. */
.hero-search { max-width: none; margin-top: 40px; }
.hero-search input { height: 64px; padding: 0 72px 0 24px; font-size: 1.0625rem; border-radius: 999px; }
.hero-search .search-results { top: 70px; }
.search-go {
  position: absolute; top: 8px; right: 8px; width: 48px; height: 48px;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
}
.search-go:hover { opacity: 0.85; }
.search-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.hero-countries { margin-top: 40px; }
.hero-countries .country-panel { display: grid; grid-template-columns: repeat(3, 1fr); }
.hero-countries .country-panel a { border-top: 0; border-left: 1px solid var(--line); }
.hero-countries .country-panel a:first-child { border-left: 0; }

.country-panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised);
  overflow: hidden;
}
.country-panel a {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px 20px; border-top: 1px solid var(--line);
}
.country-panel a:first-child { border-top: 0; }
.country-panel a:hover { background: var(--bg-muted); color: var(--text); }
.country-panel .name { font-weight: 600; display: inline-flex; align-items: center; gap: 12px; }
.flag {
  width: 26px; height: 13px; flex: none; border-radius: 2px;
  box-shadow: 0 0 0 1px var(--line-strong);
}
.country-panel .count { color: var(--text-2); font-size: 0.875rem; }

/* Three doors: divided rows, not three equal cards */
.doors { display: grid; grid-template-columns: 1fr; }
.door {
  display: grid; grid-template-columns: 220px 1fr auto; gap: 24px; align-items: baseline;
  padding: 22px 0; border-top: 1px solid var(--line);
}
.door:last-child { border-bottom: 1px solid var(--line); }
.door h3 { font-size: 1.25rem; }
.door p { color: var(--text-2); max-width: 56ch; }
.door .go { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); font-size: 0.875rem; background: var(--bg-raised);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.8125rem; background: var(--accent-soft); color: var(--text);
}
.tag:hover { color: var(--accent); }

/* Curate */
.curate { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
.curate ul { list-style: none; margin: 0; padding: 0; }
.curate li { padding: 14px 0; border-top: 1px solid var(--line); color: var(--text-2); max-width: 60ch; }
.curate li strong { color: var(--text); font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--text-2); font-size: 0.875rem; }
.site-footer .wrap { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; }
.site-footer nav { display: flex; flex-direction: column; gap: 8px; }
.disclaimer { max-width: 64ch; }

/* Page header (interior pages) */
.page-head { padding: 40px 0 24px; }
.page-head h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.page-head p { margin-top: 10px; color: var(--text-2); max-width: 60ch; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 20px; }
.filters select, .filters input {
  height: 40px; padding: 0 12px; font: inherit; font-size: 0.9375rem; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.filters input { min-width: 260px; }
.filters select:focus, .filters input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.result-count { color: var(--text-3); font-size: 0.875rem; margin-left: auto; }

/* Supplier cards */
.suppliers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding-bottom: 56px; }
.supplier {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 12px;
}
.supplier { scroll-margin-top: 76px; }
.supplier.hit { border-color: var(--accent); }
.supplier .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.supplier .country { font-family: var(--mono); font-size: 0.75rem; color: var(--text-2); letter-spacing: 0.04em; }
.supplier dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; row-gap: 4px; column-gap: 12px; font-size: 0.875rem; }
.supplier dt { color: var(--text-3); }
.supplier dd { margin: 0; color: var(--text-2); }
.supplier .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.supplier .site { font-size: 0.875rem; color: var(--accent); font-weight: 600; }

/* Peptide page */
.peptide-head { padding: 40px 0 8px; }
.peptide-head .aliases { margin-top: 6px; color: var(--text-3); font-size: 0.9375rem; }
.peptide-head .chips { margin-top: 14px; }
.peptide-body { display: grid; grid-template-columns: 1fr 300px; gap: 48px; padding: 32px 0 56px; align-items: start; }
/* Regulatory status is what a reader wants kept in view while reading the rest,
   and the column is otherwise empty for the whole length of the page. */
.peptide-body aside { position: sticky; top: 76px; }
.peptide-body h2 { font-size: 1.125rem; margin-bottom: 8px; }
.block + .block { margin-top: 32px; }
.block p { color: var(--text-2); max-width: 64ch; }
.reg { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.reg div { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 0.875rem; }
.reg div:first-child { border-top: 0; }
.reg .k { font-family: var(--mono); color: var(--text-2); }
.aside-title { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 10px; }
.paper-list { display: flex; flex-direction: column; }
.paper-mini { padding: 12px 0; border-top: 1px solid var(--line); }
.paper-mini a { font-weight: 600; }
.paper-mini .meta { color: var(--text-3); font-size: 0.8125rem; margin-top: 2px; }
.peptide-index { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 56px; }
.peptide-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); padding: 18px 20px; }
.peptide-card p { color: var(--text-2); font-size: 0.9375rem; margin-top: 6px; }
.peptide-card .chips { margin-top: 12px; }

/* Research page */
.papers { display: flex; flex-direction: column; padding-bottom: 56px; }
.paper { padding: 22px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 200px; gap: 28px; }
.paper h3 a:hover { color: var(--accent); }
.paper .cite { color: var(--text-3); font-size: 0.875rem; margin-top: 4px; }
.paper .summary { color: var(--text-2); margin-top: 10px; max-width: 70ch; }
.paper .side { font-size: 0.875rem; display: flex; flex-direction: column; gap: 6px; }
.badge {
  display: inline-block; align-self: flex-start; padding: 3px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em;
  background: var(--bg-muted); color: var(--text-2);
}
.badge.human { background: var(--text); color: var(--bg); }
.paper .side .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 40px 0; color: var(--text-3); }

/* Interactive */
.chip, .tag, .door, .country-panel a, .search-results a { transition: background-color .15s, color .15s, border-color .15s; }
.chip:active { transform: translateY(1px); }

/* Mobile */
@media (max-width: 800px) {
  .curate, .site-footer .wrap, .peptide-body, .paper { grid-template-columns: 1fr; }
  .suppliers, .peptide-index { grid-template-columns: 1fr; }
  .door { grid-template-columns: 1fr; gap: 6px; }
  .nav { gap: 14px; font-size: 0.875rem; }
  section { padding: 40px 0; }
  .hero { padding: 40px 0; }
}

/* Site search: one index over suppliers, peptides and papers. The landing page
   keeps the large box; every page carries the compact one in the header. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.header-search { flex: 0 1 300px; margin: 0 20px 0 auto; }
.header-search input { height: 38px; padding: 0 14px; font-size: 0.9375rem; }
.header-search .search-results { top: 44px; right: 0; left: auto; width: 440px; max-width: calc(100vw - 32px); }
.search-group {
  margin: 0; padding: 8px 16px 4px;
  font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); background: var(--bg-muted);
  border-top: 1px solid var(--line);
}
.search-group:first-child { border-top: 0; }
.search-group span { color: var(--text-3); text-transform: none; letter-spacing: 0; }
.search-results .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .kind { white-space: nowrap; }
.search-results a.on { background: var(--accent-soft); color: var(--text); }
.search-none { margin: 0; padding: 14px 16px; color: var(--text-2); font-size: 0.9375rem; }
.paper.hit { border-color: var(--accent); }

@media (max-width: 800px) {
  /* Two rows of header is 117px on a phone. Keeping that stuck to the top costs
     14% of every screen on a site people come to read, so let it scroll away. */
  .site-header { position: static; }
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-block: 8px; row-gap: 6px; }
  .header-search { order: 3; flex: 1 1 100%; margin: 0; }
  .header-search .search-results { width: auto; left: 0; right: 0; }
  /* Journal names crowd the title at this width, so stack them instead. */
  .search-results a { display: block; }
  .search-results .label { white-space: normal; overflow: visible; }
  .search-results .kind { display: block; white-space: normal; margin-top: 2px; }
}

/* Supplier rows: the peptide page's answer to "who stocks this". The full card
   lives on the directory, where you are comparing companies. */
.supplier-rows { margin-top: 12px; border-top: 1px solid var(--line); }
.supplier-row {
  display: grid; grid-template-columns: minmax(150px, 1fr) 110px minmax(0, 2fr);
  gap: 16px; align-items: baseline;
  padding: 12px 8px; border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.supplier-row:hover { background: var(--bg-muted); color: var(--text); }
.supplier-row .name { font-weight: 600; }
.supplier-row .country { color: var(--text-2); font-size: 0.875rem; }
.supplier-row .terms {
  color: var(--text-2); font-size: 0.875rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 800px) {
  .supplier-row { grid-template-columns: 1fr; gap: 2px; padding: 12px 4px; }
  .supplier-row .terms { -webkit-line-clamp: 3; }
}

/* Research page at 98 papers: keep the filters reachable, show a page at a time,
   and clamp each summary so the list can be scanned. */
.filters {
  position: sticky; top: 60px; z-index: 4;
  background: var(--bg); padding-block: 12px; margin-top: 8px;
  border-bottom: 1px solid var(--line);
}
.paper .summary {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.paper.open .summary { display: block; }
.paper .more {
  margin-top: 6px; padding: 0; border: 0; background: none;
  font: inherit; font-size: 0.875rem; color: var(--accent); cursor: pointer;
}
.paper .more:hover { text-decoration: underline; }

.load-more {
  margin: 28px auto 0; display: block; padding: 12px 22px;
  font: inherit; font-size: 0.9375rem; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: var(--radius);
  cursor: pointer;
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 800px) {
  .filters { top: 0; }
}

/* FINDING-007: 44px minimum for anything you tap. Padding only, no layout change. */
@media (max-width: 800px) {
  .nav a, .site-footer a { padding-block: 11px; display: inline-block; }
  .wordmark { padding-block: 8px; gap: 8px; }
  /* Keeps logo, wordmark and nav on one row at 375. */
  .logo { height: 22px; }
  .nav { gap: 10px; }
  .chip, .tag { min-height: 44px; display: inline-flex; align-items: center; }
  .header-search input, .filters select, .filters input { height: 44px; }
  .supplier-row { padding-block: 14px; }
}

/* On the landing page the hero carries the search, so the header's copy stays
   out of the way until the hero one has scrolled past. */
.header-search[data-hide-until-scrolled] {
  opacity: 0; pointer-events: none; transition: opacity .18s ease-out;
  height: 0; margin-block: 0; overflow: hidden;
}
.header-search[data-hide-until-scrolled].shown { opacity: 1; pointer-events: auto; height: auto; overflow: visible; }
@media (prefers-reduced-motion: reduce) {
  .header-search[data-hide-until-scrolled] { transition: none; }
}

/* Hero: the headline is the masthead. Set to fill the column on one line at
   desktop and break onto two on a phone. */
.hero h1 {
  font-size: clamp(3.25rem, 11vw, 9.1rem); font-weight: 800;
  line-height: 0.9; letter-spacing: -0.05em; margin-left: -0.04em;
}
@media (max-width: 800px) {
  .hero h1 { font-size: 19vw; }
  .hero-search { margin-top: 28px; }
  .hero-search input { height: 56px; padding-left: 20px; padding-right: 64px; font-size: 1rem; }
  .hero-search .search-results { top: 62px; }
  .search-go { top: 6px; right: 6px; width: 44px; height: 44px; }
  .hero-countries { margin-top: 32px; }
  .hero-countries .country-panel { grid-template-columns: 1fr; }
  .hero-countries .country-panel a { border-left: 0; border-top: 1px solid var(--line); }
  .hero-countries .country-panel a:first-child { border-top: 0; }
}

/* The three doors are the main way into the site; they were set smaller than
   the section headings below them. */
.door h3 { font-size: 1.375rem; }

/* The filter bar stays on screen, so it has to be small. Search on its own row,
   the two selects sharing the next, the count tucked in beside them. */
@media (max-width: 800px) {
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-block: 8px; }
  .filters input { grid-column: 1 / -1; min-width: 0; }
  .filters select { min-width: 0; width: 100%; }
  .result-count { grid-column: 1 / -1; margin-left: 0; }
}

/* FINDING-010: supplier cards vary with how long each company's stated terms
   run, so rows left uneven gaps. Equal-height cells close them. */
.suppliers { align-items: stretch; }
.supplier { display: flex; flex-direction: column; }
.supplier .site { margin-top: auto; padding-top: 12px; }

/* Polish: browser surfaces themed from the palette, numbers that line up, and
   no motion for anyone who has asked not to see any. */
::selection { background: var(--accent-soft); color: var(--text); }
.count, .result-count, .reg { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  /* The logo rests fully drawn rather than frozen mid-fade. */
  .logo .branch { animation: none !important; opacity: 1; }
}
