/* ============================================================================
   MACHRUN — "APEX" DESIGN SYSTEM
   Drop-in stylesheet. Single source of truth for the redesign.
   ----------------------------------------------------------------------------
   HOW TO USE IN WORDPRESS
   1. Drop this file into your (child) theme, e.g. /assets/css/machrun-apex.css
   2. Enqueue it + the Google Fonts in functions.php (see snippet at bottom).
   3. Build markup using the .mr-* classes, or just consume the CSS variables
      from your existing components. Every value below is taken verbatim from
      the approved "MachRun - Apex" HTML prototype.

   DESIGN LAWS (do not break these — they ARE the look):
   • Sharp edges. border-radius is 0 EVERYWHERE. No rounded corners, ever.
   • Hairline dividers. Panels are separated by 1px rgba(255,255,255,.1) lines,
     not by gaps + shadows. The grid IS the decoration.
   • Three type roles only: Anton (display, ALL CAPS), Space Grotesk (body/UI),
     JetBrains Mono (labels, eyebrows, prices, meta — letterspaced UPPERCASE).
   • One accent: #f5311f. Used at full strength, never tinted/gradiented.
   • Eyebrows are mono, red, prefixed with "/ " e.g. "/ THE STORE".
   ========================================================================== */

:root {
  /* ---- Colour ---- */
  --mr-bg:            #0c0c0d;  /* page background (near-black)        */
  --mr-panel:        #131315;  /* card / panel surface                */
  --mr-panel-2:      #161618;  /* image well / inset surface          */
  --mr-ink:          #f2f0ee;  /* primary text (warm off-white)       */
  --mr-ink-2:        #bdb8b2;  /* body / secondary text               */
  --mr-muted:        #8a857f;  /* meta, captions                      */
  --mr-muted-2:      #7a756f;  /* dimmer meta                         */
  --mr-muted-3:      #6f6a64;  /* footer micro-labels, strikethrough  */
  --mr-accent:       #f5311f;  /* MACHRUN red — the only accent       */
  --mr-on-accent:    #0c0c0d;  /* text on red fills (near-black)      */

  --mr-line:         rgba(255,255,255,.10); /* standard hairline divider */
  --mr-line-strong:  rgba(255,255,255,.12); /* card border               */
  --mr-line-btn:     rgba(255,255,255,.28); /* secondary button border   */

  /* ---- Type families ---- */
  --mr-font-display: 'Anton', 'Arial Narrow', sans-serif;
  --mr-font-body:    'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mr-font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* ---- Fluid type scale (clamp = mobile → desktop) ---- */
  --mr-h1:   clamp(52px, 9vw, 128px);   /* hero headline            */
  --mr-h2:   clamp(36px, 5.5vw, 76px);  /* section headline         */
  --mr-h3:   clamp(26px, 3vw, 40px);    /* sub headline / about lede*/
  --mr-stat: clamp(40px, 5vw, 56px);    /* big stat numerals        */
  --mr-card-title: 28px;                /* product / event card title*/
  --mr-body: 17px;
  --mr-body-lg: 18px;
  --mr-label: 12px;                     /* mono eyebrows / meta     */

  /* ---- Spacing rhythm ---- */
  --mr-gutter: 48px;   /* horizontal page padding (desktop)   */
  --mr-section: 72px;  /* vertical section padding            */
  --mr-header-h: 62px; /* sticky header height                */
  --mr-maxw: 1480px;   /* optional max content width          */

  /* ---- Motion ---- */
  --mr-ease: cubic-bezier(.2,.6,.2,1);
  --mr-rise-dur: .7s;
  --mr-ticker-dur: 26s; /* one full marquee loop               */
}

/* ----------------------------------------------------------------------------
   RESET-ish — scope to your theme wrapper if you can't apply globally
   -------------------------------------------------------------------------- */
.mr * { box-sizing: border-box; }
.mr {
  background: var(--mr-bg);
  color: var(--mr-ink);
  font-family: var(--mr-font-body);
  -webkit-font-smoothing: antialiased;
}
.mr ::selection { background: var(--mr-accent); color: var(--mr-on-accent); }

/* ----------------------------------------------------------------------------
   TYPOGRAPHY HELPERS
   -------------------------------------------------------------------------- */
.mr-display { font-family: var(--mr-font-display); text-transform: uppercase; line-height: .88; letter-spacing: .005em; margin: 0; }
.mr-h1 { font-family: var(--mr-font-display); text-transform: uppercase; font-size: var(--mr-h1);   line-height: .84; margin: 0; }
.mr-h2 { font-family: var(--mr-font-display); text-transform: uppercase; font-size: var(--mr-h2);   line-height: .90; margin: 0; }
.mr-h3 { font-family: var(--mr-font-display); text-transform: uppercase; font-size: var(--mr-h3);   line-height: 1.1; margin: 0; }
.mr-body { font-size: var(--mr-body-lg); line-height: 1.6; color: var(--mr-ink-2); }

/* Eyebrow — mono, red, letterspaced. Prefix the text with "/ " in markup. */
.mr-eyebrow {
  font-family: var(--mr-font-mono);
  font-size: var(--mr-label);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mr-accent);
}
/* Generic mono meta label (captions, spaces-left, dates) */
.mr-meta {
  font-family: var(--mr-font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mr-muted);
}

/* ----------------------------------------------------------------------------
   BUTTONS  (sharp corners, mono uppercase labels)
   -------------------------------------------------------------------------- */
.mr-btn {
  font-family: var(--mr-font-mono);
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: none;
  border-radius: 0;
  padding: 16px 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  text-decoration: none;
  transition: filter .15s var(--mr-ease), background .15s var(--mr-ease), color .15s var(--mr-ease);
}
.mr-btn--primary { background: var(--mr-accent); color: var(--mr-on-accent); font-weight: 700; }
.mr-btn--primary:hover { filter: brightness(1.08); }
.mr-btn--ghost { background: transparent; color: var(--mr-ink); border: 1px solid var(--mr-line-btn); }
.mr-btn--ghost:hover { background: var(--mr-ink); color: var(--mr-on-accent); border-color: var(--mr-ink); }

/* ----------------------------------------------------------------------------
   LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */
.mr-section { padding: var(--mr-section) var(--mr-gutter); }
.mr-divide-top { border-top: 1px solid var(--mr-line); }
.mr-divide-bottom { border-bottom: 1px solid var(--mr-line); }

/* Hard panel grid — children divided by hairlines, no gap. */
.mr-grid { display: grid; }
.mr-grid--2 { grid-template-columns: 1fr 1fr; }
.mr-grid--3 { grid-template-columns: repeat(3, 1fr); }
.mr-grid--4 { grid-template-columns: repeat(4, 1fr); }
.mr-grid--split { grid-template-columns: 1.35fr 1fr; } /* hero ratio */

/* Stat cell (used in 4-up stat bars) */
.mr-stat { padding: 36px 32px; border-right: 1px solid var(--mr-line); }
.mr-stat__num { font-family: var(--mr-font-display); font-size: var(--mr-stat); line-height: .9; color: var(--mr-accent); }
.mr-stat__label { font-family: var(--mr-font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mr-muted); margin-top: 10px; }

/* ----------------------------------------------------------------------------
   HEADER + NAV
   -------------------------------------------------------------------------- */
.mr-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--mr-header-h);
  background: var(--mr-bg);
  border-bottom: 1px solid var(--mr-line);
}
.mr-logo { display: flex; align-items: center; height: 100%; cursor: pointer; }
.mr-logo__mark { background: var(--mr-accent); height: 100%; display: flex; align-items: center; padding: 0 18px; }
.mr-logo__mark span { font-family: var(--mr-font-display); font-size: 26px; letter-spacing: .03em; color: var(--mr-on-accent); }
.mr-nav { display: flex; align-items: center; height: 100%; }
.mr-nav__link {
  font-family: var(--mr-font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  height: 100%; display: flex; align-items: center; padding: 0 18px;
  color: var(--mr-ink); text-decoration: none; border-bottom: 2px solid transparent;
}
.mr-nav__link:hover { color: var(--mr-accent); }
.mr-nav__link.is-active { background: var(--mr-ink); color: var(--mr-on-accent); border-bottom-color: var(--mr-accent); }

/* ----------------------------------------------------------------------------
   TICKER  (red marquee strip under the header)
   -------------------------------------------------------------------------- */
.mr-ticker { overflow: hidden; background: var(--mr-accent); border-bottom: 1px solid var(--mr-bg); white-space: nowrap; }
.mr-ticker__track { display: inline-flex; animation: mr-marq var(--mr-ticker-dur) linear infinite; will-change: transform; }
.mr-ticker__item { font-family: var(--mr-font-mono); font-size: 12px; font-weight: 500; letter-spacing: .14em; color: var(--mr-on-accent); padding: 9px 22px; }
/* Duplicate the item list TWICE inside .mr-ticker__track so the loop is seamless. */
@keyframes mr-marq { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ----------------------------------------------------------------------------
   CARDS — product + event
   -------------------------------------------------------------------------- */
.mr-card { background: var(--mr-panel); border: 1px solid var(--mr-line-strong); }
.mr-card__media { position: relative; aspect-ratio: 1/1; overflow: hidden; background: var(--mr-panel-2); }
.mr-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--mr-ease); }
.mr-card:hover .mr-card__media img { transform: scale(1.04); }
.mr-card__body { padding: 22px; }

/* SALE flag — sharp red tab pinned to the top-left of the media */
.mr-flag { position: absolute; top: 0; left: 0; font-family: var(--mr-font-mono); font-size: 10px; letter-spacing: .1em; font-weight: 700; background: var(--mr-accent); color: var(--mr-on-accent); padding: 6px 11px; }

/* Price row */
.mr-price { font-family: var(--mr-font-display); font-size: 26px; color: var(--mr-ink); }
.mr-price--was { font-family: var(--mr-font-mono); font-size: 12px; color: var(--mr-muted-3); text-decoration: line-through; }

/* ----------------------------------------------------------------------------
   IMAGE GALLERY  (tight 8px grid, hover zoom)
   -------------------------------------------------------------------------- */
.mr-gallery { display: grid; gap: 8px; }
.mr-gallery--4 { grid-template-columns: repeat(4, 1fr); }
.mr-gallery--3 { grid-template-columns: repeat(3, 1fr); }
.mr-gallery__cell { aspect-ratio: 1/1; overflow: hidden; background: var(--mr-panel); }
.mr-gallery__cell img { width: 100%; height: 100%; object-fit: cover; }

/* ----------------------------------------------------------------------------
   ENTRANCE ANIMATION
   -------------------------------------------------------------------------- */
@keyframes mr-rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.mr-rise { animation: mr-rise var(--mr-rise-dur) var(--mr-ease) both; }
@media (prefers-reduced-motion: reduce) {
  .mr-rise { animation: none; }
  .mr-ticker__track { animation: none; }
}

/* ----------------------------------------------------------------------------
   RESPONSIVE  — collapse hard grids on small screens
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --mr-gutter: 22px; --mr-section: 48px; }
  .mr-grid--split, .mr-grid--2, .mr-grid--3 { grid-template-columns: 1fr; }
  .mr-grid--4 { grid-template-columns: 1fr 1fr; }
  .mr-stat { border-bottom: 1px solid var(--mr-line); }
  .mr-gallery--4 { grid-template-columns: 1fr 1fr; }
  /* Hide secondary nav links behind a burger you wire up; keep logo + CTA. */
}

/* ============================================================================
   functions.php ENQUEUE SNIPPET  (copy into your child theme)
   ----------------------------------------------------------------------------
   add_action('wp_enqueue_scripts', function () {
     // Google Fonts
     wp_enqueue_style(
       'machrun-fonts',
       'https://fonts.googleapis.com/css2?family=Anton&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap',
       [], null
     );
     // Design system
     wp_enqueue_style(
       'machrun-apex',
       get_stylesheet_directory_uri() . '/assets/css/machrun-apex.css',
       ['machrun-fonts'],
       wp_get_theme()->get('Version')
     );
   });
   ========================================================================== */
