/* ==========================================================================
 * Pet Field Guide — Base Layer (styles/base.css)
 * Reset, typography scale, tabular numerals, focus rings, layout containers,
 * and alternating Alabaster / Sand-Linen editorial bands.
 * ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.66;
}

main {
  flex: 1 0 auto;
}

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

img {
  height: auto;
}

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

a,
button,
summary,
label,
input,
select,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent-ink);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.16s var(--ease-out);
}

a:hover {
  color: var(--btn-accent-hover);
}

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: 6px;
}

/* === Typography Scale === */

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 72, "SOFT" 50;
}

h1 {
  font-size: var(--text-hero);
  line-height: 1.1;
  margin-bottom: var(--space-4);
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

h2 {
  font-size: var(--text-2xl);
  line-height: 1.18;
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--text-lg);
  line-height: 1.28;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

p {
  margin: 0 0 var(--space-4);
  color: var(--ink-2);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--ink);
  font-weight: 600;
}

code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-sand);
  color: var(--ink);
}

.lead {
  font-size: var(--text-lg);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 62ch;
  margin: 0;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: var(--space-3);
}

.tabular,
.num,
.kpi-val,
.odor-score-num,
input[type="number"],
td,
svg text {
  font-variant-numeric: tabular-nums;
}

/* === Layout Containers === */

.wrap,
.page-wrap {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-7);
}

.page-wrap-catalog,
body[data-tool="safety"] .wrap,
body[data-tool="safety"] .page-wrap {
  max-width: var(--container-catalog);
}

.page-wrap {
  padding-top: var(--space-8);
  padding-bottom: var(--space-16);
}

.wrap {
  padding-bottom: var(--space-14);
}

/* Full-bleed alternating Warm Sand-Linen editorial band
 * WCAG AA Rule: Small captions inside .band-sand use --ink-2 (7.00:1 AAA), NEVER --ink-3! */
.band-sand {
  position: relative;
  background: var(--surface-sand);
  padding: var(--space-14) 0;
  margin: var(--space-12) calc(50% - 50vw);
  width: 100vw;
}

.band-sand-inner {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-7);
}

.band-sand p,
.band-sand .sec-sub,
.band-sand .muted-copy {
  color: var(--ink-2);
}

.sec,
.section-block {
  margin-top: var(--space-14);
}

.section-block:first-child {
  margin-top: 0;
}

/* === Utility Helpers === */

.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;
}

.card-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}

.card-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

/* === Responsive Container Padding === */

@media (max-width: 1020px) {
  .card-grid-3,
  .card-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .wrap,
  .page-wrap,
  .band-sand-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  .page-wrap {
    padding-top: var(--space-6);
    padding-bottom: var(--space-12);
  }

  .band-sand {
    padding: var(--space-10) 0;
    margin-top: var(--space-10);
    margin-bottom: var(--space-10);
  }

  .sec,
  .section-block {
    margin-top: var(--space-10);
  }

  .card-grid-2,
  .card-grid-3,
  .card-grid-4 {
    grid-template-columns: 1fr;
  }
}

@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;
  }
}
