/* =============================================================
   ARETE BIOLABS — LAYOUT & COMPONENTS
   Structure lives here. For colors/fonts/spacing, edit theme.css.
   ============================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--sp-5));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--brand-violet-light);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  margin: 0 0 var(--sp-4);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--fs-3xl);
}
h2 {
  font-size: var(--fs-2xl);
}
h3 {
  font-size: var(--fs-lg);
}

p {
  margin: 0 0 var(--sp-4);
}

p:last-child {
  margin-bottom: 0;
}

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

/* ---------- Layout primitives ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--sp-9);
}

.section--tight {
  padding-block: var(--sp-7);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--sp-3) var(--sp-4);
  z-index: 200;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  width: 100%;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-right: auto;
  color: var(--text);
}

.brand-lockup:hover {
  color: var(--text);
}

.brand-lockup__mark {
  height: 38px;
  width: auto;
  border-radius: var(--radius-sm);
}

.brand-lockup__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-lockup__name {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-lockup__motto {
  font-size: 0.6rem;
  color: var(--text-faint);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.site-nav__link {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.site-nav__link:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.site-nav__link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.nav-toggle {
  display: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--gradient-brand);
  color: var(--brand-white);
  box-shadow: 0 8px 24px rgba(123, 63, 228, 0.3);
}

.btn--primary:hover {
  color: var(--brand-white);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(123, 63, 228, 0.42);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--accent);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--sp-10) var(--sp-9);
  background: var(--gradient-surface);
}

.hero::before {
  content: "";
  position: absolute;
  top: -40%;
  left: 50%;
  width: 900px;
  height: 900px;
  transform: translateX(-50%);
  background: radial-gradient(
    circle,
    rgba(123, 63, 228, 0.22) 0%,
    transparent 62%
  );
  pointer-events: none;
}

.hero__inner {
  position: relative;
  text-align: center;
  max-width: 780px;
  margin-inline: auto;
}

.hero__mark {
  width: 132px;
  margin: 0 auto var(--sp-6);
  border-radius: var(--radius-lg);
}

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-4);
}

.hero__title {
  font-size: clamp(2.1rem, 5.2vw, var(--fs-4xl));
  margin-bottom: var(--sp-5);
}

.hero__body {
  font-size: var(--fs-lg);
  color: var(--text-muted);
  line-height: var(--lh-snug);
  margin-bottom: var(--sp-6);
}

.hero__actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  flex-wrap: wrap;
}

.hero__rule {
  margin-top: var(--sp-8);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-brand);
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- Grid & cards ---------- */

.grid {
  display: grid;
  gap: var(--sp-5);
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: border-color var(--transition), transform var(--transition),
    box-shadow var(--transition), background var(--transition);
}

.card__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--sp-4);
}

.card__title {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}

.card__body {
  color: var(--text-muted);
  font-size: var(--fs-base);
  margin: 0;
}

/* Compound card (clickable) */
.compound-card {
  display: flex;
  flex-direction: column;
  color: inherit;
}

.compound-card:hover {
  color: inherit;
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
  box-shadow: var(--shadow-glow);
}

.compound-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.compound-card__name {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  margin: 0;
}

.compound-card__aliases {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  margin: var(--sp-1) 0 0;
}

.compound-card__summary {
  color: var(--text-muted);
  font-size: var(--fs-base);
  margin: 0 0 var(--sp-5);
  flex: 1;
}

.compound-card__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.compound-card--empty {
  border-style: dashed;
  opacity: 0.55;
  pointer-events: none;
}

.placeholder-line {
  height: 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  margin-bottom: var(--sp-3);
}

/* ---------- Pills & tags ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.pill--status {
  background: var(--status-bg);
  color: var(--status-fg);
  border-color: transparent;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: var(--fw-semibold);
}

.pill--category {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-5);
  border-block: 1px solid var(--border);
  padding-block: var(--sp-6);
}

.stat {
  text-align: center;
}

.stat__value {
  display: block;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

.stat__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
}

/* ---------- Page header ---------- */

.page-header {
  padding-block: var(--sp-8) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--gradient-surface);
}

.page-header__title {
  margin-bottom: var(--sp-3);
}

.page-header__intro {
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0;
}

.breadcrumb {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  margin-bottom: var(--sp-4);
}

.breadcrumb a {
  color: var(--text-muted);
}

/* ---------- Filters ---------- */

.filters {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.search-field {
  position: relative;
}

.search-field__icon {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-field__input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-8);
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all var(--transition);
}

.search-field__input::placeholder {
  color: var(--text-faint);
}

.search-field__input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.filter-row__label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  margin-right: var(--sp-2);
}

.chip {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-family: inherit;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--transition);
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.chip[aria-pressed="true"] {
  background: var(--gradient-brand);
  border-color: transparent;
  color: var(--brand-white);
}

.results-count {
  font-size: var(--fs-sm);
  color: var(--text-faint);
}

.empty-state {
  text-align: center;
  padding: var(--sp-9) var(--sp-5);
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* ---------- Compound detail ---------- */

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--sp-7);
  align-items: start;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.lede {
  font-size: var(--fs-lg);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}

.prose h2 {
  font-size: var(--fs-xl);
  margin-top: var(--sp-7);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
}

.prose > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.prose h3 {
  margin-top: var(--sp-5);
}

.prose ul,
.prose ol {
  color: var(--text-muted);
  padding-left: var(--sp-5);
  margin: 0 0 var(--sp-4);
}

.prose li {
  margin-bottom: var(--sp-2);
}

.prose p {
  color: var(--text-muted);
}

.keypoints {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin-bottom: var(--sp-6);
}

.keypoints__title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--accent);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-3);
}

.keypoints ul {
  margin: 0;
  padding-left: var(--sp-5);
  color: var(--text);
}

.research-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.research-list li {
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border);
}

.research-list li:last-child {
  border-bottom: none;
}

.research-list__title {
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-1);
}

.research-list__detail {
  color: var(--text-muted);
  font-size: var(--fs-base);
}

.reference-list {
  list-style: none;
  counter-reset: ref;
  padding: 0;
  margin: 0;
}

.reference-list li {
  counter-increment: ref;
  position: relative;
  padding: var(--sp-3) 0 var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.reference-list li::before {
  content: counter(ref) ".";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}

.reference-list li:last-child {
  border-bottom: none;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--sp-5));
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.spec-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.spec-table__title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin: 0;
  font-weight: var(--fw-semibold);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-row__key {
  color: var(--text-faint);
  flex-shrink: 0;
}

.spec-row__value {
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.spec-row__value--mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.toc__title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-3);
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.toc a {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.toc a:hover {
  color: var(--accent);
}

/* ---------- Callout ---------- */

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-7);
  text-align: center;
}

.callout__title {
  margin-bottom: var(--sp-3);
}

.callout__body {
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 auto var(--sp-5);
}

.notice {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: var(--sp-5);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.notice strong {
  color: var(--text);
  display: block;
  margin-bottom: var(--sp-2);
}

.notice p + p {
  margin-top: var(--sp-3);
}

/* ---------- Research suppliers ---------- */

.supplier-list {
  list-style: none;
  padding: 0;
  margin: var(--sp-7) 0 0;
  display: grid;
  gap: var(--sp-4);
}

.supplier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.supplier__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.supplier__name {
  font-size: var(--fs-lg);
  margin: 0;
}

.supplier__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  word-break: break-all;
}

.supplier__link:hover {
  color: var(--accent);
}

.supplier__notes {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin: var(--sp-3) 0 0;
}

.supplier__disclosure {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-3) 0 0;
  font-size: var(--fs-sm);
  color: var(--text);
}

.supplier__disclosure strong {
  display: block;
  margin-bottom: 4px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--accent);
}

.supplier__footnote {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  margin-top: var(--sp-5);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
  padding-block: var(--sp-7) var(--sp-6);
  margin-top: var(--sp-9);
}

.site-footer__top {
  display: grid;
  grid-template-columns: 2fr repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-6);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.site-footer__motto {
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: var(--sp-3);
}

.footer-col__heading {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-3);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.footer-col a {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.footer-col a:hover {
  color: var(--accent);
}

.site-footer__bottom {
  padding-top: var(--sp-5);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}

.site-footer__legal {
  max-width: 70ch;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  :root {
    --fs-3xl: 2.1rem;
    --fs-2xl: 1.6rem;
    --sp-9: 3.5rem;
    --sp-10: 4.5rem;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .site-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--sp-3);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .site-nav[hidden] {
    display: none;
  }

  .site-nav__link {
    padding: var(--sp-3) var(--sp-4);
  }

  .brand-lockup__motto {
    display: none;
  }

  .site-footer__top {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
