/* =============================================================================
   Base styles — Crelyra public-site F1
   Reset, typography system, motion preferences, focus, utilities
   ============================================================================= */

/* ── Box model ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ── Minimal reset ─────────────────────────────────────────────────────── */
body,
h1, h2, h3, h4, h5, h6,
p, ul, ol, li,
dl, dt, dd,
blockquote, pre, code,
figure, figcaption,
table, caption, thead, tbody, tr, th, td,
form, fieldset, legend, label,
button, input, select, textarea,
details, summary {
  margin: 0;
  padding: 0;
}

/* ── Root & body ───────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Typography: display / body / mono ────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  line-height: var(--leading-normal);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ── Uppercase eyebrow label ───────────────────────────────────────────── */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Interactive targets: minimum 44×44px ─────────────────────────────── */
button,
[role="button"],
a,
input,
select,
textarea,
label[for],
summary {
  min-width: 44px;
  min-height: 44px;
}

/* ── Focus ring: 3px accessible violet, 3px offset ────────────────────── */
:focus-visible {
  outline: 3px solid var(--violet-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ── Selection ─────────────────────────────────────────────────────────── */
::selection {
  background-color: var(--violet);
  color: var(--ink);
}

/* ── Scrollbar (WebKit) ───────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--paper);
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── Links ────────────────────────────────────────────────────────────── */
a {
  color: var(--violet-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--coral-ink);
}

a[rel="noopener"] {
  /* intentionally noop */
}

/* ── Images ───────────────────────────────────────────────────────────── */
img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Lists ─────────────────────────────────────────────────────────────── */
ul, ol {
  padding-left: var(--space-5);
}
li {
  margin-block: var(--space-1);
}

/* ── Table ─────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
th, td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
th {
  font-weight: 600;
  color: var(--ink);
  background-color: var(--card);
}

/* ── Container ─────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* ── Skip link ─────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--violet);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-1);
  transition: top var(--duration-fast) var(--ease-default);
}

.skip-link:focus {
  top: var(--space-4);
}

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

/* ── Responsive typography ─────────────────────────────────────────────── */
@media (max-width: 1080px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
}

@media (max-width: 700px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }

  .container {
    padding-inline: var(--space-4);
  }
}

/* ── Visually hidden (accessible) ─────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
