/* SpiderCode website — shared styles for the landing (/) and support (/support) pages.
   Same tokens as the app: cosmic #0F0F1A background, purple accents. No web fonts,
   no external requests, no cookies. */
:root {
  --bg: #0F0F1A;
  --bg-2: #16162a;
  --card: #1b1b30;
  --card-2: #221f3d;
  --purple: #8B5CF6;
  --purple-2: #a78bfa;
  --purple-3: #c4b5fd;
  --purple-strong: #7C3AED;
  --text-1: #f4f3ff;
  --text-2: #c4c2dd;
  --text-3: #9d9bba;
  --border: #2a2a44;
  --c-logic: #8B5CF6;
  --c-memory: #EC4899;
  --c-creative: #F59E0B;
  --c-math: #3B82F6;
  --c-words: #10B981;
  --c-nature: #22C55E;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(139, 92, 246, 0.22), transparent 60%),
    radial-gradient(900px 500px at 95% 20%, rgba(236, 72, 153, 0.08), transparent 55%),
    var(--bg);
  color: var(--text-1);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-wrap: break-word;
}
[id] { scroll-margin-top: 5.5rem; }
a { color: var(--purple-2); }
a:hover { color: var(--purple-3); }
:focus-visible { outline: 3px solid var(--purple-2); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; }

.skip { position: absolute; left: 1rem; top: -100px; z-index: 100; background: var(--purple-strong); color: #fff; padding: .6rem 1rem; border-radius: .6rem; font-weight: 700; text-decoration: none; }
.skip:focus { top: .6rem; color: #fff; }

/* ── Header ─────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--border); background: rgba(15, 15, 26, .85); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.nav-inner { max-width: 64rem; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem .75rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--text-1); text-decoration: none; }
.brand:hover { color: var(--text-1); }
/* The installed app icon, rounded like on a phone. */
.brand-mark { display: block; flex: none; width: 2rem; height: 2rem; border-radius: 22.37%; box-shadow: 0 0 0 1px rgba(167, 139, 250, .35); }
.switch { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem; }
.switch a { display: inline-block; padding: .3rem .8rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); text-decoration: none; font-weight: 700; font-size: .92rem; background: var(--bg-2); }
.switch a:hover { color: var(--text-1); border-color: var(--purple); }
.switch .code { display: none; }

/* ── One language at a time (works without JavaScript) ──── */
@supports selector(:has(*)) {
  .lang { display: none; }
  .lang:target, .lang:has(:target) { display: block; }
  body:not(:has(.lang:target, .lang :target)) #en { display: block; }
  body:not(:has(.lang:target, .lang :target)) .switch a[href="#en"],
  body:has(#es:target, #es :target) .switch a[href="#es"],
  body:has(#en:target, #en :target) .switch a[href="#en"],
  body:has(#fr:target, #fr :target) .switch a[href="#fr"] { background: var(--purple-strong); border-color: var(--purple-strong); color: #fff; }
  .skip { display: none; }
  body:not(:has(.lang:target, .lang :target)) .skip[href="#en-title"],
  body:has(#es:target, #es :target) .skip[href="#es-title"],
  body:has(#en:target, #en :target) .skip[href="#en-title"],
  body:has(#fr:target, #fr :target) .skip[href="#fr-title"] { display: block; }
}
@supports not selector(:has(*)) {
  .lang + .lang { border-top: 1px solid var(--border); margin-top: 3rem; padding-top: 2.5rem; }
}

/* ── Layout ─────────────────────────────────────────────── */
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1rem; }
section { padding: 3rem 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800; color: var(--purple-2); margin: 0 0 .4rem; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h2 { font-size: clamp(1.5rem, 2.2vw + 1rem, 2.1rem); }
h3 { font-size: 1.1rem; }
p { color: var(--text-2); margin: 0 0 1rem; }
.lead { font-size: 1.12rem; color: var(--text-2); }

/* ── Hero ───────────────────────────────────────────────── */
.hero { padding: 3rem 0 2rem; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; }
.hero-icon { width: 96px; height: 96px; border-radius: 22.37%; box-shadow: 0 10px 40px rgba(139, 92, 246, .45), 0 0 0 1px rgba(167, 139, 250, .35); margin-bottom: 1.2rem; }
.hero h1 { font-size: clamp(2rem, 3.4vw + 1rem, 3.3rem); background: linear-gradient(135deg, var(--text-1), var(--purple-3)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stores { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.4rem 0 .5rem; padding: 0; list-style: none; }
.stores li { border: 1px solid var(--border); background: var(--card); border-radius: .8rem; padding: .55rem .9rem; font-weight: 700; color: var(--text-1); font-size: .95rem; }
.stores li small { display: block; font-weight: 600; color: var(--text-3); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.stores li.live { padding: 0; border-color: var(--accent, #8B5CF6); }
.stores li.live a { display: block; padding: .55rem .9rem; color: inherit; text-decoration: none; border-radius: .8rem; }
.stores li.live a:hover, .stores li.live a:focus-visible { background: rgba(139, 92, 246, .14); }
.soon { color: var(--text-3); font-size: .9rem; margin: .2rem 0 0; }
.facts { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin: 1.4rem 0 0; padding: 0; list-style: none; color: var(--text-2); font-weight: 600; }
.facts li::before { content: "✓"; color: #34D399; font-weight: 900; margin-right: .4rem; }

/* 3D hero (assets/hero3d.js, three.js). Without WebGL / JavaScript the phones stay. */
.hero-visual { position: relative; }
.hero3d { display: none; width: 100%; height: clamp(320px, 42vw, 470px); }
.has-3d .hero-visual .phones { display: none; }
.has-3d .hero3d { display: block; }
/* The 3D scene already shows the app icon: no second copy above the title. */
.has-3d .hero-icon { display: none; }
.hero-visual::after {
  content: ""; position: absolute; inset: 12% 10%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(139, 92, 246, .35), rgba(236, 72, 153, .12) 60%, transparent);
  filter: blur(20px);
}

/* Phone mock-ups with real app captures */
.phones { position: relative; display: flex; justify-content: center; gap: 1rem; perspective: 1200px; }
.phone { width: min(46%, 230px); border-radius: 1.8rem; padding: .45rem; background: linear-gradient(160deg, #2c2650, #151326); box-shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(167, 139, 250, .25); }
.phone img { display: block; width: 100%; border-radius: 1.45rem; }
.phone.tilt { transform: translateY(1.6rem); }

/* ── Categories ─────────────────────────────────────────── */
.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; }
.cat { background: var(--card); border: 1px solid var(--border); border-radius: 1.1rem; padding: 1.2rem; }
.cat .tile { width: 3rem; height: 3rem; border-radius: .9rem; display: grid; place-items: center; margin-bottom: .8rem; color: #fff; }
.cat .tile svg { width: 1.6rem; height: 1.6rem; }
.cat h3 { margin-bottom: .35rem; }
.cat p { margin: 0; font-size: .95rem; }

/* ── Feature rows ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 1.4rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 1.1rem; padding: 1.2rem 1.3rem; }
.card h3 { color: var(--text-1); }
.card p:last-child { margin-bottom: 0; }
.tiers { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0 0; padding: 0; list-style: none; }
.tiers li { border-radius: 999px; padding: .25rem .8rem; font-weight: 800; font-size: .85rem; color: #0F0F1A; }
.t-easy { background: #34D399; } .t-medium { background: #FBBF24; } .t-hard { background: #FB923C; } .t-master { background: #F472B6; }

.gallery { display: flex; gap: 1rem; overflow-x: auto; padding: .5rem .2rem 1rem; scroll-snap-type: x mandatory; margin-top: 1.2rem; }
.gallery .phone { flex: none; width: 200px; scroll-snap-align: start; }

/* ── CTA / footer ───────────────────────────────────────── */
.cta { text-align: center; background: linear-gradient(135deg, rgba(124, 58, 237, .25), rgba(236, 72, 153, .12)); border: 1px solid var(--border); border-radius: 1.4rem; padding: 2rem 1.2rem; }
.btn { display: inline-block; padding: .7rem 1.2rem; border-radius: 999px; font-weight: 800; text-decoration: none; background: var(--purple-strong); color: #fff; }
.btn:hover { color: #fff; background: var(--purple); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-1); }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1rem; }
.footer { border-top: 1px solid var(--border); margin-top: 2rem; }
.footer-inner { max-width: 64rem; margin: 0 auto; padding: 1.6rem 1rem 2.4rem; color: var(--text-3); font-size: .9rem; }
.footer-inner p { margin: 0 0 .5rem; color: var(--text-3); }

/* ── Support page ───────────────────────────────────────── */
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: .9rem; padding: .95rem 1.15rem; margin: .7rem 0; transition: border-color .2s, box-shadow .2s; }
.faq details:hover { border-color: rgba(167, 139, 250, .45); }
.faq details[open] { border-color: rgba(167, 139, 250, .55); box-shadow: 0 12px 30px rgba(76, 29, 149, .25); }
.faq summary { cursor: pointer; font-weight: 800; color: var(--text-1); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: .55rem; height: .55rem; margin-right: .2rem;
  border-right: 2px solid var(--purple-2); border-bottom: 2px solid var(--purple-2);
  transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq details[open] summary { margin-bottom: .5rem; }
.contact .card { text-align: left; }
.contact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.contact .card a { font-weight: 800; }

/* ── Depth: cards and phones lift in 3D on hover ───────── */
.cats, .grid-2, .gallery, .contact { perspective: 1000px; }
.cat, .card, .gallery .phone {
  transform-style: preserve-3d;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s, border-color .35s;
}
.cat { box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px rgba(0, 0, 0, .25); }
.cat .tile { box-shadow: 0 8px 20px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .25) inset; transform: translateZ(20px); }
.gallery .phone { transform: rotateY(-8deg); }
.gallery .phone:nth-child(even) { transform: rotateY(8deg); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cat:hover, .card:hover { transform: translateY(-6px) rotateX(6deg); border-color: rgba(167, 139, 250, .5); box-shadow: 0 22px 50px rgba(76, 29, 149, .35); }
  .gallery .phone:hover { transform: rotateY(0) translateY(-6px) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .gallery .phone, .gallery .phone:nth-child(even) { transform: none; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: left; }
  /* Phones and small tablets: the 3D scene opens the page, above the title. */
  .has-3d .hero-visual { order: -1; margin: -1rem 0 -.5rem; }
  .hero3d { height: clamp(260px, 70vw, 380px); }
  .cats { grid-template-columns: repeat(2, 1fr); }
  .contact { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  section { padding: 2.2rem 0; }
  .cats, .grid-2 { grid-template-columns: 1fr; }
  .switch .name { display: none; }
  .switch .code { display: inline; }
  .switch a { padding: .25rem .55rem; }
  .phone.tilt { transform: none; }
}
@media (forced-colors: active) { .hero h1 { -webkit-text-fill-color: currentColor; background: none; } }
