/* Kangsheng Yanxuan - corporate IVD website
   v2.0 (2026-10-03) — responsive, accessible, compliance-safe
   Fixes vs v1.x: hero H1 contrast, mobile navigation, sticky header,
   4-column footer, cookie notice, focus states, lazy-loaded galleries. */

:root {
  --brand-900: #0d3459;
  --brand-700: #12457a;
  --brand-500: #1877c8;
  --brand-100: #e8eef5;
  --accent: #ffd966;
  --accent-dark: #ffcc33;
  --ink: #2c3e50;
  --muted: #6b7a8c;
  --line: #e0e6ed;
  --surface: #f9fbfd;
  --radius: 8px;
  --wrap: 1100px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, 'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  color: var(--ink);
  line-height: 1.7;
  background: #fff;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }
.muted { color: var(--muted); font-size: .9rem; }
.lede { font-size: 1.08rem; }

/* ---------- Header / navigation ---------- */
.site-header {
  background: var(--brand-700);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand { display: inline-flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.2rem; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: var(--brand-900);
  font-weight: 800; font-size: .95rem; letter-spacing: .5px;
}
.brand-text { white-space: nowrap; }

.site-nav ul { display: flex; align-items: center; gap: 1.4rem; list-style: none; }
.site-nav a { color: #fff; font-weight: 500; padding: .25rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }

.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nav-toggle-label { display: none; cursor: pointer; padding: .6rem; border-radius: 6px; }
.nav-toggle-label:focus-visible,
.nav-toggle:focus-visible + .nav-toggle-label { outline: 3px solid var(--accent); outline-offset: 2px; }
.nav-bars,
.nav-bars::before,
.nav-bars::after {
  display: block; width: 24px; height: 2px; background: #fff; border-radius: 2px; position: relative;
}
.nav-bars::before,
.nav-bars::after { content: ''; position: absolute; left: 0; }
.nav-bars::before { top: -7px; }
.nav-bars::after { top: 7px; }

/* ---------- Layout blocks ---------- */
main.wrap { padding-top: 2rem; padding-bottom: 3rem; }

.hero { 
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  color: #fff;
  text-align: center;
  padding: 4rem 2rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}
/* Explicit override: without this the global h1 colour wins and text becomes unreadable on the gradient. */
.hero h1,
.hero h2 { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.hero h1 { font-size: 2.2rem; line-height: 1.25; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; max-width: 760px; margin: 0 auto 1.5rem; }
.hero .hero-note { font-size: .92rem; opacity: .92; }
/* Links inside the hero must stay white — the global blue link colour is unreadable on the gradient. */
.hero a { color: #fff; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.hero a:hover { color: var(--accent); }
.hero .contact-strip { margin: 1.5rem auto 0; max-width: 760px; }
.hero .contact-strip p {
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3);
  border-left: 4px solid var(--accent); color: #fff; font-size: 1rem;
}
.hero .contact-strip a { color: #fff; }

h1 { color: var(--brand-700); margin-bottom: 1rem; font-size: 1.9rem; line-height: 1.3; }
h2 { color: var(--brand-700); margin: 2rem 0 .8rem; font-size: 1.35rem; }
h3 { color: var(--brand-700); }
h4 { color: var(--brand-700); margin-bottom: .5rem; font-size: 1rem; }

.btn {
  display: inline-block; background: var(--accent); color: var(--brand-900);
  padding: .7rem 1.5rem; border-radius: 5px; font-weight: 600;
  border: 1px solid transparent; transition: background .2s ease, transform .15s ease;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; transform: translateY(-1px); }

.btn-sm { background: var(--brand-100); border: 1px solid var(--line); padding: .5rem 1rem; border-radius: 5px; cursor: pointer; font-size: .9rem; color: var(--ink); }
.btn-sm.active { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

.breadcrumb { margin-bottom: 1rem; font-size: .88rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; color: var(--muted); }
.breadcrumb li + li::before { content: '/'; margin-right: .4rem; color: var(--line); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; background: var(--surface);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(18, 69, 122, .12); }
.card h3 { margin-bottom: .6rem; }
.card .card-icon { width: 28px; height: 28px; margin-bottom: .6rem; color: var(--brand-500); }

.notice { background: #fff8e1; border-left: 4px solid var(--accent); padding: 1rem 1.2rem; margin: 1.2rem 0; border-radius: 4px; }
.notice p + p { margin-top: .6rem; }
.notice--info { background: var(--brand-100); border-left-color: var(--brand-500); }
.notice--legal { background: #f4f7fa; border-left-color: var(--muted); font-size: .92rem; }

.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { border: 1px solid var(--line); padding: .6rem .8rem; text-align: left; vertical-align: top; }
th { background: #f0f4f8; color: var(--brand-900); }
tbody tr:nth-child(even) { background: #fbfcfe; }
code { font-size: .85em; color: var(--brand-900); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.gallery img { width: 100%; height: 180px; object-fit: cover; display: block; }
.gallery figcaption { padding: .5rem .8rem; font-size: .85rem; color: var(--muted); text-align: center; }

.cta-row { margin-top: 2rem; }

/* Contact strip (populated from data/site.json by tools/apply_contact.mjs) */
.contact-strip { margin: 0 0 2rem; }
.contact-strip:empty { display: none; }
.contact-strip p {
  margin: 0; padding: .85rem 1.2rem; text-align: center; font-weight: 500;
  background: var(--brand-100); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 6px;
}
.contact-strip a { font-weight: 600; }

ul.plain { list-style: none; }
ul.plain li { padding-left: 1.1rem; position: relative; }
ul.plain li::before { content: '•'; position: absolute; left: 0; color: var(--brand-500); }

/* ---------- Forms ---------- */
form.inquiry { margin: 1rem 0; }
form.inquiry label { font-weight: 600; display: block; margin-bottom: .25rem; }
form.inquiry input[type="text"],
form.inquiry input[type="email"],
form.inquiry select,
form.inquiry textarea {
  width: 100%; padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 5px;
  font: inherit; color: var(--ink); background: #fff;
}
form.inquiry .field { margin-bottom: 1rem; }
form.inquiry .consent { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; font-size: .92rem; }
form.inquiry .consent input { margin-top: .35rem; }
form.inquiry .req { color: #b3261e; }

/* ---------- Catalogue search (products/finder.html) ---------- */
.finder { margin: 1rem 0 .5rem; }
.finder-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.finder-row .field { margin-bottom: 0; }
.finder-grow { flex: 1 1 320px; }
.finder-reset { padding-bottom: 2px; }
.finder .field label { font-weight: 600; display: block; margin-bottom: .25rem; }
.finder input[type="search"],
.finder select {
  width: 100%; padding: .55rem .6rem; border: 1px solid var(--line);
  border-radius: 5px; font: inherit; color: var(--ink); background: #fff;
}
.finder-hint { margin-top: .6rem; }
.finder-count { font-weight: 600; color: var(--brand-700); margin: .5rem 0 1rem; }
#results td:first-child { color: var(--muted); width: 3.5rem; }

/* ---------- News ---------- */
.news-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem; background: var(--surface); }
.news-meta { margin-bottom: .5rem; }
.tag { background: var(--brand-700); color: #fff; padding: .2rem .6rem; border-radius: 4px; font-size: .75rem; }
.date { color: var(--muted); font-size: .85rem; margin-left: .5rem; }
.news-item h3 { margin: .4rem 0; }
.news-detail { color: var(--muted); font-size: .9rem; margin-top: .4rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-900); color: #dfe7f0; margin-top: 3rem; padding: 2.5rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr 1.2fr; gap: 2rem; }
.site-footer h4 { color: #fff; }
.site-footer a { color: #bfd6ef; }
.site-footer .muted { color: #a9bccf; }
.footer-brand { color: #fff; font-weight: 700; font-size: 1.15rem; margin-bottom: .5rem; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: .35rem; }
.footer-legal { border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 2rem; padding-top: 1.2rem; font-size: .85rem; color: #a9bccf; }
.footer-legal p + p { margin-top: .5rem; }
.footer-legal strong { color: #fff; }

/* ---------- Cookie notice ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: #fff; border-top: 3px solid var(--accent);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .12);
  padding: 1rem 1.5rem; display: flex; gap: 1rem; align-items: center; justify-content: center; flex-wrap: wrap;
}
.cookie-banner p { font-size: .9rem; max-width: 780px; }
.cookie-banner[hidden] { display: none; }
/* The notice is fixed to the bottom of the viewport: reserve space so it never covers page content
   (the last paragraph used to be hidden behind it until the visitor clicked Accept). */
body:has(.cookie-banner:not([hidden])) { padding-bottom: 6rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav-toggle-label { display: block; }
  .site-nav { flex-basis: 100%; }
  .site-nav ul { display: none; flex-direction: column; align-items: flex-start; gap: .2rem; padding: .5rem 0 1rem; }
  .nav-toggle:checked ~ .site-nav ul { display: flex; }
  .site-nav a { display: block; padding: .5rem 0; width: 100%; }
  .header-inner { flex-wrap: wrap; padding-top: .4rem; padding-bottom: .4rem; }

  main.wrap { padding-top: 1.5rem; }
  .container { padding: 1.2rem; }
  .hero { padding: 2.5rem 1.2rem; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 1rem; }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.2rem; }
  .card-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery img { height: 140px; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 480px) {
  .gallery { grid-template-columns: 1fr; }
  .wrap { padding: 0 1rem; }
  .brand-text { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn { transition: none; }
  .card:hover, .btn:hover { transform: none; }
}
