/* ==========================================================================
   Ataconda — shared styles
   Each page sets a theme class on <body>: .theme-ataconda, .theme-games, .theme-hackline
   ========================================================================== */

:root {
  --bg: #fbfaf8;
  --bg-elev: #f3f1ec;
  --bg-card: #ffffff;
  --border: #e6e2da;
  --text: #1a1830;
  --text-muted: #6a6680;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-contrast: #ffffff;
  --radius: 14px;
  --max-w: 1120px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-brand: "Sora", var(--font-display);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.theme-games {
  --accent: #9333ea;
  --accent-2: #db2777;
  --accent-contrast: #ffffff;
}

.theme-hackline {
  /* Matches the HackLine app: cyan traces on deep navy */
  --bg: #0b1220;
  --bg-elev: #0e1729;
  --bg-card: #111c30;
  --border: #22344f;
  --text: #e6f0f7;
  --text-muted: #8fa6c4;
  --accent: #3cf2e0;
  --accent-2: #3ba8ff;
  --accent-contrast: #04161a;
  --font-display: "JetBrains Mono", var(--font-mono);
  --font-brand: var(--font-display);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1em;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

.muted {
  color: var(--text-muted);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
}

.brand small {
  color: var(--accent);
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    display: block;
    padding: 14px 20px;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, white);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Sections ---------- */

section {
  padding: 96px 0;
}

.section-head {
  max-width: 680px;
  margin-bottom: 48px;
}

.hero {
  position: relative;
  padding: 120px 0 100px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 720px;
  height: 720px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%);
  pointer-events: none;
}

.hero .lead {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--text-muted);
  max-width: 620px;
  margin-bottom: 2rem;
}

.hero > .container {
  position: relative;
}

.band {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---------- Grid / cards ---------- */

.grid {
  display: grid;
  gap: 20px;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

.card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  margin-bottom: 18px;
}

.card p:last-child {
  margin-bottom: 0;
}

/* Feature card linking to a sub-brand / game */
.feature-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 48px;
  overflow: hidden;
}

@media (max-width: 860px) {
  .feature-card {
    grid-template-columns: 1fr;
    padding: 32px;
  }
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin: 0 6px 6px 0;
}

.tag.accent {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}

/* ---------- Game art (HackLine feature graphic) ---------- */

.game-art {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ---------- HackLine ---------- */

.cursor {
  display: inline-block;
  width: 0.6em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}

.blink {
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

.hl-title {
  display: flex;
  align-items: center;
  gap: 0.35em;
}

.hl-title img {
  width: 1.4em;
  height: 1.4em;
  border-radius: 22%;
  box-shadow: 0 0 40px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px);
  z-index: 100;
  opacity: 0.35;
}

/* Phone frames for game screenshots */
.phone {
  display: block;
  width: 240px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 28px;
  border: 6px solid #1b2a40;
  background: var(--bg);
  box-shadow: 0 24px 60px -24px color-mix(in srgb, var(--accent) 45%, transparent);
}

.hero-phones {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.hero-phones .phone:first-child {
  transform: rotate(-4deg) translateX(18px);
  z-index: 1;
}

.hero-phones .phone:last-child {
  transform: rotate(4deg) translate(-18px, 36px);
}

@media (max-width: 560px) {
  .hero-phones .phone {
    width: 46%;
  }
}

/* Screenshot carousel: centred slide in focus, neighbours dimmed */
.carousel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
}

.carousel-head h2 {
  margin-bottom: 0;
}

.carousel-nav {
  display: flex;
  gap: 10px;
}

.carousel-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.carousel-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.carousel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.carousel-track {
  --slide-w: 260px;
  display: flex;
  gap: 28px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 32px calc(50% - var(--slide-w) / 2) 12px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  cursor: grab;
  outline: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-track.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.slide {
  flex: 0 0 var(--slide-w);
  margin: 0;
  scroll-snap-align: center;
  opacity: 0.4;
  transform: scale(0.86);
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.45s ease;
  user-select: none;
}

.slide.active {
  opacity: 1;
  transform: none;
}

.slide .phone {
  width: 100%;
  box-shadow: none;
  transition: box-shadow 0.45s ease;
}

.slide.active .phone {
  box-shadow: 0 30px 80px -24px color-mix(in srgb, var(--accent) 60%, transparent);
}

.slide figcaption {
  margin-top: 20px;
  text-align: center;
}

.slide figcaption strong {
  display: block;
  font-family: var(--font-mono);
  color: var(--text);
  margin-bottom: 4px;
}

.slide figcaption span {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}

.carousel-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease;
}

.carousel-dots button[aria-current="true"] {
  width: 28px;
  background: var(--accent);
}

@media (max-width: 560px) {
  .carousel-track {
    --slide-w: 66vw;
    gap: 16px;
  }

  .carousel-nav {
    display: none;
  }
}

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

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
  color: var(--text);
  min-width: 180px;
}

.store-badge:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.store-badge svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.store-badge small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.store-badge strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.2;
}

/* ---------- Forms ---------- */

.signup {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 520px;
}

.signup input {
  flex: 1 1 240px;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
}

.signup input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 10px;
  min-height: 1.4em;
}

/* ---------- CTA + footer ---------- */

.cta {
  text-align: center;
}

.cta .container {
  max-width: 760px;
}

.cta .btn-row,
.cta .signup {
  justify-content: center;
  margin: 0 auto;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 32px;
}

.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-grid li {
  margin-bottom: 6px;
}

.footer-grid a {
  color: var(--text-muted);
}

.footer-grid a:hover {
  color: var(--text);
}

.footer-grid h4 {
  color: var(--text);
  margin: 0 0 12px;
  font-size: 0.9rem;
}

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .cursor,
  .blink {
    animation: none;
  }

  .slide,
  .slide .phone,
  .carousel-dots button {
    transition: none;
  }
}

/* ---------- HackLine: rules + rank ladder ---------- */

.rules {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2em;
}

.rules li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.rules li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
}

.rules strong {
  color: var(--text);
}

.rank-list {
  list-style: none;
  counter-reset: rank;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  padding: 0;
  margin: 24px 0 0;
  font-family: var(--font-mono);
}

.rank-list li {
  counter-increment: rank;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.rank-list li::before {
  content: counter(rank, decimal-leading-zero) "  ";
  color: var(--accent);
  white-space: pre;
}

.rank-list li:last-child {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}
