/* ============================================================================
   base.css  —  reset, typography, element defaults
   ----------------------------------------------------------------------------
   Hand-written minimal reset. Not a third-party dependency. Every rule here
   exists for a specific reason that's commented inline. Consumes tokens.css.
============================================================================ */

/* ---- @font-face: Messina Sans (Prospero brand typeface, commercial license)
   Self-hosted TTF. Discrete weights (no variable file available). */
@font-face {
  font-family: "Messina Sans";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/MessinaSans-Light.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/MessinaSans-LightItalic.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/MessinaSans-Book.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/MessinaSans-BookItalic.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/MessinaSans-SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/MessinaSans-SemiBoldItalic.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/MessinaSans-Bold.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/MessinaSans-BoldItalic.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("../fonts/MessinaSans-Black.ttf") format("truetype");
}
@font-face {
  font-family: "Messina Sans";
  font-style: italic;
  font-weight: 900;
  font-display: swap;
  src: url("../fonts/MessinaSans-BlackItalic.ttf") format("truetype");
}

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

/* ---- Remove default margins; we set them deliberately per element ------- */
html, body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote,
dl, dd, ul, ol {
  margin: 0;
}

/* ---- Root element defaults --------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;            /* iOS Safari rotate zoom */
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;  /* no grey flash on iOS tap */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--line-height-normal);
  color: var(--color-fg);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- Media defaults ----------------------------------------------------- */
img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }

/* Preserve SVG fill=currentColor behaviour */
svg { fill: currentColor; }

/* ---- Form elements inherit type ---------------------------------------- */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

/* ---- Headings ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semi);
  line-height: var(--line-height-tight);
  letter-spacing: -0.015em;
  color: var(--color-fg);
  text-wrap: balance;             /* progressive enhancement */
}

h1 { font-size: var(--step-6); font-weight: var(--font-weight-bold); letter-spacing: -0.02em; }
h2 { font-size: var(--step-5); letter-spacing: -0.02em; }
h3 { font-size: var(--step-3); }
h4 { font-size: var(--step-2); }
h5 { font-size: var(--step-1); }
h6 { font-size: var(--step-0); text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-fg-quiet); }

/* ---- Paragraph & text ------------------------------------------------- */
p {
  max-width: var(--container-measure);
  text-wrap: pretty;              /* progressive enhancement */
}

strong, b { font-weight: var(--font-weight-semi); }
em, i { font-style: italic; }

small { font-size: var(--step--1); }

/* ---- Links ------------------------------------------------------------ */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--color-link) 40%, transparent);
  transition: color var(--duration-fast) var(--ease-standard),
              text-decoration-color var(--duration-fast) var(--ease-standard);
}
a:hover {
  color: var(--color-link-hover);
  text-decoration-color: currentColor;
}

/* ---- Focus visibility --------------------------------------------------
   Never remove outlines without replacing them. Accessible-by-default focus
   ring uses the accent colour token. */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-1);
}
:focus:not(:focus-visible) { outline: none; }

/* ---- Lists ------------------------------------------------------------ */
ul, ol {
  padding-left: 1.25em;
}
ul li, ol li { margin-block: var(--space-1); }

/* Unstyled list utility */
.list-reset {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.list-reset li { margin: 0; }

/* ---- Quotes ----------------------------------------------------------- */
blockquote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  font-size: var(--step-2);
  color: var(--color-fg);
  font-style: italic;
}
blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--step-0);
  font-style: normal;
  color: var(--color-fg-muted);
}

/* ---- Code ------------------------------------------------------------- */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.95em;
}
:not(pre) > code {
  background: var(--color-paper-soft);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-1);
  border: 1px solid var(--color-border);
}
pre {
  padding: var(--space-5);
  background: var(--color-paper-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-3);
  overflow-x: auto;
  line-height: var(--line-height-normal);
}

/* ---- Horizontal rule -------------------------------------------------- */
hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-7);
}

/* ---- Tables ----------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th, td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
th {
  font-weight: var(--font-weight-semi);
  color: var(--color-fg-muted);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Selection -------------------------------------------------------- */
::selection {
  background: var(--color-accent);
  color: var(--color-accent-ink);
}

/* ---- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Utility: visually hidden (for screen-reader-only text) ----------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Skip link -------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -999px;
  left: var(--space-4);
  background: var(--color-ink);
  color: var(--color-paper);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-2);
  text-decoration: none;
  z-index: var(--z-modal);
}
.skip-link:focus {
  top: var(--space-4);
  color: var(--color-paper);
}

/* ---- Prose defaults for long-form content (blog posts, legal) --------- */
.prose {
  max-width: var(--container-measure);
}
.prose > * + * { margin-top: var(--space-5); }
.prose h2 { margin-top: var(--space-8); font-size: var(--step-4); }
.prose h3 { margin-top: var(--space-7); font-size: var(--step-2); }
.prose h4 { margin-top: var(--space-6); font-size: var(--step-1); }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose img { border-radius: var(--radius-3); margin-block: var(--space-6); }
.prose figure { margin-block: var(--space-6); }
.prose figcaption {
  font-size: var(--step--1);
  color: var(--color-fg-quiet);
  text-align: center;
  margin-top: var(--space-2);
}
