/**
 * =============================================================================
 * HIPHEN DIGITAL PHENOTYPING — Base Styles
 * =============================================================================
 * Global reset + base element styles.
 * NO component styles here. NO hardcoded values.
 * ALL values reference tokens from variables.css (the single source of truth).
 * =============================================================================
 */

/* ---------------------------------------------------------------------------
 * FONTS — Gilroy via @font-face local
 * --------------------------------------------------------------------------- */
@font-face {
  font-family: 'Gilroy';
  src: url('../fonts/Gilroy-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('../fonts/Gilroy-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('../fonts/Gilroy-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy';
  src: url('../fonts/Gilroy-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------------------
 * RESET
 * --------------------------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
 * HTML & BODY
 * --------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-inter);
  font-size: var(--text-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh-loose);
  background-color: var(--color-dark);
  color: var(--color-white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------------------------------------------------------------------------
 * TYPOGRAPHY — Headings
 * --------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-gilroy);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--color-white);
}

h1 {
  font-size: var(--text-4xl);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--text-3xl);
  line-height: var(--lh-snug);
}

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

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

/* ---------------------------------------------------------------------------
 * LINKS
 * --------------------------------------------------------------------------- */
a {
  color: var(--color-white);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover,
a:focus-visible {
  color: var(--color-light-green);
}

a:focus-visible {
  outline: 2px solid var(--color-light-green);
  outline-offset: 3px;
  border-radius: 2px;
}

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

/* ---------------------------------------------------------------------------
 * LISTS
 * --------------------------------------------------------------------------- */
ul, ol {
  list-style: none;
}

/* ---------------------------------------------------------------------------
 * BUTTONS (base reset — component styles in component files)
 * --------------------------------------------------------------------------- */
button {
  cursor: pointer;
  font-family: var(--font-gilroy);
  border: none;
  background: transparent;
  color: inherit;
}

button:focus-visible {
  outline: 2px solid var(--color-light-green);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------------------
 * FORMS
 * --------------------------------------------------------------------------- */
input,
textarea,
select {
  font-family: var(--font-inter);
  font-size: var(--text-md);
  color: var(--color-white);
  background: transparent;
  border: none;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-white-40);
}

/* ---------------------------------------------------------------------------
 * LAYOUT UTILITIES
 * --------------------------------------------------------------------------- */
/* Site-wide content rail.
 * The effective *visible* content width on desktop must equal
 * --container-content (1200px). Since the container also carries the
 * --padding-x gutter (120px), its outer max-width has to be
 *   content + 2 × gutter = 1440px
 * so that 1200px of content sits inside the gutters.
 * This used to be repeated per page (home / solutions / crops);
 * it is now the single source of truth — every page using .container
 * gets the 1200px-visible rule for free. */
.container {
  max-width: calc(var(--container-content) + 2 * var(--padding-x));
  margin-inline: auto;
  padding-inline: var(--padding-x);
}

.container--wide {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--padding-x);
}

/* ---------------------------------------------------------------------------
 * SKIP TO CONTENT (accessibility)
 * --------------------------------------------------------------------------- */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-8);
  z-index: 9999;
  padding: var(--space-4) var(--space-8);
  background: var(--color-light-green);
  color: var(--color-dark);
  font-family: var(--font-gilroy);
  font-weight: var(--fw-bold);
  font-size: var(--text-base);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: 0;
}

/* ---------------------------------------------------------------------------
 * SCREEN READER ONLY
 * --------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---------------------------------------------------------------------------
 * RESPONSIVE PADDING
 * --------------------------------------------------------------------------- */
/* Canonical responsive padding for the content rail — matches the
 * pattern previously duplicated in home / solutions / crops. */
@media (max-width: 1023px) {
  .container,
  .container--wide {
    padding-inline: var(--padding-x-md);
  }
}

@media (max-width: 767px) {
  .container,
  .container--wide {
    padding-inline: var(--padding-x-sm);
  }
}

/* ---------------------------------------------------------------------------
 * BACK-TO-TOP BUTTON (.back-to-top)
 * Global pill button injected by hiphen_render_back_to_top_button() in
 * functions.php. Fixed bottom-right, hidden by default (`inert`), revealed
 * once the user has scrolled past ~400px. All visual primitives come from
 * design tokens — same radial-green gradient + double-border pill family
 * as `.btn--primary` and the use-case-card arrow.
 * --------------------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: var(--space-12);
  /* Raised above the global Calendly badge widget (fixed bottom-right, ~60px
     tall including its own margin) so the two controls stack instead of
     overlapping. 56px clears the badge with a snug gap. */
  bottom: calc(var(--space-12) + 56px);
  z-index: var(--z-dropdown);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  color: var(--color-white);
  background: var(--gradient-radial-green);
  border: var(--border-pill);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity var(--transition-base),
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-cta);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--color-light-green);
  outline-offset: 3px;
}

.back-to-top__icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 767px) {
  .back-to-top {
    right: var(--space-8);
    /* Same Calendly-badge clearance as desktop, from the smaller mobile base. */
    bottom: calc(var(--space-8) + 56px);
    width: 44px;
    height: 44px;
  }

  .back-to-top__icon {
    width: 18px;
    height: 18px;
  }
}
