/* Magsolar design system: tokens, reset, base elements, shared utilities */

:root {
  /* Neutrals, tinted slightly toward navy */
  --color-bg: #ffffff;
  --color-surface: #f4f6fa;
  --color-surface-strong: #e7ecf5;
  --color-border: #dbe2ec;
  --color-text: #0a1f44;
  --color-muted: #5a6478;
  --color-navy: #0a1f44;
  --color-navy-deep: #061530;
  --color-on-dark: #ffffff;
  --color-on-dark-muted: #b8c6de;

  /* Primary: solar yellow, used only for actions and active states */
  --color-primary: #f5a623;
  --color-primary-hover: #dd8f0e;
  --color-primary-active: #c07c08;
  --color-primary-soft: #fdf1d8;
  --color-primary-contrast: #0a1f44;

  /* Semantic */
  --color-success: #1a7f4b;
  --color-danger: #b3261e;

  --font-heading: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.85vw, 1.75rem);
  --text-2xl: clamp(1.75rem, 1.35rem + 1.7vw, 2.5rem);
  --text-3xl: clamp(2.25rem, 1.55rem + 3vw, 3.5rem);

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --leading-tight: 1.12;
  --leading-snug: 1.3;
  --leading-normal: 1.65;
  --tracking-tight: -0.02em;
  --tracking-wide: 0.08em;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --radius-sm: 0.375rem;
  --radius: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgb(10 31 68 / 0.06);
  --shadow: 0 1px 2px rgb(10 31 68 / 0.05), 0 8px 24px rgb(10 31 68 / 0.07);
  --shadow-lg: 0 2px 4px rgb(10 31 68 / 0.05), 0 24px 60px rgb(10 31 68 / 0.13);

  --container: 74rem;
  --section-padding: var(--space-16);
}

@media (min-width: 64rem) {
  :root {
    --section-padding: var(--space-24);
  }
}

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

body {
  margin: 0;
  font: var(--weight-regular) var(--text-base) / var(--leading-normal) var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3,
h4,
p,
figure,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

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

a {
  color: inherit;
}

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

/* Base elements */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
}

h4 {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semibold);
}

p {
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Utilities */
.container {
  width: min(100% - 2 * var(--space-6), var(--container));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2 * var(--space-6), 48rem);
}

.section {
  padding-block: var(--section-padding);
}

.section--surface {
  background: var(--color-surface);
}

.section--navy {
  background: var(--color-navy);
  color: var(--color-on-dark);
}

.eyebrow {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}

.section--navy .eyebrow {
  color: var(--color-on-dark-muted);
}

.lead {
  font-size: var(--text-lg);
  color: var(--color-muted);
  max-width: 62ch;
}

.section--navy .lead {
  color: var(--color-on-dark-muted);
}

.section-head {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-12);
  max-width: 62ch;
}

.section-head--center {
  justify-items: center;
  text-align: center;
  margin-inline: auto;
}

.section-head h2 + p {
  margin-top: calc(-1 * var(--space-1));
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-navy);
  color: var(--color-on-dark);
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.875rem;
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.btn:hover {
  background: var(--color-primary-hover);
}

.btn:active {
  background: var(--color-primary-active);
  transform: translateY(1px);
}

.btn--dark {
  background: var(--color-navy);
  color: var(--color-on-dark);
}

.btn--dark:hover {
  background: var(--color-navy-deep);
}

.btn--dark:active {
  background: var(--color-navy-deep);
}

.btn--outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn--outline:hover {
  background: var(--color-surface);
  border-color: var(--color-text);
  color: var(--color-text);
}

.btn--outline:active {
  background: var(--color-surface-strong);
}

.btn--outline-light {
  background: transparent;
  color: var(--color-on-dark);
  border-color: rgb(255 255 255 / 0.35);
}

.btn--outline-light:hover {
  background: rgb(255 255 255 / 0.12);
  border-color: var(--color-on-dark);
  color: var(--color-on-dark);
}

.btn--lg {
  min-height: 3.25rem;
  padding: var(--space-4) var(--space-8);
}

.btn--full {
  width: 100%;
}

.btn .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 4px;
  transition: text-decoration-color 180ms ease, gap 180ms ease;
  min-height: 2.5rem;
}

.link-arrow:hover {
  text-decoration-color: var(--color-primary);
  gap: var(--space-3);
}

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

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