/* ---- SHARED STYLES — tracktuned.link ---- */

:root {
  --red: #c0392b;
  --red-light: #e74c3c;
  --red-glow: rgba(192, 57, 43, 0.25);
  --bg: #060606;
  --bg-raised: #0e0e0e;
  --border: #1a1a1a;
  --border-hover: #2a2a2a;
  --text: #d4d4d4;
  --text-dim: #888;
  --text-muted: #999;
  --text-bright: #f0f0f0;
  --bg-img-opacity: 0.12;
  --green: #22c55e;
  --amber: #eab308;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
  --max-w: 860px;
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-raised: #ffffff;
  --border: #e0e0e0;
  --border-hover: #ccc;
  --text: #333;
  --text-dim: #666;
  --text-muted: #767676;
  --text-bright: #111;
  --red-glow: rgba(192, 57, 43, 0.15);
  --bg-img-opacity: 0.12;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; position: relative; }
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/bg.png') center center / cover no-repeat;
  opacity: var(--bg-img-opacity);
  pointer-events: none;
  z-index: -1;
}
a { color: var(--red-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--text-bright); }

/* ---- LOGO SWAP ---- */
.logo-light { display: none; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: inline; }

/* ---- SKIP LINK ---- */
.skip-link { position: absolute; top: -40px; left: 0; z-index: 999; padding: 8px 16px; background: #c0392b; color: #fff; text-decoration: none; font-size: 14px; }
.skip-link:focus { top: 0; }

/* ---- THEME TOGGLE ---- */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-dim);
}
.theme-toggle:hover { border-color: var(--border-hover); color: var(--text-bright); }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }

/* ---- ANIMATIONS ---- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-in.visible { opacity: 1; transform: translateY(0); }
.fade-in:nth-child(2) { transition-delay: 0.06s; }
.fade-in:nth-child(3) { transition-delay: 0.12s; }
.fade-in:nth-child(4) { transition-delay: 0.18s; }
.fade-in:nth-child(5) { transition-delay: 0.22s; }
.fade-in:nth-child(6) { transition-delay: 0.26s; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.6rem;
  background: var(--red);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
}
.btn:hover {
  background: var(--red-light);
  color: #fff;
  box-shadow: 0 4px 30px var(--red-glow);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--red);
  color: #fff;
  background: rgba(192, 57, 43, 0.06);
  box-shadow: 0 4px 30px var(--red-glow);
}
.btn-lg { padding: 0.8rem 2rem; font-size: 0.84rem; border-radius: 10px; }
[data-theme="light"] .btn-outline { border-color: var(--border); color: var(--text); }
[data-theme="light"] .btn-outline:hover { border-color: var(--red); color: var(--red); }
[data-theme="light"] .btn:hover { color: #fff; }

/* ---- HEADER ---- */
.header {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem clamp(1.8rem, 4vw, 2.5rem);
}
.header::after {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  margin-top: clamp(1.8rem, 4vw, 2.5rem);
}
.header-logo {
  width: clamp(120px, 20vw, 160px);
  height: auto;
  filter: brightness(1.05);
  margin-bottom: 0.6rem;
}
.header-tagline {
  font-size: 0.58rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 500;
  margin-bottom: 2rem;
}
.header h1 {
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  font-weight: 800;
  line-height: 1.0;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.header h1 span:not(.sr-only) {
  background: linear-gradient(135deg, var(--red-light) 0%, var(--red) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-sub {
  font-size: clamp(0.88rem, 2vw, 1rem);
  color: var(--text-dim);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.65;
}
.header-buttons { display: flex; gap: 0.8rem; flex-wrap: wrap; justify-content: center; }

/* ---- SECTIONS ---- */
.section {
  padding: clamp(1.8rem, 4vw, 2.5rem) clamp(1.2rem, 4vw, 2rem);
  position: relative;
}
.section-inner { max-width: var(--max-w); margin: 0 auto; }
.section-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--red);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-label::before { content: ''; width: 20px; height: 1px; background: var(--red); }
.section-title {
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
}
.section-desc {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.65;
  max-width: 600px;
}

/* ---- FEATURES ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.feature-card {
  padding: 1.1rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.3s;
}
.feature-card:hover { border-color: rgba(192, 57, 43, 0.25); }
[data-theme="light"] .feature-card:hover { border-color: rgba(192, 57, 43, 0.4); }
.feature-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.3rem;
}
.feature-card p { font-size: 0.82rem; color: var(--text-dim); line-height: 1.55; }

/* ---- HOW IT WORKS ---- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.step {
  padding: 1.2rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.3s;
}
.step:hover { border-color: var(--border-hover); }
[data-theme="light"] .step:hover { border-color: var(--border-hover); }
.step-number {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 2px;
  margin-bottom: 0.8rem;
}
.step h3 { font-size: 1rem; font-weight: 700; color: var(--text-bright); margin-bottom: 0.4rem; }
.step p { font-size: 0.84rem; color: var(--text-dim); line-height: 1.6; }

/* ---- COMPATIBILITY ---- */
.compat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.compat-tag {
  padding: 0.3rem 0.7rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.2s;
}
.compat-tag:hover { border-color: var(--border-hover); }
[data-theme="light"] .compat-tag:hover { border-color: var(--border-hover); }
.compat-tag small { color: var(--text-muted); font-weight: 400; margin-left: 0.3rem; }

/* ---- CTA ---- */
.cta-section {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
  position: relative;
  overflow: hidden;
}
.cta-section::before {
  content: '';
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(192, 57, 43, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.cta-section h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--text-bright);
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
}
.cta-section p {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

/* ---- FOOTER ---- */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-link {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}
.footer-link:hover { color: var(--red-light); }

/* ---- SCREEN READER ONLY ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- SETUP PAGE SHARED ---- */
.content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(1.2rem, 4vw, 2rem);
}
.setup-section {
  padding: clamp(1.5rem, 3vw, 2rem) 0;
  border-top: 1px solid var(--border);
}
.setup-steps {
  list-style: none;
  counter-reset: step;
}
.setup-step {
  counter-increment: step;
  padding: 1rem 1rem 1rem 3.2rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.6rem;
  position: relative;
  transition: border-color 0.3s;
}
.setup-step:hover { border-color: var(--border-hover); }
[data-theme="light"] .setup-step:hover { border-color: var(--border-hover); }
.setup-step::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--red);
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--red);
  border-radius: 50%;
  opacity: 0.7;
}
.setup-step h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.25rem;
}
.setup-step p {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.setup-step code {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: rgba(192, 57, 43, 0.08);
  color: var(--text);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ---- INFO BOX ---- */
.info-box {
  padding: 0.8rem 1rem;
  background: rgba(192, 57, 43, 0.05);
  border: 1px solid rgba(192, 57, 43, 0.15);
  border-radius: 10px;
  margin: 0.8rem 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.info-box strong { color: var(--text-bright); font-weight: 600; }

/* ---- TROUBLESHOOTING ---- */
.trouble-item {
  padding: 0.8rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  transition: border-color 0.3s;
}
.trouble-item:hover { border-color: var(--border-hover); }
.trouble-q {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.3rem;
}
.trouble-a {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.trouble-a code {
  font-family: var(--mono);
  font-size: 0.76rem;
  background: rgba(192, 57, 43, 0.08);
  color: var(--text);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ---- CONTROLS GRID ---- */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.control-card {
  padding: 0.8rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.control-card h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.2rem;
}
.control-card p {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ---- WIRING TABLE ---- */
.wiring-table { width: 100%; border-collapse: collapse; margin: 0.8rem 0; }
.wiring-table td {
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.wiring-table tr:last-child td { border-bottom: none; }
.wiring-table td:first-child {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text-bright);
  width: 100px;
  font-size: 0.78rem;
}
.wiring-table td:last-child { color: var(--text-dim); }

/* ---- FAQ ---- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}
.faq-item {
  padding: 1.1rem 1.2rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.3s;
}
.faq-item:hover { border-color: rgba(192, 57, 43, 0.25); }
[data-theme="light"] .faq-item:hover { border-color: rgba(192, 57, 43, 0.4); }
.faq-item h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.4rem;
}
.faq-item p {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ---- BACK LINKS ---- */
.back-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}
.back-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--red-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.back-link:hover { color: var(--text-bright); }
.back-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---- CONTACT CARD ---- */
.contact-card {
  padding: 1.4rem 1.2rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 1rem;
}
.contact-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 0.4rem;
}
.contact-card p {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 0.3rem;
}
.contact-email {
  font-size: 1rem;
  font-weight: 600;
  color: var(--red-light);
}
.contact-email:hover { color: var(--text-bright); }

/* ---- RESPONSIVE ---- */
@media (max-width: 700px) {
  .steps { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 0.8rem; text-align: center; }
  .back-links { justify-content: center; }
  .controls-grid { grid-template-columns: 1fr; }
}
