/* PulseDrivers theme (site-wide). Load FIRST in default_packages, before main.css.
   Palette: gunmetal R34 GT-R + racing-red PULSE DRIVERS livery + rust warehouse wall at dusk.
   Tokens only + small opt-in helpers; section files own their layout. */

:root {
  /* Surfaces: charcoal to gunmetal */
  --pd-bg: #0e0f11;            /* tyre / shadow black */
  --pd-surface: #15171a;       /* charcoal */
  --pd-surface-2: #1d2024;     /* dark gunmetal */
  --pd-surface-3: #262a2f;     /* raised gunmetal */
  --pd-line: #2c3036;
  --pd-line-2: #3a3f46;

  /* Metal */
  --pd-metal: #5c636b;         /* gunmetal body panel */
  --pd-metal-hi: #8e959d;      /* panel highlight */
  --pd-silver: #b9bec4;        /* silver trim / decals */

  /* Text */
  --pd-text: #eceef0;          /* 16.5:1 on --pd-bg */
  --pd-text-2: #c9cdd2;
  --pd-muted: #9aa1a9;         /* 5.5:1 on --pd-surface-3, AA everywhere */

  /* Racing red (livery stripes / calipers) */
  --pd-accent: #d01820;        /* fills; white text on it = 5.5:1 */
  --pd-accent-rgb: 208, 24, 32;
  --pd-accent-hover: #e11d26;  /* white text on it = 4.8:1 */
  --pd-accent-contrast: #ffffff;
  --pd-accent-text: #ff5a5f;   /* red TEXT on dark: 5.4:1 on --pd-surface-2 */
  --pd-accent-soft: rgba(208, 24, 32, .14);

  /* Rust / amber (warehouse wall at dusk). Decorative only, never a status. */
  --pd-accent-2: #d9822b;
  --pd-accent-2-rgb: 217, 130, 43;

  /* Collection status. MUST stay green / yellow / blue (users rely on it). Dark text on all three. */
  --pd-own: #34d27b;   --pd-own-rgb: 52, 210, 123;    /* Personal Collection */
  --pd-pre: #ffcc33;   --pd-pre-rgb: 255, 204, 51;    /* Pre-Order */
  --pd-wish: #4aa3ff;  --pd-wish-rgb: 74, 163, 255;   /* Wishlist */
  --pd-status-contrast: #0e0f11;

  /* Gradients + textures */
  --pd-metal-gradient: linear-gradient(180deg, #2a2e33 0%, #1b1e22 48%, #141619 100%);
  --pd-brushed: repeating-linear-gradient(90deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px);
  --pd-carbon:
    linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25% 75%, rgba(255,255,255,.025) 75%),
    linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25% 75%, rgba(255,255,255,.025) 75%);
  --pd-carbon-size: 8px 8px;
  --pd-carbon-pos: 0 0, 4px 4px;
  --pd-dusk-glow: radial-gradient(ellipse at 85% 0%, rgba(217, 130, 43, .16), transparent 55%);
  --pd-red-glow: radial-gradient(ellipse at 10% 100%, rgba(208, 24, 32, .18), transparent 55%);
  /* Pulse line from the PulseDrivers logo (flat, three sharp spikes, flat). Masks: give the element
     background: var(--pd-accent) (or any color) and mask it with one of these. */
  /* PULSE-MASKS (generated by tools/build_pulse.py from the logo's spike; do not hand-edit) */
  --pd-pulse-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 32'%3E%3Cpath d='M0.0 11.1L20.0 11.1L26.6 6.8L23.3 19.0L41.8 3.4L26.3 28.5L43.8 15.3L46.4 21.9H72.0' fill='none' stroke='%23000' stroke-width='3.4' stroke-linejoin='miter' stroke-miterlimit='6' stroke-linecap='butt'/%3E%3C/svg%3E");
  --pd-pulse-wide-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1400 260' preserveAspectRatio='xMaxYMid meet'%3E%3Cpath d='M0.0 88.0L1020.0 88.0L1043.0 53.0L1031.5 153.0L1095.9 25.0L1041.8 231.0L1102.8 123.0L1112.0 177.0H1400.0' fill='none' stroke='%23000' stroke-width='11' stroke-linejoin='miter' stroke-miterlimit='8' stroke-linecap='butt'/%3E%3C/svg%3E");
  --pd-pulse-glow-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1400 260' preserveAspectRatio='xMaxYMid meet'%3E%3Cfilter id='b' x='-5%25' y='-30%25' width='110%25' height='160%25'%3E%3CfeGaussianBlur stdDeviation='9'/%3E%3C/filter%3E%3Cpath d='M0.0 88.0L1020.0 88.0L1043.0 53.0L1031.5 153.0L1095.9 25.0L1041.8 231.0L1102.8 123.0L1112.0 177.0H1400.0' fill='none' stroke='%23000' stroke-width='20' stroke-linejoin='miter' stroke-miterlimit='8' filter='url(%23b)'/%3E%3C/svg%3E");
  /* /PULSE-MASKS */

  /* Type */
  --pd-font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --pd-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Shape + motion */
  --pd-radius: .5rem;
  --pd-radius-sm: .3rem;
  --pd-skew: -12deg;
  --pd-shadow: 0 12px 28px rgba(0, 0, 0, .55);
  --pd-caliper-glow: 0 0 0 1px rgba(208, 24, 32, .55), 0 12px 28px rgba(0, 0, 0, .55), 0 0 22px rgba(208, 24, 32, .28);
  --pd-ease: cubic-bezier(.2, .7, .2, 1);
}

/* Small global niceties (safe on light pages too) */
::selection { background: rgba(208, 24, 32, .85); color: #fff; }

/* ---------- Opt-in helpers (class names are new; nothing existing depends on them) ---------- */

/* Display heading: condensed, slightly italic */
.pd-display {
  font-family: var(--pd-font-display);
  font-style: italic; font-weight: 800;
  letter-spacing: .01em; text-transform: uppercase; line-height: 1.02;
}

/* Small pulse mark (inline): <span class="pd-pulse" aria-hidden="true"></span> */
.pd-pulse {
  display: inline-block; flex: 0 0 auto; vertical-align: middle;
  width: 2.15rem; height: 1em;
  background: var(--pd-accent);
  -webkit-mask: var(--pd-pulse-mask) center / 100% 100% no-repeat;
          mask: var(--pd-pulse-mask) center / 100% 100% no-repeat;
}

/* Eyebrow with a pulse in front */
.pd-eyebrow-pulse {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--pd-font-display); font-style: normal; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.pd-eyebrow-pulse::before {
  content: ""; flex: 0 0 auto; width: 2.15rem; height: 1em;
  background: var(--pd-accent);
  -webkit-mask: var(--pd-pulse-mask) center / 100% 100% no-repeat;
          mask: var(--pd-pulse-mask) center / 100% 100% no-repeat;
}

/* Big pulse sweeping across the right side of a dark band.
   Applied to the Welcome band (.pd-welcome) and catalog header (.pd-cat-hero); reusable on any band via
   .pd-pulse-band (the band needs position:relative; overflow:hidden; isolation:isolate).
   ::before = soft red glow, ::after = crisp line. Left end fades in; right end runs off the edge.
   One-time draw-on wipe on load; fully static with prefers-reduced-motion. */
.pd-pulse-band::before, .pd-pulse-band::after,
.pd-welcome::before, .pd-welcome::after,
.pd-cat-hero::before, .pd-cat-hero::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: 10%; bottom: 10%; right: 0; width: min(64%, 860px);
  background: var(--pd-accent);
  -webkit-mask-image: var(--pd-pulse-wide-mask), linear-gradient(90deg, transparent 15%, #000 58%);
          mask-image: var(--pd-pulse-wide-mask), linear-gradient(90deg, transparent 15%, #000 58%);
  -webkit-mask-position: right center, 0 0;  mask-position: right center, 0 0;
  -webkit-mask-size: auto 100%, 100% 100%;   mask-size: auto 100%, 100% 100%;
  -webkit-mask-repeat: no-repeat;            mask-repeat: no-repeat;
  -webkit-mask-composite: source-in;         mask-composite: intersect;
  animation: pd-pulse-draw 1.1s var(--pd-ease) .15s both;
}
.pd-pulse-band::before, .pd-welcome::before, .pd-cat-hero::before {
  -webkit-mask-image: var(--pd-pulse-glow-mask), linear-gradient(90deg, transparent 15%, #000 58%);
          mask-image: var(--pd-pulse-glow-mask), linear-gradient(90deg, transparent 15%, #000 58%);
  opacity: .8;
}
.pd-cat-hero::before, .pd-cat-hero::after { width: min(48%, 640px); top: 6%; bottom: 6%; }
@keyframes pd-pulse-draw {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
/* Phones: sit well behind the title, faint */
@media (max-width: 575.98px) {
  .pd-pulse-band::before, .pd-pulse-band::after,
  .pd-welcome::before, .pd-welcome::after,
  .pd-cat-hero::before, .pd-cat-hero::after { width: 100%; top: 14%; bottom: 14%; opacity: .14; }
  .pd-pulse-band::before, .pd-welcome::before, .pd-cat-hero::before { opacity: .1; }
}

/* Race number plate: white plate, black number */
.pd-plate {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.4rem; padding: .1rem .5rem;
  font-family: var(--pd-font-display); font-style: italic; font-weight: 800; line-height: 1.1;
  color: #0e0f11; background: #fff;
  border-radius: .3rem;
  box-shadow: inset 0 0 0 2px #0e0f11, 0 2px 8px rgba(0, 0, 0, .45);
}

/* Primary CTA with a skewed (slanted) body. The skew lives on ::before so text and focus ring stay square. */
.pd-btn-race {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .65rem 1.5rem;
  font-family: var(--pd-font-display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  color: var(--pd-accent-contrast); background: none; border: 0;
}
.pd-btn-race::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--pd-accent); border-radius: 3px;
  transform: skewX(var(--pd-skew));
  transition: background-color .15s ease, box-shadow .2s ease;
}
.pd-btn-race:hover, .pd-btn-race:focus-visible { color: var(--pd-accent-contrast); }
.pd-btn-race:hover::before, .pd-btn-race:focus-visible::before {
  background: var(--pd-accent-hover); box-shadow: 0 0 18px rgba(208, 24, 32, .55);
}

/* Visible keyboard focus in brand red */
.pd-focus-ring:focus-visible { outline: 2px solid var(--pd-accent-text); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .pd-btn-race::before { transition: none; }
  .pd-pulse-band::before, .pd-pulse-band::after,
  .pd-welcome::before, .pd-welcome::after,
  .pd-cat-hero::before, .pd-cat-hero::after { animation: none; clip-path: none; }
}

/* No mask support (very old browsers): hide the pulse rather than show solid red blocks */
@supports not ((mask-image: none) or (-webkit-mask-image: none)) {
  .pd-pulse, .pd-eyebrow-pulse::before,
  .pd-pulse-band::before, .pd-pulse-band::after,
  .pd-welcome::before, .pd-welcome::after,
  .pd-cat-hero::before, .pd-cat-hero::after,
  .pd-about-eyebrow::before, .pd-welcome-eyebrow::before, .pd-cat-eyebrow::before { display: none; }
}
