/* Reset, type scale, layout primitives, texture.
   See docs/LANDING-DESIGN-LANGUAGE.md §5.3–5.5. */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

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

::selection {
  background: rgba(53, 105, 111, 0.22);
}

/* ---------------------------------------------------------------- type ---- */

.display {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--fg);
  text-wrap: balance;
}

.display-1 {
  font-size: var(--display-1);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.display-2 {
  font-size: var(--display-2);
  line-height: 1.06;
  letter-spacing: -0.018em;
}

.display-3 {
  font-size: var(--display-3);
  line-height: 1.12;
  letter-spacing: -0.015em;
}

/* The one emphasis device: a single phrase per headline in serif italic. */
.em {
  font-style: italic;
}

/* Rex's two-tone headline — the second sentence drops to the tertiary ink. */
.dim {
  color: var(--fg-3);
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow--muted {
  color: var(--fg-3);
}

.lead {
  font-size: var(--lead);
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 52ch;
  text-wrap: pretty;
}

.prose {
  color: var(--fg-2);
  max-width: var(--measure);
  text-wrap: pretty;
}

.small {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--fg-2);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- layout ---- */

.shell {
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.band {
  position: relative;
  padding-block: var(--band-y);
  background: var(--surface);
  color: var(--fg);
}

.band--tight {
  padding-block: clamp(3rem, 6vw, 4.5rem);
}

.band--inset {
  --surface: var(--paper-3);
}

.band--night {
  --surface: var(--night);
}

.band + .band:not([data-surface="night"]):not(.band--inset) {
  border-top: 1px solid var(--rule);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
}

.col-12 {
  grid-column: span 12;
}

.col-6,
.col-4 {
  grid-column: span 12;
}

@media (min-width: 760px) {
  .col-6 {
    grid-column: span 6;
  }
  .col-4 {
    grid-column: span 6;
  }
}

@media (min-width: 1040px) {
  .col-4 {
    grid-column: span 4;
  }
}

.stack {
  display: flex;
  flex-direction: column;
}

.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.gap-40 { gap: 40px; }

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* Full-height hairlines at the content gutters. Derya, Litmus and Rex all run
   these; they are the cheapest way to make a page feel drafted rather than
   stacked. Hidden below the point where the content column starts to hug. */
.rails {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.rails span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}

@media (min-width: 1320px) {
  .rails {
    display: block;
  }
  .rails span:nth-child(1) {
    left: calc(50% - var(--content) / 2);
  }
  .rails span:nth-child(2) {
    left: calc(50% + var(--content) / 2);
  }
}

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

/* A single grain layer, reused by the hero and the night bands. 3–4% opacity,
   which is the level at which it reads as paper rather than as noise. */
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-surface="night"].grain::after {
  opacity: 0.05;
}

/* ------------------------------------------------------------- motion ---- */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--t-reveal) var(--ease-out),
    transform var(--t-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

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

@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;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------- a11y ---- */

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

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-200%);
  padding: 10px 16px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  font-weight: 500;
  transition: transform var(--t-hover) var(--ease-out);
}

.skip-link:focus-visible {
  transform: none;
}
