/* ==========================================================================
   intosudoku — site stylesheet
   intosudoku is its own standalone web Sudoku game (not a mobile-app
   landing page). The palette and game rules are inspired by an earlier
   Flutter prototype, but this site plays entirely in the browser.
   This file holds shared/marketing styles; assets/css/game.css holds the
   play-page-specific board/controls styles.
   ========================================================================== */

:root {
  --bg: #0A0E17;
  --bg-grad-top: #0D1220;
  --bg-grad-bottom: #080B12;
  --surface: #121826;
  --surface-elevated: #1A2233;
  --box-alt: #161D2C;

  --accent: #5EEAD4;       /* teal glow */
  --accent-2: #818CF8;     /* indigo glow */
  --accent-soft: rgba(94, 234, 212, 0.15);

  --text-primary: #F3F6FB;
  --text-secondary: #8B96AC;
  --text-dim: #525C70;

  --error: #F87171;
  --success: #5EEAD4;

  --grid-line: #262F42;
  --grid-line-bold: #3A4560;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --shadow-glow: 0 0 40px rgba(94, 234, 212, 0.12);
  --container: 1120px;

  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-grad-top) 0%, var(--bg-grad-bottom) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: -0.01em;
}

p { color: var(--text-secondary); margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(94, 234, 212, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131A;
  box-shadow: 0 8px 30px rgba(94, 234, 212, 0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(94, 234, 212, 0.35); }
.btn-ghost {
  background: transparent;
  border-color: var(--grid-line-bold);
  color: var(--text-primary);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.btn small { display: block; font-weight: 500; opacity: .8; font-size: 11px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 23, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}
.brand { display: flex; align-items: center; }
.brand img { height: 30px; width: auto; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 34px;
}
.nav-links a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color .15s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }
.nav-cta { display: flex; align-items: center; gap: 14px; }
/* "My Stats" already lives in .nav-cta for desktop — this duplicate only
   renders inside the mobile hamburger panel (see the max-width:900px rule
   below), so the link isn't lost when .nav-cta's ghost button hides. */
.nav-links-mobile-only { display: none; }

/* ---------- Language switcher ---------- */
.lang-switch { position: relative; }
.lang-switch summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--grid-line-bold);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color .15s ease, color .15s ease;
  user-select: none;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary:hover { border-color: var(--accent); color: var(--text-primary); }
.lang-switch summary .lang-code { text-transform: uppercase; }
.lang-switch[open] summary { border-color: var(--accent); color: var(--text-primary); }
.lang-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line-bold);
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
  padding: 6px;
  z-index: 200;
}
[dir="rtl"] .lang-switch-menu { right: auto; left: 0; }
.lang-switch-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background .15s ease, color .15s ease;
}
.lang-switch-menu a:hover { background: var(--surface); color: var(--text-primary); }
.lang-switch-menu a.active { color: var(--accent); }
.lang-switch-menu a .lang-native { color: var(--text-dim); font-weight: 500; font-size: 12px; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--grid-line-bold);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 90px 0 60px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 620px;
  background: radial-gradient(ellipse at center, rgba(94, 234, 212, 0.16), transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.hero .container {
  position: relative;
  z-index: 1;
}
.hero-intro {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero h1 { font-size: 52px; margin: 18px 0 20px; }
.hero-tagline { font-size: 18px; color: var(--text-secondary); max-width: 560px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 30px; justify-content: center; }.hero-meta {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-meta div { display: flex; flex-direction: column; align-items: center; }
.hero-meta strong { font-family: var(--font-display); font-size: 22px; }
.hero-meta span { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- Sections ---------- */
section { padding: 90px 0; position: relative; }
.section-head { max-width: 620px; margin: 0 auto 56px; text-align: center; }
.section-head h2 { font-size: 36px; }
.section-head p { font-size: 16px; }

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 30px 26px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(94, 234, 212, 0.3);
  box-shadow: 0 20px 45px rgba(0,0,0,0.35);
}
.feature-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--accent-soft);
  margin-bottom: 18px;
}
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; margin: 0; }

/* ---------- Difficulty strip ---------- */
.difficulty-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.difficulty-card {
  border-radius: var(--radius-md);
  padding: 26px 22px;
  border: 1px solid var(--grid-line-bold);
  background: linear-gradient(160deg, var(--surface-elevated), var(--surface));
  text-align: center;
}
.difficulty-card .dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.difficulty-card .dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--grid-line-bold); }
.difficulty-card .dots span.on { background: var(--accent); }
.difficulty-card h3,
.difficulty-card h4 { font-size: 16px; margin-bottom: 4px; }
.difficulty-card p { font-size: 12px; margin: 0; }

/* ---------- How it works / steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  counter-reset: step;
}
.step { position: relative; padding-left: 54px; }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131A;
}
.step h3 { font-size: 17px; margin-bottom: 6px; }
.step p { font-size: 14px; }

/* ---------- Testimonials ---------- */
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.testimonial-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 26px;
}
.stars { color: var(--accent); letter-spacing: 2px; margin-bottom: 12px; font-size: 14px; }
.testimonial-card p { font-size: 14px; color: var(--text-primary); opacity: .9; }
.testimonial-author { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #06131A; font-size: 14px;
}
.testimonial-author strong { display: block; font-size: 13px; }
.testimonial-author span { font-size: 11px; color: var(--text-dim); }

/* ---------- FAQ ---------- */
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-item {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 22px 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 22px;
  color: var(--accent);
  transition: transform .2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 4px 22px; font-size: 14px; }

/* ---------- CTA band ---------- */
.cta-band {
  border-radius: var(--radius-lg);
  padding: 64px 40px;
  text-align: center;
  background: linear-gradient(135deg, rgba(94,234,212,0.12), rgba(129,140,248,0.12));
  border: 1px solid rgba(94, 234, 212, 0.25);
  position: relative;
  overflow: hidden;
}
.cta-band h2 { font-size: 32px; }
.cta-band p { max-width: 480px; margin: 0 auto 28px; }
.cta-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 64px 0 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(2, 1fr);
  gap: 40px;
  margin-bottom: 50px;
}
.footer-brand img { height: 28px; margin-bottom: 14px; }
.footer-brand p { font-size: 13px; max-width: 260px; }
.footer-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  transition: color .15s ease;
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: var(--text-dim);
}
.social-links { display: flex; gap: 14px; }
.social-links a {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--grid-line-bold);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
}
.social-links a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Simple content pages (privacy / contact / about) ---------- */
.page-hero { padding: 60px 0 20px; }
.page-hero h1 { font-size: 38px; }
.prose { max-width: 760px; margin: 0 auto; padding-bottom: 40px; }
.prose h2 { font-size: 22px; margin-top: 40px; }
.prose h3 { font-size: 17px; margin-top: 24px; }
.prose p, .prose li { color: var(--text-secondary); font-size: 15px; }
.prose ul { margin: 0 0 1em 1.2em; list-style: disc; }
.prose a { color: var(--accent); text-decoration: underline; }
.updated-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.contact-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 18px;
}
.contact-card h3 { font-size: 15px; margin-bottom: 6px; }
.contact-card a { color: var(--accent); }

.form-field { margin-bottom: 18px; }
.form-field label { display: block; font-size: 13px; margin-bottom: 8px; color: var(--text-secondary); }
.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--grid-line-bold);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-status { font-size: 13px; margin-top: 14px; min-height: 18px; }
.form-status.ok { color: var(--success); }
.form-status.err { color: var(--error); }

/* ---------- 404 ---------- */
.error-page {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
}
.error-page .code {
  font-family: var(--font-display);
  font-size: 100px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface-elevated);
  border: 1px solid var(--grid-line-bold);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ---------- Reveal-on-scroll ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].in-view { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .difficulty-strip { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .testimonial-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

/* Collapse to the hamburger nav well before the desktop layout (logo +
   5 links + language/stats/CTA) runs out of room and starts wrapping. */
@media (max-width: 900px) {
  .navbar .container { flex-wrap: nowrap; }
  .brand { flex-shrink: 0; min-width: 0; }
  .nav-links, .nav-cta .btn-ghost { display: none; }
  .nav-cta { gap: 10px; }
  .nav-cta .btn { padding: 10px 16px; font-size: 13px; white-space: nowrap; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .navbar.open .nav-links {
    display: flex;
    position: absolute;
    top: 76px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg);
    padding: 20px 24px 26px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 18px;
  }
  /* "My Stats" lives only in .nav-cta on desktop (hidden above at this
     width along with the rest of .btn-ghost) — surface it inside the open
     hamburger panel instead, so it isn't lost on mobile. */
  .navbar.open .nav-links-mobile-only { display: block; }
}

@media (max-width: 680px) {
  .navbar .container { height: 64px; }
  .brand img { height: 24px; }
  .nav-cta .btn-primary { padding: 9px 14px; font-size: 12px; }
  .hero h1 { font-size: 36px; }
  .hero-meta { gap: 20px; }
  .feature-grid { grid-template-columns: 1fr; }
  .difficulty-strip { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 30px; }
  section { padding: 60px 0; }
  .cta-band { padding: 46px 22px; }
}

@media (max-width: 380px) {
  .nav-cta .btn-ghost { display: none; }
}

/* ---------- How-to-play guide ---------- */
.breadcrumb { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.guide-toc {
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 10px 0 30px;
}
.guide-toc strong { display: block; margin-bottom: 8px; color: var(--text-primary); }
.prose .guide-toc ol { margin: 0 0 0 1.2em; list-style: decimal; }
.prose .guide-toc li { font-size: 14px; margin: 4px 0; }
.prose ol { margin: 0 0 1em 1.2em; list-style: decimal; }
.tip-box {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 20px 0;
}
.prose .tip-box p { margin: 0; color: var(--text-primary); }
.example-figure { margin: 24px 0; text-align: center; }
.example-figure figcaption { font-size: 13px; color: var(--text-dim); margin-top: 10px; }
.example-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 2px solid var(--grid-line-bold);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  font-family: var(--font-display);
}
.example-grid span {
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  font-size: clamp(13px, 4vw, 18px);
  color: var(--text-primary);
}
.example-grid span:nth-child(9n) { border-right: none; }
.example-grid span:nth-child(9n+3),
.example-grid span:nth-child(9n+6) { border-right: 2px solid var(--grid-line-bold); }
.example-grid span:nth-child(n+19):nth-child(-n+27),
.example-grid span:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--grid-line-bold); }
.example-grid span:nth-child(n+73) { border-bottom: none; }
.example-grid .hl { background: var(--box-alt); }
.example-grid .target { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--grid-line); }
.prose th { color: var(--text-primary); font-family: var(--font-display); }
.prose td { color: var(--text-secondary); }
.table-scroll { overflow-x: auto; }

.hero-tagline a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.section-head p a,
.feature-card p a,
.faq-item p a,
.contact-card p a,
.error-page p a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   RTL (Arabic and any future right-to-left language)
   Scoped under [dir="rtl"] on <html>. Only mirrors chrome/typography —
   never the Sudoku board itself: a grid's row/column order is a fixed
   logical structure, not a text-direction concern, so .sudoku-play-board,
   .box-divider, .cell and .number-pad are deliberately left untouched and
   stay LTR-ordered even on the Arabic page.
   ========================================================================== */
[dir="rtl"] .step { padding-left: 0; padding-right: 54px; }
[dir="rtl"] .step::before { left: auto; right: 0; }
[dir="rtl"] .prose th,
[dir="rtl"] .prose td { text-align: right; }
[dir="rtl"] .back-to-top { right: auto; left: 22px; }
@media (max-width: 900px) {
  [dir="rtl"] .navbar.open .nav-links { align-items: flex-end; }
}
