/* ==========================================================================
   TUNINQ — tuninq.app
   Shared stylesheet for the marketing site + legal pages.
   Single source of truth for brand tokens. No build step, no dependencies.
   ========================================================================== */

/* ---------- Tokens ------------------------------------------------------ */
:root {
  /* Brand */
  --neon: #c8ff00;
  --neon-dim: #a3d100;
  --neon-soft: rgba(200, 255, 0, 0.14);
  --ink: #06070a;

  /* Surfaces (near-black, not pure black — avoids OLED smear + banding) */
  --bg: #050506;
  --bg-2: #08080a;
  --surface: #0e0e11;
  --surface-2: #16161a;
  --surface-3: #1d1d22;

  /* Lines */
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);

  /* Text */
  --txt: #f4f4f5;
  --txt-2: #a3a3ad;
  --txt-3: #6d6d78;

  /* Type */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Rhythm */
  --gutter: clamp(20px, 5vw, 44px);
  --maxw: 1200px;
  --section-y: clamp(68px, 9vw, 124px);
  --radius: 16px;
  --radius-lg: 24px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 260ms;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }

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

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--neon); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout helpers --------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); position: relative; }

/* Hidden by clipping, not by off-screen positioning: `left: -9999px` becomes
   10,000px of scrollable width the moment the page flips to RTL. */
.skip-link {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  z-index: 200;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  background: var(--neon);
  color: var(--ink);
  font-weight: 700;
  border-end-end-radius: 10px;
}
.skip-link:focus {
  width: auto;
  height: auto;
  padding: 12px 18px;
  overflow: visible;
  clip-path: none;
}

/* ---------- Typography kit ---------------------------------------------- */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--neon);
  margin: 0 0 20px;
}
.kicker::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.h-display {
  font-size: clamp(2.6rem, 8.5vw, 6rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.h-section {
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.04em;
}

.lead {
  color: var(--txt-2);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  max-width: 56ch;
}

.neon { color: var(--neon); }

.outline-word {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.42);
}

.mono-num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
  will-change: transform;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--neon);
  color: var(--ink);
  box-shadow: 0 0 0 rgba(200, 255, 0, 0), 0 10px 34px -12px rgba(200, 255, 0, 0.7);
}
.btn-primary:hover {
  background: #d7ff33;
  box-shadow: 0 0 46px -8px rgba(200, 255, 0, 0.55), 0 12px 40px -12px rgba(200, 255, 0, 0.8);
}

.btn-ghost {
  border: 1px solid var(--line-2);
  color: var(--txt);
  background: rgba(255, 255, 255, 0.02);
}
.btn-ghost:hover { border-color: var(--neon); color: var(--neon); background: var(--neon-soft); }

/* Store badges */
.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 22px 0 20px;
  border-radius: 14px;
  background: var(--txt);
  color: var(--ink);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.store-btn svg { width: 26px; height: 26px; flex: none; }
.store-btn .store-label { display: grid; line-height: 1.15; text-align: left; }
.store-btn .store-label small {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.62;
  font-weight: 600;
}
.store-btn .store-label strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.store-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -18px rgba(255, 255, 255, 0.6); }

.store-btn.is-soon {
  background: transparent;
  color: var(--txt-2);
  border: 1px solid var(--line-2);
  cursor: default;
}
.store-btn.is-soon:hover { transform: none; box-shadow: none; }
.store-btn.is-soon .store-label strong { color: var(--txt); }

/* ---------- Site header -------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    backdrop-filter var(--dur) var(--ease);
}
.site-header.is-stuck {
  background: rgba(5, 5, 6, 0.72);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 76px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.98rem;
}
.brand-lockup img { width: 34px; height: 34px; border-radius: 9px; }

.site-nav {
  display: none;
  gap: 4px;
  align-items: center;
}
.site-nav a {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--txt-2);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.site-nav a:hover { color: var(--txt); background: rgba(255, 255, 255, 0.05); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-cta { display: none; }

@media (min-width: 880px) {
  .site-nav { display: flex; }
  .header-cta { display: inline-flex; }
}

/* ---------- Language switcher -------------------------------------------- */
.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding-inline: 13px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--txt-2);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lang-switch:hover,
.lang-switch:focus-within { border-color: var(--neon); color: var(--txt); }
.lang-switch > svg { width: 17px; height: 17px; flex: none; }

.lang-switch select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding-inline-end: 18px;
  max-width: 116px;
  /* The chevron sits in the padding so the select stays one flat control. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a3ad' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 13px;
}
.lang-switch select:focus { outline: none; }
.lang-switch select option {
  /* Native menus don't inherit page colours on every platform — set both. */
  background: #101013;
  color: var(--txt);
}

[dir="rtl"] .lang-switch select { background-position: left center; }

/* Room is tight on small screens: keep the globe, drop the language name. */
@media (max-width: 519px) {
  .lang-switch { padding-inline: 11px 6px; }
  .lang-switch select { max-width: 74px; font-size: 0.82rem; }
}

/* ---------- Ambience ----------------------------------------------------- */
.ambience {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.ambience::before,
.ambience::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}
.ambience::before {
  width: 46vw;
  height: 46vw;
  min-width: 320px;
  min-height: 320px;
  top: -14vw;
  right: -8vw;
  background: radial-gradient(circle, rgba(200, 255, 0, 0.26), transparent 68%);
  animation: drift-a 22s ease-in-out infinite alternate;
}
.ambience::after {
  width: 36vw;
  height: 36vw;
  min-width: 260px;
  min-height: 260px;
  bottom: -12vw;
  left: -10vw;
  background: radial-gradient(circle, rgba(120, 190, 0, 0.16), transparent 70%);
  animation: drift-b 26s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-6%, 7%, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.06); }
  to { transform: translate3d(8%, -6%, 0) scale(1); }
}

/* Fine technical grid + film grain, sitewide */
.texture {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 72px 72px, 72px 72px;
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 20%, transparent 78%);
}

/* ---------- Content surfaces --------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.card-glow::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(200, 255, 0, 0.5), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* ---------- Reveal animation --------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition: opacity 720ms var(--ease), transform 720ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Footer -------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  padding-block: clamp(48px, 7vw, 80px) 40px;
  position: relative;
  z-index: 2;
}
.footer-grid {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; gap: 48px; }
}
.footer-grid h4 {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--txt-3);
  font-weight: 700;
  margin-bottom: 16px;
}
.footer-links { display: grid; gap: 10px; }
.footer-links a {
  color: var(--txt-2);
  font-size: 0.92rem;
  width: fit-content;
  transition: color var(--dur) var(--ease);
}
.footer-links a:hover { color: var(--neon); }
.footer-blurb { color: var(--txt-2); font-size: 0.92rem; max-width: 38ch; margin-top: 16px; }
.footer-bottom {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
  color: var(--txt-3);
  font-size: 0.8rem;
}

/* ==========================================================================
   Legal / text pages (privacy, terms, support, transactional)
   ========================================================================== */
.doc {
  max-width: 780px;
  margin-inline: auto;
  padding-block: clamp(48px, 8vw, 90px) clamp(64px, 10vw, 120px);
  position: relative;
  z-index: 2;
}
.doc h1 { font-size: clamp(2.1rem, 5vw, 3rem); margin-bottom: 10px; }
.doc .doc-meta { color: var(--txt-3); font-size: 0.85rem; margin-bottom: 40px; }
.doc .doc-lead { color: var(--txt-2); font-size: 1.05rem; margin-bottom: 32px; }
.doc .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.doc h2 {
  font-size: 1.3rem;
  margin: 44px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  letter-spacing: -0.02em;
}
.doc h3 { font-size: 1rem; margin: 24px 0 6px; letter-spacing: -0.01em; }
.doc p, .doc li { color: var(--txt-2); font-size: 0.97rem; }
.doc p + p { margin-top: 12px; }
.doc ul, .doc ol { padding-left: 22px; margin: 12px 0; }
.doc li { margin-bottom: 8px; }
.doc strong { color: var(--txt); font-weight: 600; }
.doc a { color: var(--neon); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.doc a:hover { color: #d9ff44; }
.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.92rem; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--txt-2); }
.doc th { color: var(--txt); font-weight: 600; }

.callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--neon);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 20px 0;
}
.callout p { color: var(--txt-2); }
.callout a { font-weight: 600; }

/* ==========================================================================
   Right-to-left (Arabic)
   Most of the layout is logical-property or flex based and flips on its own.
   These are the handful of places that pin things to a physical side.
   ========================================================================== */
[dir="rtl"] .kicker::before { order: 1; }
[dir="rtl"] .skip-link { border-radius: 0 0 0 10px; }

[dir="rtl"] .doc a,
[dir="rtl"] .doc { text-align: right; }

[dir="rtl"] .callout {
  border-left: 1px solid var(--line);
  border-right: 3px solid var(--neon);
}

[dir="rtl"] .marquee-track { animation-direction: reverse; }
[dir="rtl"] .marquee.is-reverse .marquee-track { animation-direction: normal; }

[dir="rtl"] .stage-hud { left: auto; right: 10px; }
[dir="rtl"] .pack-flag { right: auto; left: 16px; }
[dir="rtl"] .faq-item summary { padding: 26px 0 26px 44px; }
[dir="rtl"] .faq-item summary::after { right: auto; left: 6px; }
[dir="rtl"] .faq-answer { padding: 0 0 26px 44px; }
[dir="rtl"] .dock .btn { margin-left: 0; margin-right: auto; }
[dir="rtl"] .ambience::before { right: auto; left: -8vw; }
[dir="rtl"] .ambience::after { left: auto; right: -10vw; }

/* Arabic has no capitals and the wide tracking used for Latin micro-labels
   breaks its joined letterforms. */
[dir="rtl"] .kicker,
[dir="rtl"] .brand-word,
[dir="rtl"] .hero-stats dd,
[dir="rtl"] .footer-grid h4,
[dir="rtl"] .control-head > :first-child,
[dir="rtl"] .range-legend,
[dir="rtl"] .stance-compare figcaption,
[dir="rtl"] .kit-cell span,
[dir="rtl"] .pack .pack-name,
[dir="rtl"] .pack-flag,
[dir="rtl"] .stage-hud,
[dir="rtl"] .store-btn .store-label small {
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- Reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
