/* ==========================================================================
   VEXONA — Base: reset, typography, layout primitives, utilities
   Depends on tokens from themes.css.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

/* Safety net: an unforeseen wide element can never make the page scroll or zoom out sideways on a phone.
   `clip` (unlike `hidden`) does not create a scroll container, so position:sticky keeps working. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
  display: block;
}

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

img {
  height: auto;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-4xl);
  line-height: var(--lh-tight);
  font-weight: var(--fw-extrabold);
}
h2 {
  font-size: var(--fs-3xl);
  line-height: 1.15;
}
h3 {
  font-size: var(--fs-lg);
  letter-spacing: -0.015em;
}
h4 {
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

dl,
dd,
figure,
blockquote {
  margin: 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
legend {
  padding: 0;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease);
}
a:hover {
  text-decoration: underline;
}

/* Links inside running text must not rely on colour alone (WCAG 1.4.1): keep them underlined. */
p a:not([class]),
.check a,
.prose a,
.alert a,
.field__hint a,
.text-muted a,
.accordion__body a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* Visible focus for keyboard users, everywhere ---------------------------- */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Skip link --------------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: calc(var(--z-toast) + 10);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-md);
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus {
  transform: none;
  text-decoration: none;
}

/* Layout primitives ------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow {
  max-width: calc(var(--container-narrow) + var(--gutter) * 2);
}

.section {
  padding-block: var(--section-y);
}
.section--tight {
  padding-block: calc(var(--section-y) * 0.6);
}
.section--alt {
  background: var(--bg-subtle);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 44rem;
  margin-bottom: var(--space-10);
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head p {
  margin-top: var(--space-4);
  color: var(--text-muted);
  font-size: var(--fs-md);
}
.eyebrow {
  display: inline-block;
  margin-bottom: var(--space-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent-text);
}

/* Grids ------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: var(--space-5);
}
/* minmax(0, 1fr), never bare 1fr: a bare 1fr track can't shrink below its content's min-content
   width, so one long word or a horizontal scroller inside would blow the whole layout wider than the screen. */
.grid--2,
.grid--3,
.grid--4 {
  grid-template-columns: minmax(0, 1fr);
}

.stack > * + * {
  margin-top: var(--stack-gap, var(--space-4));
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--space-3));
}
.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Text utilities ---------------------------------------------------------- */
.text-muted {
  color: var(--text-muted);
}
.text-subtle {
  color: var(--text-subtle);
}
.text-accent {
  color: var(--accent-text);
}
.text-sm {
  font-size: var(--fs-sm);
}
.text-xs {
  font-size: var(--fs-xs);
}
.text-center {
  text-align: center;
}
.fw-semibold {
  font-weight: var(--fw-semibold);
}
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }

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

/* Rich text (legal pages, long descriptions) ------------------------------ */
.prose {
  max-width: 68ch;
  color: var(--text-muted);
}
.prose > * + * {
  margin-top: var(--space-4);
}
.prose h2 {
  margin-top: var(--space-10);
  font-size: var(--fs-2xl);
  color: var(--text);
}
.prose h3 {
  margin-top: var(--space-6);
  color: var(--text);
}
.prose ul {
  list-style: disc;
  padding-left: var(--space-6);
}
.prose ul li + li {
  margin-top: var(--space-2);
}
.prose strong {
  color: var(--text);
}
.prose a {
  text-decoration: underline;
}

/* Icons ------------------------------------------------------------------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--fill {
  fill: currentColor;
  stroke: none;
}
