/* ============================================================================
   XARQ — components
   ========================================================================== */

/* ==================================================================== buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.92rem 1.6rem;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--t-sm);
  letter-spacing: 0.01em;
  white-space: nowrap;
  isolation: isolate;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out),
    color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn:active {
  transform: scale(0.97);
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease-spring);
}
.btn:hover svg {
  transform: translateX(3px);
}

/* Primary: the gradient itself, with a second copy of the gradient rotated 180°
   cross-fading in on hover. Animating background-position on a gradient forces
   a repaint every frame; cross-fading two stacked layers does not. */
.btn--primary {
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 10px 30px -12px color-mix(in oklab, var(--azure) 80%, transparent);
}
.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, var(--cyan) 0%, var(--azure) 50%, var(--violet) 100%);
  opacity: 0;
  transition: opacity 420ms var(--ease-out);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px -14px color-mix(in oklab, var(--azure) 90%, transparent);
}
.btn--primary:hover::after {
  opacity: 1;
}

/* Ghost: glass pill with a gradient border drawn as a mask, so the border can
   be a gradient without a wrapper element. */
.btn--ghost {
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.btn--ghost:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn--lg {
  padding: 1.1rem 2rem;
  font-size: var(--t-base);
}

.btn--link {
  padding: 0;
  color: var(--accent);
  border-radius: 0;
}
.btn--link::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 420ms var(--ease-out);
}
.btn--link:hover::before {
  transform: scaleX(1);
  transform-origin: 0 50%;
}

/* ====================================================================== card
   One glass panel used everywhere, plus a pointer-tracked spotlight. The
   --mx/--my custom properties are written by js/tilt.js on pointermove. */
.card {
  position: relative;
  border-radius: var(--r-lg);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  padding: clamp(1.4rem, 1rem + 1.4vw, 2.2rem);
  overflow: hidden;
  transition: transform 520ms var(--ease-out), border-color var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in oklab, var(--accent) 16%, transparent),
    transparent 62%
  );
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.card:hover::before {
  opacity: 1;
}
.card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-lg);
}

/* Opt-in 3D. The perspective lives on the parent so sibling cards do not share
   a vanishing point, which is what makes a grid of tilting cards look wrong. */
.tilt {
  perspective: 1100px;
}
.tilt > .card {
  transform-style: preserve-3d;
  will-change: transform;
}
.tilt__layer {
  transform: translateZ(38px);
}

.card__icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-5);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.card__icon svg {
  width: 22px;
  height: 22px;
}

.card h3 {
  font-size: var(--t-xl);
  margin-bottom: 0.6rem;
}
.card p {
  color: var(--text-2);
  font-size: var(--t-sm);
}

.card__num {
  position: absolute;
  top: 1.1rem;
  right: 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--faint);
}

/* --------------------------------------------------------------- meta list */
.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: var(--sp-5);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ===================================================================== badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.95rem 0.42rem 0.55rem;
  border-radius: var(--r-pill);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--text-2);
}
.badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse-dot 2.4s var(--ease-out) infinite;
  margin-left: 0.35rem;
}

/* =================================================================== marquee
   Two identical tracks scrolled by -50%, so the seam lands exactly where the
   first track ends. Duplicating in markup (rather than cloning in JS) keeps it
   working with JS disabled. */
.marquee {
  position: relative;
  display: flex;
  overflow: hidden;
  user-select: none;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: clamp(2rem, 1rem + 3vw, 4rem);
  padding-right: clamp(2rem, 1rem + 3vw, 4rem);
  animation: marquee 38s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee__track {
  animation-play-state: paused;
}
.marquee--rev .marquee__track {
  animation-direction: reverse;
}
.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 0.8rem + 1.6vw, 2rem);
  font-weight: 500;
  letter-spacing: var(--ls-tight);
  color: var(--text-2);
  white-space: nowrap;
}
.marquee__item svg {
  width: 0.7em;
  height: 0.7em;
  color: var(--accent);
  opacity: 0.8;
}

/* ================================================================= accordion
   <details>/<summary>, so it works with no JS and is keyboard-native. The grid
   trick animates height without measuring anything. */
.acc {
  border-bottom: 1px solid var(--line);
}
.acc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: clamp(1.1rem, 0.9rem + 0.6vw, 1.6rem);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease-out);
}
.acc summary::-webkit-details-marker {
  display: none;
}
.acc summary:hover {
  color: var(--accent);
}
.acc__sign {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: transform 420ms var(--ease-spring), border-color var(--dur-fast) linear,
    background-color var(--dur-fast) linear;
}
.acc__sign::before,
.acc__sign::after {
  content: '';
  position: absolute;
  background: currentColor;
  border-radius: 2px;
}
.acc__sign::before {
  width: 12px;
  height: 1.5px;
}
.acc__sign::after {
  width: 1.5px;
  height: 12px;
  transition: transform 420ms var(--ease-spring), opacity 240ms linear;
}
.acc[open] .acc__sign {
  transform: rotate(180deg);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.acc[open] .acc__sign::after {
  transform: scaleY(0);
  opacity: 0;
}
.acc__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 460ms var(--ease-out);
}
.acc[open] .acc__body {
  grid-template-rows: 1fr;
}
.acc__body > div {
  overflow: hidden;
}
.acc__body p {
  color: var(--text-2);
  font-size: var(--t-sm);
  max-width: 58ch;
  padding-bottom: var(--sp-5);
}

/* ===================================================================== stat */
.stat__value {
  font-family: var(--font-display);
  font-size: var(--t-3xl);
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--ls-tight);
  background: var(--grad-brand);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  /* Digits change width as they count; tabular figures stop the label beneath
     from shifting left and right through the whole animation. */
  font-variant-numeric: tabular-nums;
}
.stat__label {
  margin-top: 0.5rem;
  font-size: var(--t-sm);
  color: var(--muted);
}

/* ============================================================ cursor light
   Not a dot, not a ring, not a logo — a soft travelling bloom.

   The page's whole visual language is light in the brand ramp: the aurora
   blobs behind everything, the glow under each 3D render, the spotlight that
   follows the pointer across a card, the halo on the case study. This is the
   same idiom made portable — a small light source that moves with you and is
   tinted by --accent, so it shifts violet → blue → cyan as the story does.

   It sits *alongside* the system cursor rather than replacing it. Hiding the
   real pointer is the usual way to do a custom cursor and it is a bad trade:
   text fields lose their I-beam, resize handles lose their arrows, and every
   click target gets slightly harder to hit — all to save a 12px arrow nobody
   was bothered by.

   Cheap by construction: a radial gradient is already soft, so there is no
   filter: blur() to repaint, no image to decode, and the only per-frame write
   is one transform. Position comes from js/cursor.js; everything else is here.

   Position on the parent, scale on the child. Two elements, because a single
   one cannot carry a JS-driven translate and a CSS-driven scale on the same
   transform property without one clobbering the other. */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-cursor);
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
  transition: opacity 320ms linear;
}

.cursor > span {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  border-radius: 50%;
  background: radial-gradient(
    circle closest-side,
    color-mix(in oklab, var(--accent) 34%, transparent) 0%,
    color-mix(in oklab, var(--violet) 16%, transparent) 42%,
    transparent 72%
  );
  scale: 1;
  transition: scale 620ms var(--ease-out), opacity 320ms var(--ease-out);
  animation: cursor-breathe 5s var(--ease-in-out) infinite alternate;
}

body.has-cursor .cursor {
  opacity: 1;
}

/* On the dark theme the bloom is genuine additive light. plus-lighter only
   ever brightens, so text underneath stays readable rather than being veiled
   the way a normal-blended overlay would veil it. */
:root[data-theme='dark'] .cursor > span {
  mix-blend-mode: plus-lighter;
  opacity: 0.85;
}

/* On white there is nothing to add light to — a bloom that only brightens is
   invisible against #fafafc. So the light theme tints instead of glows:
   multiply darkens the backdrop through the coloured gradient and leaves the
   transparent edges untouched, which gives a soft brand-coloured wash rather
   than the grey smudge a normal-blended overlay would leave. */
:root[data-theme='light'] .cursor > span {
  width: 230px;
  height: 230px;
  margin: -115px 0 0 -115px;
  mix-blend-mode: multiply;
  opacity: 0.6;
  background: radial-gradient(
    circle closest-side,
    color-mix(in oklab, var(--accent) 34%, transparent) 0%,
    color-mix(in oklab, var(--violet) 18%, transparent) 44%,
    transparent 74%
  );
}

/* Over anything clickable the light gathers: brighter and tighter, which reads
   as focus rather than as the same ambient wash everywhere. */
body.cursor-hot .cursor > span {
  scale: 0.62;
  opacity: 1;
}
:root[data-theme='light'] body.cursor-hot .cursor > span {
  opacity: 0.85;
}

/* Touch devices have no pointer to trail, and a visitor who asked for reduced
   motion did not ask for a light to follow them around. */
@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor {
    display: none;
  }
}

/* ==================================================================== form */
.field {
  display: grid;
  gap: 0.5rem;
}
.field label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--t-sm);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}
.field textarea {
  min-height: 130px;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

/* ================================================================== to top */
.totop {
  position: fixed;
  right: clamp(1rem, 2vw, 2rem);
  bottom: clamp(1rem, 2vw, 2rem);
  z-index: var(--z-nav);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass-2);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(16px) scale(0.85);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring);
}
.totop.is-on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.totop:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}
