/* =============================================================================
   Open Atlas – base styles: reset, typography, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  font-weight: 400;
  overflow-x: hidden;
}

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

a {
  color: var(--accent-ember-bright);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover,
a:focus-visible {
  color: var(--text-primary);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

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

hr {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-6) 0;
}

::selection {
  background: var(--accent-ember);
  color: var(--text-inverse);
}

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

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

p, li, dd {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1 { font-size: var(--fs-5xl); font-weight: 500; }
h2 { font-size: var(--fs-4xl); }
h3 { font-size: var(--fs-3xl); }
h4 { font-size: var(--fs-2xl); font-family: var(--font-ui); font-weight: 600; letter-spacing: var(--ls-snug); }
h5 { font-size: var(--fs-xl); font-family: var(--font-ui); font-weight: 600; letter-spacing: var(--ls-snug); }
h6 { font-size: var(--fs-md); font-family: var(--font-ui); font-weight: 700; letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--text-secondary); }

p {
  margin: 0 0 var(--sp-3);
  max-width: 62ch;
}

.lede {
  font-size: var(--fs-lg);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  max-width: 56ch;
}

blockquote {
  margin: var(--sp-5) 0;
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--accent-ember);
  background: var(--bg-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-style: italic;
  color: var(--text-primary);
}

ul, ol {
  margin: 0 0 var(--sp-3);
  padding-left: 1.25rem;
}

li {
  margin-bottom: var(--sp-1);
  max-width: 62ch;
}

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

code {
  padding: 0.08em 0.35em;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  color: var(--accent-sand);
}

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }

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

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

.stack > * + * {
  margin-top: var(--sp-3);
}

.stack--lg > * + * {
  margin-top: var(--sp-5);
}

.stack--xl > * + * {
  margin-top: var(--sp-7);
}

.row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Accessibility helpers ---- */

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: var(--sp-1) var(--sp-2);
  background: var(--accent-ember);
  color: var(--text-inverse);
  font-weight: 600;
  z-index: 1000;
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: 0;
}

/* ---- Utility: gradient text and eyebrows ---- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--accent-ember-bright);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 1.5rem;
  height: 1px;
  background: var(--accent-ember);
}

.display-sunrise {
  background: var(--grad-sunrise);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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