/* ============================================================
   ScirDom Base Styles
   Reset, defaults, layout primitives, typography application.
   v2: Added accessibility, semantic elements, expanded utilities.
   ============================================================ */


/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: var(--color-ink-black);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

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

ul, ol { list-style: none; }
a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input { font: inherit; }


/* --- Accessibility: Skip Navigation --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: calc(var(--z-nav) + 1);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-mineral-teal);
  color: var(--color-white);
  font-size: var(--body-sm-size);
  font-weight: 600;
  border-radius: 0 0 var(--radius-button) var(--radius-button);
  transition: top var(--transition-fast);
}

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


/* --- Accessibility: Screen Reader Only --- */
.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;
}


/* --- Accessibility: Focus Visible --- */
:focus-visible {
  outline: 2px solid var(--color-mineral-teal);
  outline-offset: 2px;
}

/* Remove outline for mouse clicks where focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}


/* --- Body --- */
body {
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: var(--body-lh);
  color: var(--color-cool-slate);
  background-color: var(--color-ink-black);
  min-height: 100dvh;
  min-height: 100vh;
  overflow-x: clip;
}

.page-shell {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-off-white);
  overflow-x: clip;
}


/* --- Semantic Elements --- */
main {
  display: block; /* IE11 fallback */
  flex: 1 0 auto;
  min-height: 0;
}


/* --- Typography --- */
h1, .h1 {
  font-family: var(--font-heading);
  font-size: var(--h1-size);
  font-weight: var(--h1-weight);
  line-height: var(--h1-lh);
  letter-spacing: var(--h1-ls);
  color: var(--h1-color);
}

h2, .h2 {
  font-family: var(--font-heading);
  font-size: var(--h2-size);
  font-weight: var(--h2-weight);
  line-height: var(--h2-lh);
  letter-spacing: var(--h2-ls);
  color: var(--h2-color);
}

h3, .h3 {
  font-family: var(--font-heading);
  font-size: var(--h3-size);
  font-weight: var(--h3-weight);
  line-height: var(--h3-lh);
  letter-spacing: var(--h3-ls);
  color: var(--h3-color);
}

h4, .h4 {
  font-family: var(--font-heading);
  font-size: var(--h4-size);
  font-weight: var(--h4-weight);
  line-height: var(--h4-lh);
  letter-spacing: var(--h4-ls);
  color: var(--h4-color);
}

.body-lg {
  font-size: var(--body-lg-size);
  font-weight: var(--body-lg-weight);
  line-height: var(--body-lg-lh);
  color: var(--body-lg-color);
}

.body-sm {
  font-size: var(--body-sm-size);
  font-weight: var(--body-sm-weight);
  line-height: var(--body-sm-lh);
  color: var(--body-sm-color);
}

.caption {
  font-size: var(--caption-size);
  font-weight: var(--caption-weight);
  line-height: var(--caption-lh);
  letter-spacing: var(--caption-ls);
  color: var(--caption-color);
}

.label {
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  line-height: var(--label-lh);
  letter-spacing: var(--label-ls);
  color: var(--label-color);
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--code-size);
  font-weight: var(--code-weight);
  line-height: var(--code-lh);
  color: var(--code-color);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mono-sm {
  font-family: var(--font-mono);
  font-size: var(--code-sm-size);
  font-weight: var(--code-sm-weight);
  line-height: var(--code-sm-lh);
  color: var(--code-sm-color);
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* --- Layout: Content Wrapper --- */
.content-wrap {
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--content-padding);
  padding-right: var(--content-padding);
}

/* Narrow content column for legal pages (768px) */
.content-wrap--narrow {
  max-width: 768px;
}


/* --- Layout: 12-Column Grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  gap: var(--grid-gutter);
}

.grid > * {
  min-width: 0;
}

/* Common column spans */
.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* Common grid patterns to reduce inline grid-template-columns */
.grid--2col { grid-template-columns: 1fr 1fr; }
.grid--3col { grid-template-columns: repeat(3, 1fr); }
.grid--4col { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid--2col,
  .grid--3col {
    grid-template-columns: 1fr;
  }

  .grid--4col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  h1, .h1 {
    font-size: clamp(2rem, 10vw, 2.5rem);
    line-height: 1.08;
  }

  .grid--4col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .content-wrap {
    padding-left: 18px;
    padding-right: 18px;
  }
}


/* --- Section Backgrounds --- */
.bg-navy      { background-color: var(--color-deep-ink-navy); }
.bg-ink-black { background-color: var(--color-ink-black); }
.bg-white     { background-color: var(--color-white); }
.bg-off-white { background-color: var(--color-off-white); }
.bg-near-white{ background-color: var(--color-near-white); }


/* --- Section Spacing --- */
.section {
  width: 100%;
}

.section-pad-sm {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

.section-pad {
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-3xl);
}

.section-pad-lg {
  padding-top: var(--space-4xl);
  padding-bottom: var(--space-4xl);
}

/* Page header variant: 64px top, 32px bottom */
.section-pad-header {
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-xl);
}

/* Verify entry hero variant: 96px top, 64px bottom */
.section-pad-hero {
  padding-top: var(--space-4xl);
  padding-bottom: var(--space-3xl);
}


/* --- Links --- */
.link {
  color: var(--color-mineral-teal);
  transition: color var(--transition-fast);
}

.link:hover {
  color: var(--color-dark-teal);
}


/* --- Utility: Text --- */
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-white    { color: var(--color-white); }
.text-navy     { color: var(--color-deep-ink-navy); }
.text-teal     { color: var(--color-mineral-teal); }
.text-slate-400{ color: var(--color-silver-slate); }
.text-slate-300{ color: var(--color-light-slate); }
.text-warning  { color: var(--color-warning-amber); }
.text-success  { color: var(--color-verified-green); }
.font-semibold { font-weight: 600; }
.font-mono     { font-family: var(--font-mono); }

/* --- Utility: Flex --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start  { align-items: start; }
.items-stretch{ align-items: stretch; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* --- Utility: Gap --- */
.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.gap-xl  { gap: var(--space-xl); }
.gap-2xl { gap: var(--space-2xl); }

/* --- Utility: Spacing --- */
.mb-xs  { margin-bottom: var(--space-xs); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mb-3xl { margin-bottom: var(--space-3xl); }
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.pb-xl  { padding-bottom: var(--space-xl); }

/* --- Utility: Width --- */
.w-full  { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-prose { max-width: 640px; }
.max-w-sm    { max-width: 560px; }
