/*
 * Base: reset, canvas, typography roles, links and the Hey Aira name.
 * Requires tokens.css.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

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

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background-color: var(--surface-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  letter-spacing: var(--type-text-track);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Pastel light behind frosted surfaces, and restrained grain. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(40rem 28rem at 94% -6%, rgb(221 232 242 / 0.95), transparent 70%),
    radial-gradient(32rem 24rem at -8% 56%, rgb(247 224 211 / 0.7), transparent 70%),
    radial-gradient(28rem 20rem at 72% 110%, rgb(245 236 200 / 0.8), transparent 70%);
}

body::after {
  background-image: var(--grain);
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}

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

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

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

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

::selection {
  background: var(--color-powder-deep);
  color: var(--color-ink-900);
}

/* ---------- Typography roles ---------- */

h1, .t-h1 {
  font-family: var(--font-serif);
  font-size: var(--type-h1-size);
  font-weight: 400;
  line-height: var(--type-h1-line);
  letter-spacing: var(--type-h1-track);
  font-optical-sizing: auto;
  text-wrap: balance;
}

h2, .t-h2 {
  font-family: var(--font-serif);
  font-size: var(--type-h2-size);
  font-weight: 400;
  line-height: var(--type-h2-line);
  letter-spacing: var(--type-h2-track);
  font-optical-sizing: auto;
  text-wrap: balance;
}

h3, .t-h3 {
  font-family: var(--font-sans);
  font-size: var(--type-h3-size);
  font-weight: var(--weight-medium);
  line-height: var(--type-h3-line);
  letter-spacing: var(--type-h3-track);
}

.t-lead {
  font-size: var(--type-lead-size);
  line-height: var(--type-lead-line);
  color: var(--text-secondary);
  text-wrap: pretty;
}

.t-body {
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--weight-regular);
  color: var(--text-secondary);
  text-wrap: pretty;
}

.t-small {
  font-size: var(--type-small-size);
  line-height: var(--type-small-line);
  color: var(--text-meta);
}

.t-label {
  font-family: var(--font-sans);
  font-size: var(--type-label-size);
  line-height: var(--type-label-line);
  font-weight: var(--weight-strong);
  color: var(--text-primary);
}

.t-mono, code, kbd, samp {
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
  line-height: var(--type-mono-line);
  letter-spacing: normal;
  font-variant-ligatures: none;
}

/* Metadata label: plain mono, sentence case, default tracking. */
.t-meta {
  font-family: var(--font-mono);
  font-size: var(--type-meta-size);
  line-height: var(--type-meta-line);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-meta);
}

/*
 * The Hey Aira name.
 * Identical family and scale to .t-meta. Plain text only:
 * no symbol, no split colour, no custom tracking, no case transform.
 */
.brand-name {
  font-family: var(--font-mono);
  font-size: var(--type-meta-size);
  line-height: var(--type-meta-line);
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

/*
 * Brand lockup: the dot followed by the name.
 * Used only in page chrome (site header, footer, app shell).
 * Inside cards and next to status chips, use .brand-name alone so the
 * brand dot is never confused with a status marker.
 */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: var(--brand-dot-gap);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.brand-dot {
  flex: none;
  width: var(--brand-dot-size);
  height: var(--brand-dot-size);
  border-radius: 50%;
  background: var(--brand-dot-color);
  transform: translateY(-0.5px); /* optical centre on the capitals, not the line box */
}

.brand-dot--standalone {
  --brand-dot-size: 1rem;
  transform: none;
}

/* ---------- Links ---------- */

.link {
  color: var(--text-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: rgb(30 68 214 / 0.35);
  transition: text-decoration-color var(--duration-fast) var(--ease-out);
}

.link:hover { text-decoration-color: currentColor; }

.link-standalone {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.link-standalone:hover { color: var(--text-link); }

.link-standalone .link-arrow {
  display: inline-block;
  transition: transform var(--duration-base) var(--ease-out);
}

.link-standalone:hover .link-arrow { transform: translateX(3px); }

.link-muted {
  color: var(--text-meta);
  text-decoration: none;
}

.link-muted:hover {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
