/* ============================================================
   WheelDeck – Shared Styles
   ============================================================ */

:root {
  --bg:         #0a0a0a;
  --bg-card:    #141414;
  --bg-card2:   #1c1c1c;
  --border:     #2a2a2a;
  --border-hi:  #3a3a3a;
  --accent:     #f59e0b;
  --accent-dim: rgba(245,158,11,0.12);
  --accent-glow:rgba(245,158,11,0.25);
  --text:       #ffffff;
  --text-muted: #9ca3af;
  --text-dim:   #6b7280;
  --error:      #ef4444;
  --error-dim:  rgba(239,68,68,0.12);
  --success:    #22c55e;
  --radius:     12px;
  --radius-sm:  8px;
  --radius-xs:  6px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────── */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.container--wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header / Nav ────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 28px;
  height: 28px;
}

.logo span { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--text);
  background: var(--bg-card2);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
}

/* ── Main ────────────────────────────────────────────────── */

main { padding: 48px 0 80px; }

/* ── Page header ─────────────────────────────────────────── */

.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 10px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Cards ───────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.card--accent {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Section labels ──────────────────────────────────────── */

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

/* ── Tire Input Form ─────────────────────────────────────── */

.input-hint-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 28px;
}

@media (max-width: 780px) {
  .input-hint-row {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }
}

.tire-inputs-wrap { flex: 1; }

.tire-hint-svg {
  flex-shrink: 0;
  width: 180px;
}

/* wider only on the calculator page where the two-view hint is used */
.hint-two-views {
  width: 300px;
}

@media (max-width: 640px) {
  .tire-hint-svg { width: 100%; max-width: 240px; margin: 0 auto; }
  .hint-two-views { max-width: 300px; }
}

.inputs-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 68px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input-group input {
  background: var(--bg-card2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}

.input-group input::-webkit-inner-spin-button,
.input-group input::-webkit-outer-spin-button { -webkit-appearance: none; }

.input-group input:focus {
  border-color: var(--accent);
}

.input-group input.error {
  border-color: var(--error);
}

@media (max-width: 420px) {
  .inputs-row {
    gap: 8px;
  }

  .input-group {
    min-width: 58px;
  }

  .input-group input {
    padding: 9px 10px;
    font-size: 1.3rem;
  }
}

@media (max-width: 370px) {
  .card {
    padding: 18px;
  }
}

.input-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
  text-align: center;
}

.separator {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dim);
  align-self: center;
  padding-bottom: 4px;
  flex-shrink: 0;
}

/* ── Error message ───────────────────────────────────────── */

.error-msg {
  background: var(--error-dim);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 16px;
  margin-top: 14px;
  display: none;
}

.error-msg.visible { display: block; }

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 32px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}

.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn--full { width: 100%; margin-top: 20px; }

/* ── Results block ───────────────────────────────────────── */

.results-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 28px;
  display: none;
}

.results-block.visible { display: block; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
}

.results-header-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Unit Toggle ─────────────────────────────────────────── */

.unit-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}

.unit-toggle button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.05em;
}

.unit-toggle button.active {
  background: var(--accent);
  color: #000;
}

/* ── Result items grid ───────────────────────────────────── */

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
}

@media (max-width: 480px) {
  .results-grid { grid-template-columns: 1fr; }
}

.result-item {
  background: var(--bg-card);
  padding: 20px 22px;
}

.result-item__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.result-item__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.result-item__sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ── SVG Visualization ───────────────────────────────────── */

.viz-block {
  padding: 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.viz-container {
  max-width: 400px;
  margin: 0 auto;
}

.viz-container svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Comparison layout ───────────────────────────────────── */

.comparison-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .comparison-inputs { grid-template-columns: 1fr; }
}

.size-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.size-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
}

.size-badge--1 { background: var(--accent); color: #000; }
.size-badge--2 { background: #3b82f6; color: #fff; }

.comparison-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}

@media (max-width: 560px) {
  .comparison-results { grid-template-columns: 1fr; }
}

.compare-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.compare-col__header {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.compare-col--1 .compare-col__header { background: rgba(245,158,11,0.15); color: var(--accent); }
.compare-col--2 .compare-col__header { background: rgba(59,130,246,0.15); color: #3b82f6; }

.compare-col .result-item { background: var(--bg-card); }

/* ── Speedometer diff ────────────────────────────────────── */

.speedo-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  text-align: center;
}

.speedo-block h3 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.speedo-diff {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 24px;
  flex-wrap: wrap;
}

.speedo-item {
  text-align: center;
}

.speedo-item__label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.speedo-item__value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.speedo-arrow {
  font-size: 1.5rem;
  color: var(--text-dim);
  padding-bottom: 0.4rem;
}

.speedo-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 12px;
}

/* ── Comparison viz ──────────────────────────────────────── */

.compare-viz {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  display: none;
}

.compare-viz.visible { display: block; }

.compare-viz__warning {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 20px;
}

.compare-viz__inner {
  max-width: 500px;
  margin: 0 auto;
}

.compare-viz__inner svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ── How-to page ─────────────────────────────────────────── */

.how-to-content { max-width: 720px; margin: 0 auto; }

.code-example {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin-bottom: 40px;
}

.tire-code-display {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-bottom: 8px;
}

.tire-code-display span { color: var(--text-dim); }

.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.part-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.part-card__number {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.part-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

.part-card__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.content-section {
  margin: 40px 0;
}

.content-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.content-section p {
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.7;
}

/* ── FAQ ─────────────────────────────────────────────────── */

.faq-list { margin-top: 24px; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  background: var(--bg-card);
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 16px 20px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background 0.15s;
}

.faq-question:hover { background: var(--bg-card2); }

.faq-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
  color: var(--text-dim);
}

.faq-item.open .faq-chevron { transform: rotate(180deg); }

.faq-answer {
  display: none;
  padding: 16px 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  border-top: 1px solid var(--border);
}

.faq-item.open .faq-answer { display: block; }

/* ── Hero (index page) ───────────────────────────────────── */

.hero {
  padding: 64px 20px 56px;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 18px;
}

.hero h1 span { color: var(--accent); }

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 36px;
}

.hero-ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.2s, transform 0.15s;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.tool-card__icon {
  font-size: 2rem;
  margin-bottom: 14px;
}

.tool-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.tool-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.tool-card__arrow {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.875rem;
}

.tool-card--wide {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 24px;
}

.tool-card--wide .tool-card__icon {
  font-size: 2.5rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.tool-card--wide .tool-card__body {
  flex: 1;
}

.tool-card--wide h2 {
  margin-bottom: 4px;
}

.tool-card--wide .tool-card__arrow {
  margin-top: 0;
  flex-shrink: 0;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .tool-card--wide {
    flex-direction: column;
    align-items: flex-start;
  }
  .tool-card--wide .tool-card__arrow {
    margin-top: 8px;
  }
}

/* ── About / Privacy ─────────────────────────────────────── */

.prose {
  max-width: 680px;
  margin: 0 auto;
}

.prose h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}

.prose p, .prose li {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 12px;
}

.prose ul { padding-left: 20px; }
.prose a { color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 20px;
  text-align: center;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

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

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Breadcrumb ──────────────────────────────────────────── */

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb span { margin: 0 6px; }

/* ── Responsive nav ──────────────────────────────────────── */

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

  .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: #111;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 4px;
  }

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

  .site-nav a {
    padding: 10px 14px;
    font-size: 0.95rem;
  }

  .header-inner { position: relative; }
}

/* ── Utilities ───────────────────────────────────────────── */

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Tire hint SVG labels ────────────────────────────────── */
.hint-label { font-size: 11px; fill: var(--text-muted); font-family: inherit; }
.hint-label--accent { fill: var(--accent); font-weight: 700; }
.hint-line { stroke: var(--border-hi); stroke-width: 1; }