/* ==========================================================================
   Earth Therapy — Foundation
   Reset, typography, layout primitives, buttons, forms, accessibility.

   No Liquid: this file is static and fully cacheable.
   No literal design values: every colour, size, space, radius and duration
   comes from a token in snippets/theme-tokens.liquid. If a value is not in
   the scale, the scale is wrong — do not hardcode around it.

   Breakpoints used across the whole theme, and nowhere any others:
     mobile   max-width: 749px
     tablet   min-width: 750px
     desktop  min-width: 990px
     wide     min-width: 1280px
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

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

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

@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;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--et-bg);
  color: var(--et-text);
  font-family: var(--et-font-body);
  font-size: var(--et-fs-md);
  line-height: var(--et-lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Prevent sideways scroll without making body a scroll container, which
     would break position: sticky on the header. `hidden` is the fallback for
     browsers without `clip`. */
  overflow-x: hidden;
  overflow-x: clip;
}

/* Locks the page while a drawer or modal owns the screen. */
body.et-scroll-locked {
  overflow: hidden;
}

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

img {
  height: auto;
}

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

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--et-border);
  margin: 0;
}

:target {
  scroll-margin-top: calc(var(--et-header-offset) + var(--et-space-md));
}

/* --------------------------------------------------------------------------
   Off-screen section rendering

   The homepage stacks nine sections, and the browser was doing full layout
   and paint for all of them before first paint. content-visibility lets it
   skip the ones nobody can see yet.

   The first two wrappers are excluded: the hero carries the LCP image and
   the USP bar sits with it above the fold, and skipping either would delay
   exactly the content this is meant to speed up.

   contain-intrinsic-size uses the auto keyword, so once a section has been
   rendered once the browser remembers its real height and the scrollbar
   stops moving under the visitor. Anchor targets and in-page find still
   reach inside a skipped section — the spec makes it relevant again when
   it is targeted.
   -------------------------------------------------------------------------- */

@supports (content-visibility: auto) {
  .template-index .et-main > .shopify-section:nth-child(n + 3) {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
  }
}

/* --------------------------------------------------------------------------
   2. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: var(--et-font-heading);
  font-weight: var(--et-heading-weight);
  text-transform: var(--et-heading-case);
  line-height: var(--et-lh-tight);
  letter-spacing: var(--et-ls-tight);
  text-wrap: balance;
}

h1,
.et-h1 {
  font-size: var(--et-h1);
}
h2,
.et-h2 {
  font-size: var(--et-h2);
}
h3,
.et-h3 {
  font-size: var(--et-h3);
}
h4,
.et-h4 {
  font-size: var(--et-h4);
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

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

strong,
b {
  font-weight: 600;
}

/* Type-scale utilities. These are the only font sizes components may use. */
.et-text-3xs {
  font-size: var(--et-fs-3xs);
}
.et-text-2xs {
  font-size: var(--et-fs-2xs);
}
.et-text-xs {
  font-size: var(--et-fs-xs);
}
small,
.et-text-sm {
  font-size: var(--et-fs-sm);
}
.et-text-md {
  font-size: var(--et-fs-md);
}
.et-text-lg {
  font-size: var(--et-fs-lg);
}
.et-text-xl {
  font-size: var(--et-fs-xl);
}

.et-text-muted {
  color: var(--et-text-muted);
}

.et-measure {
  max-width: var(--et-measure);
}

/* An uppercase micro-label, echoing the letterspaced packaging wordmark. */
.et-eyebrow {
  display: block;
  font-family: var(--et-font-heading);
  font-size: var(--et-fs-2xs);
  font-weight: 600;
  letter-spacing: var(--et-ls-wider);
  text-transform: uppercase;
  color: var(--et-accent-ink);
}

/* Rich text coming from Shopify (product descriptions, pages, articles). */
.et-rte > :first-child {
  margin-top: 0;
}

.et-rte > :last-child {
  margin-bottom: 0;
}

.et-rte h2,
.et-rte h3,
.et-rte h4 {
  margin: 1.6em 0 0.5em;
}

.et-rte a {
  color: var(--et-accent-ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.et-rte a:hover {
  text-decoration-thickness: 2px;
}

.et-rte ul,
.et-rte ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
  list-style: revert;
}

.et-rte li {
  margin-bottom: 0.35em;
}

.et-rte img {
  border-radius: var(--et-radius);
  margin: 1.5em 0;
}

.et-rte blockquote {
  margin: 1.5em 0;
  padding-left: 1.25em;
  border-left: 2px solid var(--et-accent);
  color: var(--et-text-muted);
}

/* Long-form reading, used on articles and policy pages. */
.et-rte--long {
  font-size: var(--et-fs-lg);
  line-height: var(--et-lh-loose);
}

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */

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

.et-container--narrow {
  max-width: var(--et-max-width-narrow);
}

.et-container--wide {
  max-width: var(--et-max-width-wide);
}

/* Sections own their vertical rhythm so templates stay free of spacing hacks. */
.et-section {
  padding-block: var(--et-section-gap);
}

.et-section--tight {
  padding-block: calc(var(--et-section-gap) * 0.5);
}

.et-section--flush-top {
  padding-top: 0;
}

.et-section--flush-bottom {
  padding-bottom: 0;
}

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

.et-section--soft {
  background: var(--et-accent-soft);
}

.et-stack > * + * {
  margin-top: var(--et-stack-gap, var(--et-space-md));
}

.et-section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--et-space-md);
  margin-bottom: clamp(var(--et-space-lg), 1rem + 1.5vw, var(--et-space-2xl));
}

.et-section__header--center {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.et-section__title-group {
  max-width: var(--et-measure);
}

.et-section__header--center .et-section__title-group {
  margin-inline: auto;
}

.et-section__description {
  margin-top: var(--et-space-sm);
  color: var(--et-text-muted);
}

.et-main {
  min-height: 50vh;
}

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */

.et-btn {
  --_bg: transparent;
  --_fg: var(--et-text);
  --_bd: transparent;

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--et-space-xs);
  min-height: calc(var(--et-tap-target) + var(--et-space-3xs));
  padding: var(--et-space-sm) var(--et-space-lg);
  border: 1px solid var(--_bd);
  border-radius: var(--et-radius-sm);
  background: var(--_bg);
  color: var(--_fg);
  font-family: var(--et-font-heading);
  font-size: var(--et-fs-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: var(--et-lh-tight);
  text-align: center;
  cursor: pointer;
  transition: background var(--et-dur) var(--et-ease),
    color var(--et-dur) var(--et-ease),
    border-color var(--et-dur) var(--et-ease),
    transform var(--et-dur-fast) var(--et-ease);
}

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

.et-btn--primary {
  --_bg: var(--et-button-bg);
  --_fg: var(--et-button-text);
  --_bd: var(--et-button-bg);
}

.et-btn--primary:hover {
  --_bg: var(--et-accent-ink);
  --_bd: var(--et-accent-ink);
}

.et-btn--accent {
  --_bg: var(--et-accent-ink);
  --_fg: var(--et-surface);
  --_bd: var(--et-accent-ink);
}

.et-btn--accent:hover {
  --_bg: var(--et-text);
  --_bd: var(--et-text);
}

.et-btn--outline {
  --_bd: var(--et-border-strong);
  --_fg: var(--et-text);
}

.et-btn--outline:hover {
  --_bd: var(--et-text);
  --_bg: var(--et-text);
  --_fg: var(--et-surface);
}

.et-btn--ghost {
  --_fg: var(--et-accent-ink);
  padding-inline: var(--et-space-xs);
  min-height: var(--et-tap-target);
}

.et-btn--ghost:hover {
  --_fg: var(--et-text);
}

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

.et-btn--sm {
  min-height: var(--et-tap-target);
  padding: var(--et-space-xs) var(--et-space-md);
  font-size: var(--et-fs-xs);
}

.et-btn[disabled],
.et-btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* A text link that behaves like a call to action. */
.et-link-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-3xs);
  font-family: var(--et-font-heading);
  font-size: var(--et-fs-sm);
  font-weight: 600;
  color: var(--et-accent-ink);
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: gap var(--et-dur) var(--et-ease);
}

.et-link-cta:hover {
  gap: var(--et-space-sm);
}

/* --------------------------------------------------------------------------
   5. Forms
   -------------------------------------------------------------------------- */

.et-field {
  display: flex;
  flex-direction: column;
  gap: var(--et-space-3xs);
  margin-bottom: var(--et-space-md);
}

.et-label {
  font-size: var(--et-fs-xs);
  font-weight: 600;
}

.et-input,
.et-select,
.et-textarea {
  width: 100%;
  min-height: calc(var(--et-tap-target) + var(--et-space-3xs));
  padding: var(--et-space-sm) var(--et-space-md);
  background: var(--et-surface);
  border: 1px solid var(--et-border-strong);
  border-radius: var(--et-radius);
  color: var(--et-text);
  transition: border-color var(--et-dur) var(--et-ease),
    box-shadow var(--et-dur) var(--et-ease);
}

.et-textarea {
  min-height: 120px;
  resize: vertical;
}

.et-input::placeholder,
.et-textarea::placeholder {
  color: var(--et-text-muted);
  opacity: 1;
}

.et-input:hover,
.et-select:hover,
.et-textarea:hover {
  border-color: var(--et-accent-ink);
}

.et-select {
  appearance: none;
  padding-right: var(--et-space-2xl);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%235B646E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--et-space-md) center;
  cursor: pointer;
}

.et-form-error {
  color: var(--et-sale);
  font-size: var(--et-fs-sm);
}

.et-form-success {
  color: var(--et-success);
  font-size: var(--et-fs-sm);
}

/* --------------------------------------------------------------------------
   6. Badges and pills
   -------------------------------------------------------------------------- */

.et-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-3xs);
  padding: var(--et-space-3xs) var(--et-space-sm);
  border-radius: var(--et-radius-pill);
  background: var(--et-accent-soft);
  color: var(--et-accent-ink);
  font-family: var(--et-font-heading);
  font-size: var(--et-fs-2xs);
  font-weight: 600;
  letter-spacing: var(--et-ls-wide);
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.et-badge--sale {
  background: var(--et-sale);
  color: var(--et-surface);
}

.et-badge--solid {
  background: var(--et-text);
  color: var(--et-surface);
}

.et-badge--soldout {
  background: var(--et-bg-alt);
  color: var(--et-text-muted);
}

/* --------------------------------------------------------------------------
   7. Accessibility
   -------------------------------------------------------------------------- */

/* Visible only to assistive technology. */
.et-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* A consistent focus ring for keyboard users only. */
:focus-visible {
  outline: 2px solid var(--et-accent-ink);
  outline-offset: 3px;
  border-radius: var(--et-radius-sm);
}

.et-input:focus-visible,
.et-select:focus-visible,
.et-textarea:focus-visible {
  outline: none;
  border-color: var(--et-accent-ink);
  box-shadow: 0 0 0 3px var(--et-accent-soft);
}

.et-skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--et-z-skip);
  padding: var(--et-space-sm) var(--et-space-lg);
  background: var(--et-surface);
  color: var(--et-text);
  font-weight: 600;
  border-radius: 0 0 var(--et-radius) 0;
  box-shadow: var(--et-shadow-lg);
  transform: translateY(-120%);
  transition: transform var(--et-dur) var(--et-ease);
}

.et-skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   8. Media
   -------------------------------------------------------------------------- */

/* Reserves the aspect ratio so images never cause layout shift. */
.et-media {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--et-bg-alt);
  border-radius: var(--et-radius);
}

.et-media::before {
  content: '';
  display: block;
  padding-top: calc(100% / var(--_ratio, var(--et-ratio-square)));
}

.et-media > img,
.et-media > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.et-media--contain > img {
  object-fit: contain;
}

.et-media--square {
  --_ratio: var(--et-ratio-square);
}
.et-media--portrait {
  --_ratio: var(--et-ratio-portrait);
}
.et-media--landscape {
  --_ratio: var(--et-ratio-landscape);
}
.et-media--wide {
  --_ratio: var(--et-ratio-wide);
}

/* Shopify's placeholder SVGs. */
.et-placeholder {
  width: 100%;
  height: 100%;
  background: var(--et-bg-alt);
  fill: rgba(var(--et-text-rgb), 0.12);
}

/* --------------------------------------------------------------------------
   9. Motion
   -------------------------------------------------------------------------- */

/* Applied by assets/global.js once the element scrolls into view.
   The un-revealed state is only ever set when JS is running, so content
   stays visible with JS disabled. */
.et-reveal {
  opacity: 0;
  transform: translateY(var(--et-reveal-shift));
  transition: opacity var(--et-reveal-dur, 800ms) var(--et-ease),
    transform var(--et-reveal-dur, 800ms) var(--et-ease);
  transition-delay: var(--et-reveal-delay, 0ms);
}

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

/* --------------------------------------------------------------------------
   10. Utilities
   -------------------------------------------------------------------------- */

.et-flow-gap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--et-space-sm);
}

.et-center {
  text-align: center;
}

.et-hide {
  display: none !important;
}

.et-mt-sm {
  margin-top: var(--et-space-xs);
}

@media (max-width: 749px) {
  .et-hide-mobile {
    display: none !important;
  }
}

@media (min-width: 750px) {
  .et-hide-desktop {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   11. Braille motif
   The dot pattern from Earth Therapy packaging. The brand prints Braille on
   every bottle, so it doubles as a brand mark and a nod to the accessibility
   the label already commits to. Always decorative — never the only carrier
   of meaning, and always aria-hidden in markup.
   -------------------------------------------------------------------------- */

.et-braille {
  --_dot: var(--et-accent);
  --_size: 9px;
  --_r: 1.6px;

  display: block;
  height: var(--_size);
  background-image: radial-gradient(
    circle,
    var(--_dot) var(--_r),
    transparent calc(var(--_r) + 0.1px)
  );
  background-size: var(--_size) var(--_size);
  background-repeat: repeat-x;
  background-position: center;
}

.et-braille--sm {
  --_size: 7px;
  --_r: 1.3px;
}

.et-braille--rule {
  opacity: 0.55;
}

.et-braille--ink {
  --_dot: var(--et-text);
}

.et-braille--light {
  --_dot: rgba(255, 255, 255, 0.85);
}

/* Retained alias for the earlier class name. */
.et-braille-rule {
  height: 10px;
  background-image: radial-gradient(
    circle,
    var(--et-accent) 1.6px,
    transparent 1.7px
  );
  background-size: 9px 9px;
  background-repeat: repeat-x;
  background-position: center;
  opacity: 0.55;
}
