/* Reset, page frame and the primitives shared by every section. */

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

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  /* Anchor targets must clear the fixed header. */
  scroll-padding-top: calc(var(--header-height) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  line-height: 1.15;
  text-wrap: balance;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 600;
  transition: top var(--duration-fast);
}

.skip-link:focus {
  top: 0.5rem;
}

/* --- Layout ------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}

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

.section--alt {
  background: hsl(var(--section-alt));
}

.section--muted {
  background: hsl(var(--muted) / 0.4);
}

.section--gradient {
  background: var(--urgency-gradient);
  color: hsl(var(--primary-foreground));
}

.section__head {
  text-align: center;
  max-width: 40rem;
  margin-inline: auto;
  margin-bottom: 3rem;
}

.section__title {
  font-size: var(--text-section);
  font-weight: 700;
}

.section__subtitle {
  margin-top: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.section--gradient .section__subtitle {
  color: hsl(var(--primary-foreground) / 0.85);
}

.stack > * + * {
  margin-top: 1.5rem;
}

/* --- Icons -------------------------------------------------------------- */

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.icon--sm {
  width: 1rem;
  height: 1rem;
}

.icon--lg {
  width: 1.75rem;
  height: 1.75rem;
}

/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  transition:
    background-color var(--duration-fast),
    box-shadow var(--duration-fast),
    transform var(--duration-fast);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--lg {
  padding: 1rem 2rem;
  font-size: var(--text-base);
}

.btn--primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 8px 20px hsl(var(--primary) / 0.3);
}

.btn--primary:hover {
  background: hsl(var(--primary) / 0.9);
}

.btn--secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  box-shadow: 0 8px 20px hsl(var(--secondary) / 0.3);
}

.btn--secondary:hover {
  background: hsl(var(--secondary) / 0.9);
}

.btn--accent {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  box-shadow: 0 8px 20px hsl(var(--accent) / 0.3);
}

.btn--accent:hover {
  background: hsl(var(--accent) / 0.9);
}

.btn--outline {
  background: hsl(var(--background));
  border-color: hsl(var(--input));
  color: hsl(var(--foreground));
  font-weight: 500;
}

.btn--outline:hover {
  background: hsl(var(--muted));
}

/* Sits on the teal gradient, so it borrows the foreground colour instead. */
.btn--ghost-light {
  background: hsl(var(--primary-foreground) / 0.2);
  color: hsl(var(--primary-foreground));
}

.btn--ghost-light:hover {
  background: hsl(var(--primary-foreground) / 0.3);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

@media (max-width: 32rem) {
  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --- Cards -------------------------------------------------------------- */

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--duration-normal),
    transform var(--duration-normal);
}

.card--hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* --- Scroll reveal ------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition:
    opacity var(--duration-slow) var(--ease-out-expo),
    transform var(--duration-slow) var(--ease-out-expo);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
