/* ==========================================================================
   ENVIVUM — global layer: tokens, base, typography, buttons, reveal system.
   Everything else ships per block (blocks/<name>/style.css) or per shared
   component (assets/css/components/*.css) and is loaded only when rendered.
   Custom components are prefixed ev- and their root carries the class .ev.
   ========================================================================== */

:root {
  /* design px → fluid: 1px at 1920, scales down below */
  --px: min(calc(100vw / 1920), 1px);
  --ev-bg: var(--wp--preset--color--base, #0e0e0e);
  --ev-bg-2: var(--wp--preset--color--surface, #161616);
  --ev-bg-card: var(--wp--preset--color--elevated, #242424);
  --ev-bg-hover: var(--wp--preset--color--graphite, #363636);
  --ev-light: var(--wp--preset--color--light, #dedede);
  --ev-ink: var(--wp--preset--color--base, #0e0e0e);
  --ev-white: var(--wp--preset--color--contrast, #fff);
  --ev-red: var(--wp--preset--color--accent, #ff0000);
  --ev-gold: var(--wp--preset--color--glow, #ffd87d);
  --ev-error: var(--wp--preset--color--error, #e0252b);
  /* lighter tint: #e0252b on the dark panels fails AA contrast for 13px text */
  --ev-error-text: #ff6b6f;
  --ev-success-text: #9fd8b0;
  --ev-line: rgba(255, 255, 255, 0.1);
  --ev-line-strong: rgba(255, 255, 255, 0.3);
  --ev-muted: rgba(255, 255, 255, 0.6);
  --ev-gutter: clamp(20px, 9.7917vw, 188px);
  --ev-container: 1544px;
  --ev-radius: 8.74px;
  --ev-radius-panel: 10px;
  --ev-font: var(--wp--preset--font-family--satoshi, "Satoshi", "Helvetica Neue", Arial, sans-serif);
  --ev-font-display: var(--wp--preset--font-family--quablo, "Quablo", "Satoshi", "Helvetica Neue", Arial, sans-serif);
  --ev-fs-display: clamp(34px, 2.9167vw, 56px);
  --ev-fs-h2: clamp(28px, 2.2917vw, 44px);
  --ev-fs-h3: clamp(20px, 1.25vw, 24px);
  --ev-fs-lead: clamp(18px, 1.1458vw, 22px);
  --ev-fs-body-l: clamp(17px, 1.0417vw, 20px);
  --ev-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ev-header-h: 104px;
}

/* Base rules are tied to the site body / the editor canvas: this file also loads inside the block editor. */
:is(.ev-site, .editor-styles-wrapper) *,
:is(.ev-site, .editor-styles-wrapper) *::before,
:is(.ev-site, .editor-styles-wrapper) *::after { box-sizing: border-box; }

body.ev-site {
  margin: 0;
  background: var(--ev-bg);
  color: var(--ev-white);
  font-family: var(--ev-font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
/* product layers are wider than the viewport: clipped here (clip keeps position: sticky working), not on body,
   where the value would not stop the page from scrolling sideways */
.wp-site-blocks,
.editor-styles-wrapper { overflow-x: clip; }
.editor-styles-wrapper { -webkit-font-smoothing: antialiased; }

/* sections sit flush: the block gap is only for editorial text */
:root :where(.wp-site-blocks) > * { margin-block-start: 0; }
:root :where(.is-layout-flow, .is-layout-constrained) > .ev { margin-block: 0; }
.ev-main { display: block; min-height: 60vh; }

/* :where() keeps resets at zero specificity so component classes always win */
.ev :where(img, video) { display: block; max-width: 100%; height: auto; }
.ev :where(a) { color: inherit; text-decoration: none; }
.ev :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, hr) { margin: 0; padding: 0; }
.ev :where(ul, ol) { list-style: none; }
.ev :where(button, input, select, textarea) { font: inherit; }
.ev :focus-visible,
.ev:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

.ev-container {
  width: min(100% - 2 * var(--ev-gutter), var(--ev-container));
  margin-inline: auto;
}

.ev-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Typography ---------------------------------------------------------- */
.ev-eyebrow {
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ev-eyebrow--lg { font-size: 14px; line-height: 19px; }
.ev-eyebrow--muted { color: rgba(255, 255, 255, 0.5); }
.ev-display {
  font-size: var(--ev-fs-display);
  font-weight: 300;
  line-height: 1.357;
}
.ev-h2 {
  font-size: var(--ev-fs-h2);
  font-weight: 400;
  line-height: 1.227;
}
.ev-lead {
  font-size: var(--ev-fs-lead);
  font-weight: 300;
  line-height: 1.636;
}

/* --- Buttons ------------------------------------------------------------- */
.ev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  min-height: 42px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 70px;
  background: none;
  font-family: var(--ev-font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-decoration: none;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  /* Figma hover variants: dissolve 300 ms ease-out */
  transition: background-color 0.3s ease-out, color 0.3s ease-out, border-color 0.3s ease-out;
}
.ev-btn--white { background: var(--ev-white); color: #000; }
/* Figma: white -> black pill (dissolve 300 ms), then the nested pill hover -> #363636 (dissolve 300 ms) */
.ev-btn--white:hover { background: #363636; color: var(--ev-white); border-color: var(--ev-white); animation: ev-btn-white-hover 0.6s both; }
@keyframes ev-btn-white-hover {
  0% { background: var(--ev-white); color: #000; border-color: transparent; animation-timing-function: ease-out; }
  50% { background: #000; color: var(--ev-white); border-color: var(--ev-white); animation-timing-function: ease-out; }
  100% { background: #363636; color: var(--ev-white); border-color: var(--ev-white); }
}
.ev-btn--black { background: #000; color: var(--ev-white); }
.ev-btn--black:hover { background: #363636; }
.ev-btn--outline-dark { border-color: #000; color: #000; }
.ev-btn--outline-dark:hover { background: #000; color: var(--ev-white); }
.ev-btn--outline-light { border-color: var(--ev-white); color: var(--ev-white); background: var(--ev-bg-2); }
.ev-btn--outline-light:hover { background: #363636; }
.ev-btn[disabled],
.ev-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* Corner-bracket button (top-right + bottom-left L shapes from the design) */
.ev-btn--corners {
  --c: var(--ev-white);
  position: relative;
  min-height: 34px;
  padding: 0 21px;
  border-radius: 0;
  color: var(--ev-white);
}
/* brackets are 13.4% of the button wide; on hover they grow into a full frame (smart animate 200 ms ease-out) */
.ev-btn--corners::before,
.ev-btn--corners::after {
  content: "";
  position: absolute;
  width: 13.4%;
  height: 20px;
  border: 0 solid var(--c);
  transition: width 0.2s ease-out, height 0.2s ease-out;
}
.ev-btn--corners::before { left: 0; bottom: 0; border-left-width: 1px; border-bottom-width: 1px; }
.ev-btn--corners::after { right: 0; top: 0; border-right-width: 1px; border-top-width: 1px; }
.ev-btn--corners:hover::before,
.ev-btn--corners:hover::after { width: 100%; height: 100%; }

/* Black CTA with red corners + glow (home hero) */
.ev-btn--glow {
  --c: var(--ev-red);
  /* Figma: the black plate is 247 px wide whatever the label */
  min-width: 247px;
  min-height: 48px;
  padding: 0 34px;
  background: #000;
  box-shadow: 0 0 12px rgba(255, 47, 0, 0.5);
}
.ev-btn--glow::before { left: 8px; bottom: 7px; width: calc((100% - 16px) * 0.134); }
.ev-btn--glow::after { right: 8px; top: 7px; width: calc((100% - 16px) * 0.134); }
.ev-btn--glow:hover::before,
.ev-btn--glow:hover::after { width: calc(100% - 16px); height: calc(100% - 14px); }

/* Figma "Button / Bracket": taller corner button with 14 px brackets, used inside page content */
.ev-btn--bracket { min-height: 48px; padding: 14px 26px; line-height: 1.4; text-align: center; white-space: normal; }
.ev-btn--bracket::before,
.ev-btn--bracket::after { width: 14px; height: 14px; }

.ev-link-arrow { font-weight: 500; transition: opacity 0.3s; }
.ev-link-arrow:hover { opacity: 0.7; }

/* --- Full-bleed images ----------------------------------------------------
   Source images are prepared much wider than the viewport. They stay centred, grow out
   to the left/right, and wherever the image runs out its edge fades into the background. */
.ev-bleed {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  pointer-events: none;
  user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
}
.ev-bleed img,
.ev .ev-bleed img { width: 100%; height: 100%; max-width: none; object-fit: fill; }

/* Figma crop of a photo inside its box: size and offset of the full source relative to the box */
.ev .ev-crop { left: var(--cx); top: var(--cy); width: var(--cw); height: var(--ch); object-fit: fill; }

/* --- Reveal / timeline animations ------------------------------------------
   Hidden start states exist only under html.ev-js (set by an inline script in <head>),
   so content stays visible without JavaScript and inside the block editor preview. */
:where(.ev-js) [data-ev-reveal] {
  opacity: 0;
  translate: 0 32px;
  transition: opacity 1s var(--ev-ease), translate 1s var(--ev-ease);
  transition-delay: var(--ev-delay, 0s);
}
:where(.ev-js) [data-ev-reveal].is-in { opacity: 1; translate: 0 0; }

/* Figma preview timelines (keyframes in components/layers.css), paused until the layer is in view */
[data-ev-anim] { animation: var(--ev-anim); }
.ev-js [data-ev-anim]:not(.is-in) { animation-play-state: paused; }

/* Soft fades. Keyframes only declare the hidden start, so each element settles on its own opacity / translate. */
@keyframes ev-fade-in { from { opacity: 0; } }
@keyframes ev-rise { from { opacity: 0; translate: 0 20px; } }
@keyframes ev-zoom-out { from { scale: 1.06; } }

/* the 53 px rule stretches to the container width once in view */
[data-ev-line] { --ev-line-w: 100%; }
.ev-js [data-ev-line]:not(.is-in) { --ev-line-w: 53px; }

@media (prefers-reduced-motion: no-preference) {
  .ev-js [data-ev-fade]:not(.is-in),
  .ev-js [data-ev-stagger]:not(.is-in) > * { opacity: 0; }

  [data-ev-fade].is-in { animation: ev-fade-in 1.2s ease-out var(--ev-delay, 0s) backwards; }
  [data-ev-fade="zoom"].is-in > :is(img, video) { animation: ev-zoom-out 1.8s var(--ev-ease) var(--ev-delay, 0s) backwards; }
  /* --ev-i = child index, set in global.js */
  [data-ev-stagger].is-in > * { animation: ev-rise 1s var(--ev-ease) calc(var(--ev-delay, 0s) + var(--ev-i, 0) * 90ms) backwards; }
  [data-ev-stagger="fade"].is-in > * { animation-name: ev-fade-in; animation-duration: 1.2s; animation-timing-function: ease-out; }
}

@media (prefers-reduced-motion: reduce) {
  :where(.ev-js) [data-ev-reveal] { opacity: 1; translate: none; transition: none; }
  /* jump straight to the final frame */
  [data-ev-anim] { animation-duration: 1ms !important; animation-delay: 0s !important; animation-play-state: running !important; }
}

/* --- Editorial text (legal pages, posts) ---------------------------------- */
.ev-prose { font-size: 17px; font-weight: 300; line-height: 1.75; color: rgba(255, 255, 255, 0.85); }
.ev-prose :where(h2, h3, h4) { color: var(--ev-white); font-weight: 400; line-height: 1.25; }
.ev-prose :where(h2) { margin-top: 2.2em; font-size: clamp(24px, 1.67vw, 32px); }
.ev-prose :where(h3) { margin-top: 1.8em; font-size: var(--ev-fs-h3); }
.ev-prose :where(a) { color: var(--ev-white); text-decoration: underline; text-underline-offset: 3px; }
.ev-prose :where(a:hover) { opacity: 0.7; }
.ev-prose :where(ul, ol) { padding-left: 1.2em; }
.ev-prose :where(li + li) { margin-top: 0.4em; }
.ev-prose :where(strong) { font-weight: 500; color: var(--ev-white); }
.ev-prose :where(table) { width: 100%; border-collapse: collapse; }
.ev-prose :where(th, td) { padding: 12px 16px; border-bottom: 1px solid var(--ev-line); text-align: left; }

/* --- Simple page header (text pages, shop pages) --------------------------- */
.ev-pagehead { padding: calc(var(--ev-header-h) + clamp(48px, 5vw, 96px)) 0 clamp(32px, 3.3vw, 64px); }
.ev-pagehead__eyebrow { margin-bottom: 18px; font-size: 12px; font-weight: 500; letter-spacing: 0.25em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); }
.ev-pagehead__title { margin: 0; font-size: var(--ev-fs-display); font-weight: 300; line-height: 1.2; }
.ev-page { padding-bottom: clamp(64px, 6.25vw, 120px); }

@media (max-width: 900px) {
  /* 9.8vw gutters eat a fifth of a phone screen; 6vw = the 24 px margin of the Figma iPhone frame */
  :root { --px: calc(100vw / 1100); --ev-gutter: clamp(24px, 6vw, 60px); }

  /* touch targets: 44 px or more */
  .ev-btn { min-height: 46px; }
  .ev-btn--corners { min-height: 48px; }
  .ev .ev-link-arrow { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (max-width: 600px) {
  /* long labels wrap instead of pushing the page wider */
  .ev-btn { max-width: 100%; padding-block: 10px; line-height: 1.4; text-align: center; white-space: normal; }
}
