/* ==========================================================================
   RVThere Labs — base layer
   Design direction: engineering broadsheet. Hairline rules, mono metadata,
   editorial marginalia, deliberate dark ground. See README for the system.
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------ */

:root {
  /* Ground and surfaces */
  --ink:            #08080A;
  --ink-sunken:     #050507;
  --ink-raised:     #0E0E13;
  --ink-raised-2:   #131319;

  /* Hairlines — the structural signature of this design */
  --rule:           rgba(255, 255, 255, .07);
  --rule-mid:       rgba(255, 255, 255, .12);
  --rule-strong:    rgba(255, 255, 255, .22);

  /* Text */
  --text:           #F2F3F6;
  --text-muted:     #A2A7B4;
  --text-dim:       #7B8090;

  /* Signal colours. Blue carries the brand; the rest classify content. */
  --accent:         #4DA3FF;
  --accent-bright:  #7CBEFF;
  --accent-ink:     #0A1B2E;
  --accent-wash:    rgba(77, 163, 255, .10);
  --accent-line:    rgba(77, 163, 255, .38);

  --amber:          #E8B25C;
  --mint:           #5FC79A;
  --violet:         #B98BE8;
  --rose:           #E07B9C;

  /* Type families */
  --font-display:   'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body:      'Geist', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:      'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Type scale */
  --text-micro:     11px;
  --text-meta:      12px;
  --text-sm:        13.5px;
  --text-base:      15px;
  --text-lg:        clamp(16px, .95rem + .25vw, 19px);
  --text-h3:        clamp(20px, 1.1rem + .5vw, 26px);
  --text-h2:        clamp(28px, 1.4rem + 2vw, 50px);
  --text-h1:        clamp(36px, 1.7rem + 3.4vw, 66px);
  --text-display:   clamp(38px, 1.8rem + 3.6vw, 68px);

  /* Space */
  --gutter:         clamp(20px, 4.5vw, 56px);
  --shell:          1220px;
  --shell-narrow:   980px;
  --section-y:      clamp(64px, 4rem + 4vw, 132px);

  /* Motion */
  --dur-fast:       140ms;
  --dur:            260ms;
  --dur-slow:       620ms;
  --ease:           cubic-bezier(.22, 1, .36, 1);

  color-scheme: dark;
}

/* --- Reset -------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  /* Sticky nav is 78px; keep anchored headings clear of it. */
  scroll-padding-top: 100px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.06;
  margin: 0;
  text-wrap: balance;
}

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

a { color: inherit; text-decoration: none; }

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

button, input, textarea, select { font: inherit; color: inherit; }

::selection { background: rgba(77, 163, 255, .28); }

/* Visible, designed focus — never remove the indicator. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 18px;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 0; }

/* --- Page texture ------------------------------------------------------- */

/* Faint graph-paper grid + grain. Fixed, non-interactive, behind everything. */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 15%, transparent 75%);
}

body::after {
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}
.shell--narrow { max-width: var(--shell-narrow); }

.section { padding-block: var(--section-y); position: relative; z-index: 1; }
.section--tight { padding-block: clamp(44px, 3rem + 2vw, 76px); }
.section--ruled { border-top: 1px solid var(--rule); }

/* Editorial marginalia: section number sits in the left margin on wide
   screens, and collapses above the heading on small ones. */
.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: clamp(36px, 3vw, 60px);
}
.section-head__body { max-width: 780px; }

@media (min-width: 900px) {
  .section-head { grid-template-columns: 148px minmax(0, 1fr); gap: 40px; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  display: block;
}
.eyebrow--muted { color: var(--text-dim); }

.lede {
  font-size: var(--text-lg);
  line-height: 1.62;
  color: var(--text-muted);
  max-width: 62ch;
}

.meta {
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  color: var(--text-dim);
  letter-spacing: .02em;
}

/* --- Reveal on scroll --------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* Nothing on the page may depend on motion to become readable. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
