/* =========================================================================
   BASE — reset, typography, layout primitives
   Consumes tokens.css and hard-codes no colour, size or spacing value.
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  /* Inter ships a variable weight axis; never let the browser fake one. */
  font-synthesis-weight: none;
}

/* Keyboard users must always be able to see where they are on a ballot. */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1,
h2,
h3 {
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-3);
  font-weight: var(--weight-heading);
  letter-spacing: var(--tracking-heading);
  color: var(--text-primary);
  text-wrap: balance;
}
h1 {
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-heading-tight);
}
h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-6);
}
h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-5);
}

p {
  margin: 0 0 var(--space-4);
}
p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}
a:hover {
  color: var(--select-ink);
}

ul,
ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

code {
  font-family: var(--font-mono);
  font-size: 0.925em;
}

/* ---- layout ------------------------------------------------------------- */

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  width: 100%;
  max-width: var(--measure-narrow);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}
.main--wide {
  max-width: var(--measure-wide);
}

.stack > * + * {
  margin-top: var(--space-4);
}
.stack-tight > * + * {
  margin-top: var(--space-2);
}

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

.grid-2 {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-raised);
  color: var(--text-primary);
  border: var(--border-width-strong) solid var(--focus-ring);
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- text utilities ----------------------------------------------------- */

.quiet {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.lead {
  font-size: var(--text-lg);
  color: var(--text-primary);
}
.nowrap {
  white-space: nowrap;
}
.numeric {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
  color: var(--text-secondary);
}

@media print {
  .banner,
  .page-footer,
  .lang-switch,
  button,
  .admin-nav {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .card {
    border: 0;
    box-shadow: none;
  }
}
