/*
 * Base styles: reset, typography, layout primitives and accessibility helpers.
 * Depends on tokens.css.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--awc-header-height) + var(--awc-space-4));
}

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

body {
  margin: 0;
  background: var(--awc-white);
  color: var(--awc-ink);
  font-family: var(--awc-font-body);
  font-size: var(--awc-text-body);
  font-weight: 400;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--awc-font-heading);
  font-weight: 700;
  letter-spacing: -0.015em;
  overflow-wrap: break-word;
  text-wrap: balance;
}

h1 { font-size: var(--awc-text-h1); line-height: 1.12; letter-spacing: -0.025em; }
h2 { font-size: var(--awc-text-h2); line-height: 1.2; }
h3 { font-size: var(--awc-text-h3); line-height: 1.3; }

p { margin: 0; text-wrap: pretty; }
p + p { margin-top: var(--awc-space-4); }

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

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

a { color: inherit; }

strong { font-weight: 600; }

/* Focus */
:focus-visible {
  outline: 3px solid var(--awc-link);
  outline-offset: 4px;
}

/* Layout primitives */
.awc-container {
  width: min(calc(100% - (var(--awc-gutter) * 2)), var(--awc-container));
  margin-inline: auto;
}

.awc-section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.awc-section--paper { background: var(--awc-paper); }
.awc-section--tint { background: var(--awc-yellow-wash); }

/* Subtle dotted-grid surface */
.awc-dotgrid {
  background-color: var(--awc-white);
  background-image: radial-gradient(circle, rgba(20, 20, 20, 0.10) 1px, transparent 1.5px);
  background-size: 22px 22px;
}

.awc-reading { max-width: var(--awc-reading-width); }

.awc-stack > * + * { margin-top: var(--awc-space-4); }

/* Text helpers */
.awc-lead {
  font-size: var(--awc-text-lead);
  line-height: 1.55;
  color: var(--awc-text-secondary);
}

.awc-lead--strong { color: var(--awc-ink); }

.awc-muted { color: var(--awc-text-secondary); }

.awc-mt-4 { margin-top: var(--awc-space-4); }

.awc-small {
  font-size: var(--awc-text-small);
  line-height: 1.5;
}

.awc-inline-link {
  color: var(--awc-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.awc-inline-link:hover { text-decoration-thickness: 2px; }

/* Dark surfaces */
.awc-dark {
  background: var(--awc-ink);
  color: var(--awc-text-on-dark);
}
.awc-dark :focus-visible { outline-color: var(--awc-yellow); }
.awc-dark .awc-inline-link { color: var(--awc-white); }
.awc-dark .awc-lead,
.awc-dark .awc-muted { color: var(--awc-text-secondary-on-dark); }

/* Accessibility */
.awc-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;
}

.awc-skip-link {
  position: absolute;
  top: var(--awc-space-2);
  left: var(--awc-space-2);
  z-index: 100;
  padding: var(--awc-space-3) var(--awc-space-4);
  border-radius: var(--awc-radius-button);
  background: var(--awc-ink);
  color: var(--awc-white);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.awc-skip-link:focus { transform: none; }
.awc-skip-link:focus-visible { outline-color: var(--awc-yellow); }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
