/*
 * AvertGrid site: design tokens, typography, frame (header, footer), buttons and shared pieces.
 * Direction: "instrument and document". Calm institutional neutrals (warm paper / deep ink), one cobalt accent,
 * decision colours used only for decisions and severities, always paired with a word. Every text pair meets
 * WCAG 2.1 AA. Motion only where it explains, and none under prefers-reduced-motion.
 */
:root {
  --font-sans: 'Noto Sans Variable', 'Noto Sans Georgian Variable', system-ui, sans-serif;
  --font-mono: 'Noto Sans Mono Variable', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.35rem, 1.1rem + 0.9vw, 1.75rem);
  --step-3: clamp(1.85rem, 1.25rem + 2.2vw, 3.1rem);
  --step-4: clamp(2.4rem, 1.4rem + 4vw, 5rem);
  --step-5: clamp(2.6rem, 1.3rem + 4.4vw, 5.4rem);
  --track-display: -0.035em;
  --track-heading: -0.025em;
  --radius-lg: 16px;
  --space-section: clamp(72px, 9vw, 128px);
  --glow-accent: rgb(92 132 255 / 22%);

  /* The instrument panel is dark in both themes. */
  --panel: #060a11;
  --panel-2: #0b111b;
  --panel-line: #1a2331;
  --panel-text: #e9ecf1;
  --panel-muted: #9aa5b5;
  --panel-faint: #7d8899;
  --panel-accent: #8eb0ff;
}

:root,
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efeee8;
  --text: #0b1320;
  --muted: #475162;
  --faint: #5d6676;
  --line: #dcdbd3;
  --line-strong: #b9b8ae;
  --accent: #1d47c4;
  --accent-soft: #e6ecfb;
  --btn-bg: #0b1320;
  --btn-text: #ffffff;
  --btn-hover: #1d2a40;
  --focus: #1d47c4;
  --pass: #17663a;
  --pass-bg: #e3f2e8;
  --fail: #b3261e;
  --fail-bg: #fbe8e6;
  --warn: #7a5300;
  --warn-bg: #fbf0d6;
  --shadow: 0 1px 2px rgb(11 19 32 / 6%), 0 12px 32px -12px rgb(11 19 32 / 18%);
  --glow-accent: rgb(29 71 196 / 9%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #080c13;
    --surface: #0e141e;
    --surface-2: #131b27;
    --text: #e8ebf0;
    --muted: #a6afbd;
    --faint: #8f99a8;
    --line: #1e2735;
    --line-strong: #323e50;
    --accent: #8eb0ff;
    --accent-soft: #15203a;
    --btn-bg: #f1f0ea;
    --btn-text: #0b1320;
    --btn-hover: #ffffff;
    --focus: #8eb0ff;
    --pass: #5ccf8a;
    --pass-bg: #0f2a1b;
    --fail: #ff8a80;
    --fail-bg: #351414;
    --warn: #f0c35a;
    --warn-bg: #2e2410;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 16px 40px -16px rgb(0 0 0 / 70%);
    --glow-accent: rgb(92 132 255 / 16%);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #080c13;
  --surface: #0e141e;
  --surface-2: #131b27;
  --text: #e8ebf0;
  --muted: #a6afbd;
  --faint: #8f99a8;
  --line: #1e2735;
  --line-strong: #323e50;
  --accent: #8eb0ff;
  --accent-soft: #15203a;
  --btn-bg: #f1f0ea;
  --btn-text: #0b1320;
  --btn-hover: #ffffff;
  --focus: #8eb0ff;
  --pass: #5ccf8a;
  --pass-bg: #0f2a1b;
  --fail: #ff8a80;
  --fail-bg: #351414;
  --warn: #f0c35a;
  --warn-bg: #2e2410;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 16px 40px -16px rgb(0 0 0 / 70%);
  --glow-accent: rgb(92 132 255 / 16%);
}

/* Georgian has no case and wider glyphs: looser tracking, slightly smaller display sizes. */
:root:lang(ka) {
  --track-display: -0.01em;
  --track-heading: -0.006em;
  --step-5: clamp(2.05rem, 1.05rem + 3.4vw, 4.1rem);
  --step-4: clamp(1.85rem, 1.1rem + 2.7vw, 3.5rem);
  --step-3: clamp(1.6rem, 1.1rem + 1.7vw, 2.6rem);
  --step-2: clamp(1.25rem, 1.05rem + 0.7vw, 1.55rem);
}

/* Georgian headings: the variable width axis keeps long words from dominating a line. */
:root:lang(ka) h1,
:root:lang(ka) h2 {
  font-stretch: 92%;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: var(--track-heading);
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

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

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-radius: var(--radius-sm);
}

.skip:focus {
  top: 12px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

:root:lang(ka) .eyebrow {
  letter-spacing: 0.02em;
}

.eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  background: currentColor;
  opacity: 0.6;
}

.lead {
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 62ch;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
}

.btn-primary:hover {
  background: var(--btn-hover);
}

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

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

.btn .arrow {
  transition: transform 160ms var(--ease);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

.btn-sm {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.9375rem;
}

.text-link {
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* ---------- reveal on scroll (only with JS and without reduced motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 700ms var(--ease), transform 700ms var(--ease);
  }

  .js .reveal.is-in {
    opacity: 1;
    transform: none;
  }

  .js .reveal[data-delay='1'] {
    transition-delay: 90ms;
  }

  .js .reveal[data-delay='2'] {
    transition-delay: 180ms;
  }

  .js .reveal[data-delay='3'] {
    transition-delay: 270ms;
  }
}

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

.section-head {
  display: grid;
  gap: 18px;
  max-width: 860px;
  margin-bottom: clamp(40px, 5vw, 72px);
}

/* A heading with a lead: on wide screens the lead sits beside the heading instead of under it. */
@media (min-width: 1100px) {
  .section-head.wide {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: start;
    gap: 18px 64px;
    max-width: none;
  }

  .section-head.wide .eyebrow {
    grid-column: 1 / -1;
  }

  .section-head.wide .lead {
    padding-top: 0.6em;
  }
}

.section-head .eyebrow {
  margin-bottom: 0;
}

.section-head h2,
.display-2 {
  font-size: var(--step-4);
  font-weight: 680;
  line-height: 1.04;
  letter-spacing: var(--track-display);
}

:root:lang(ka) .section-head h2,
:root:lang(ka) .display-2 {
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1.18;
}

/* Small monospaced capitals: labels on instruments, frames and documents. */
.label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root:lang(ka) .label {
  letter-spacing: 0.02em;
}

/* Soft accent light behind a showpiece (decorative only). */
.glow {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-accent), transparent);
  filter: blur(8px);
}

.notice {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9375rem;
}

.notice-warn {
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: var(--warn-bg);
  color: var(--text);
}

.tag-inline {
  display: inline-block;
  margin-inline-end: 6px;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 650;
}
