/*
 * Shared base styles for the LabShope sites. Each site sets its own colour tokens in its own
 * css/site.css (see the --bg, --text ... list below) and this file does layout and components.
 * Fonts: IBM Plex (SIL Open Font License 1.1, texts in ../fonts), self-hosted, no font service.
 */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main {
  flex: 1 0 auto;
}
img,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}
h1,
h2,
h3 {
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem);
}
h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
}
h3 {
  font-size: 1.2rem;
}
p {
  margin: 0 0 1em;
}
a {
  color: var(--link);
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--link-hover);
}
code,
kbd {
  font-family: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  background: var(--accent-solid);
  color: var(--on-accent);
  padding: 0.6em 1em;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}
[hidden] {
  display: none !important;
}

/* Layout */
.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 720px) {
  .wrap {
    padding-inline: 32px;
  }
}
.section {
  padding-block: clamp(40px, 6vw, 84px);
}
.section + .section {
  border-top: 1px solid var(--border);
}
.section-lead {
  max-width: 62ch;
  color: var(--text-dim);
  font-size: 1.125rem;
}
.eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 0.75em;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--header-bg, var(--bg));
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
  min-height: 64px;
  padding-block: 10px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 1.25rem;
  text-decoration: none;
  margin-right: auto;
}
.brand:hover {
  color: var(--text);
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 2px;
  display: inline-block;
  font-size: 0.975rem;
}
.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}
.theme-toggle {
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 36px;
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--accent-text);
}

@media (max-width: 719px) {
  .site-header .wrap {
    gap: 4px 12px;
  }
  .theme-toggle {
    order: 2;
  }
  .site-nav {
    order: 3;
    width: 100%;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 8px;
  padding: 12px 22px;
  min-height: 48px;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
}
.btn-primary {
  background: var(--accent-solid);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent-solid-hover);
  color: var(--on-accent);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--accent-text);
  color: var(--text);
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Cards, chips, figures */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.chip {
  display: inline-block;
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}
figure {
  margin: 0;
}
figcaption {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 10px;
  max-width: 80ch;
}
.only-dark,
.only-light {
  display: none;
}
:root:not([data-theme='light']) .only-dark {
  display: block;
}
:root[data-theme='light'] .only-light {
  display: block;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .only-dark {
    display: none;
  }
  :root:not([data-theme='dark']) .only-light {
    display: block;
  }
}
:root[data-theme='dark'] .only-dark {
  display: block;
}
:root[data-theme='dark'] .only-light {
  display: none;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 36px;
  color: var(--text-dim);
  font-size: 0.95rem;
  background: var(--footer-bg, var(--bg));
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  justify-content: space-between;
}
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}
.site-footer a {
  color: var(--text-dim);
}
.site-footer a:hover {
  color: var(--text);
}
.site-footer p {
  margin: 0 0 6px;
}

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