/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; }
img, svg, video { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
input, button, textarea, select { font: inherit; }
:focus-visible { outline: 3px solid var(--c-accent-300); outline-offset: 2px; border-radius: 4px; }

html, body { height: 100%; }
html { overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  overflow-x: hidden;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

a {
  color: var(--c-link);
  text-decoration-color: var(--c-accent-300);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease),
              text-decoration-color var(--dur-fast) var(--ease);
}
a:hover {
  color: var(--c-link-hover);
  text-decoration-color: var(--c-warm);
}

::selection { background: var(--c-warm); color: var(--c-primary-700); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--c-primary-700);
  line-height: var(--lh-tight);
  margin: 2.4rem 0 1rem;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 16px);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}
h1 { font-size: clamp(1.9rem, 1.4rem + 1.6vw, var(--fs-3xl)); margin-top: 0; }
h2 { font-size: clamp(1.45rem, 1.2rem + 0.9vw, var(--fs-2xl)); }
h3 { font-size: clamp(1.18rem, 1.05rem + 0.5vw, var(--fs-xl)); }
h4 { font-size: var(--fs-lg); }
h5, h6 { font-size: var(--fs-md); }

p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.5rem; margin: 0 0 1rem; }
li { margin: 0.25rem 0; }

hr { border: 0; border-top: 1px solid var(--c-border-soft); margin: 2.5rem 0; }

blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 4px solid var(--c-accent);
  background: var(--c-surface-2);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--c-text-muted);
}

/* Layout containers */
.container {
  width: 100%;
  max-width: var(--max-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
/* Content pages use the same outer width as the global header/footer
   container, so the prose column visually aligns with the app bar. */
.container--prose {
  max-width: var(--max-page);
}
.prose-wrap {
  max-width: var(--max-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Skip link / a11y helpers */
.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;
}
.visually-hidden:focus,
.visually-hidden:active {
  position: static !important;
  width: auto; height: auto; margin: 0; overflow: visible;
  clip: auto; white-space: normal;
  background: var(--c-warm); color: var(--c-primary-700);
  padding: 0.5rem 1rem; border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Anchor permalinks */
.header-anchor {
  margin-left: 0.4rem;
  color: var(--c-border);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  font-weight: 500;
}
h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor,
.header-anchor:focus { opacity: 1; color: var(--c-accent); }
