/* =============================================
   SCPIRef — Common Stylesheet
   ============================================= */

:root {
  --bg:         #0f1117;
  --surface:    #1a1d2e;
  --surface-2:  #222538;
  --border:     #2d3148;
  --accent:     #3b82f6;
  --accent-dim: #1e3a5f;
  --accent-glow:#60a5fa;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --green:      #22c55e;
  --radius:     10px;
  --header-h:   60px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}
a { color: var(--accent-glow); text-decoration: none; }
a:hover { color: var(--text); }

/* ── Header / Nav ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--surface);
}

/* Language selector */
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
}
.lang-select:hover,
.lang-select:focus { border-color: var(--accent); color: var(--text); }

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text-muted);
}
.nav-toggle svg { display: block; }

/* ── Layout helper ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 4rem;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-glow);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.hero h1 .accent { color: var(--accent); }

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

.hero-search {
  display: flex;
  max-width: 520px;
  margin: 0 auto 2rem;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s;
}
.hero-search:focus-within { border-color: var(--accent); }

.hero-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
}
.hero-search input::placeholder { color: var(--text-dim); }

.hero-search button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
}
.hero-search button:hover { background: #2563eb; }

.hero-ctas {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #2563eb; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent-glow); color: var(--text); background: var(--surface); }

/* ── Features Grid ── */
.features {
  padding: 4rem 0;
}

.section-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.section-sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}
.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.feature-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.feature-link {
  font-size: 0.8rem;
  color: var(--accent-glow);
  background: var(--accent-dim);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0.2rem 0.6rem;
  transition: border-color 0.15s;
}
.feature-link:hover {
  border-color: var(--accent);
  color: var(--accent-glow);
}

/* ── Highlight / USP ── */
.highlight {
  margin: 2rem 0 4rem;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}
.highlight-icon { font-size: 2.5rem; flex-shrink: 0; }
.highlight h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.highlight p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}
.highlight .accent-text { color: var(--accent-glow); font-weight: 600; }

/* ── Stats strip ── */
.stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4rem;
}
.stat-item { text-align: center; }
.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-glow);
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* ── Footer ── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-copy { font-size: 0.8rem; color: var(--text-dim); }
.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}
.footer-links a {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.footer-links a:hover { color: var(--text-muted); }

/* ── Tool Pages ── */
.tool-page main { padding: 2.5rem 0 4rem; }

.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--text-muted); }
.breadcrumb span { margin: 0 0.4rem; }

.tool-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

.tool-header { margin-bottom: 1.5rem; }
.tool-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.tool-header p { color: var(--text-muted); font-size: 0.9rem; }

.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.calc-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.field-group { margin-bottom: 1.1rem; }
.field-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.field-group label .unit {
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 0.3rem;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.input-row:focus-within { border-color: var(--accent); }

.input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-size: 1rem;
  font-family: "SF Mono", "Fira Code", monospace;
}
.input-row input::placeholder { color: var(--text-dim); }
.input-row input:read-only { color: var(--accent-glow); background: rgba(59,130,246,0.05); }

.input-row .unit-badge {
  padding: 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.impedance-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.impedance-row select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}
.impedance-row select:focus { border-color: var(--accent); }

.reset-btn {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.reset-btn:hover { border-color: var(--accent); color: var(--text); }

/* Formula reference sidebar */
.formula-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.formula-card h2 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.1rem;
}
.formula-block {
  margin-bottom: 1.25rem;
}
.formula-block h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-glow);
  margin-bottom: 0.5rem;
}
.formula-block code {
  display: block;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  line-height: 1.7;
  white-space: pre;
}

.note {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 1rem;
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
}

/* ── Ad Slots ── */
/*
  Usage:
    <div class="ad-slot ad-slot--leaderboard"><ins class="adsbygoogle" ...></ins></div>
  During development (no AdSense code), slots show as subtle placeholders.
  In production, the <ins> tag fills the space — no layout shift.
*/
.ad-slot {
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  /* Dev placeholder — remove border in production if desired */
  border: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}
.ad-slot::before {
  content: 'AD';
  opacity: 0.3;
}
/* Hide placeholder text once AdSense fills the slot */
.ad-slot:has(ins) { border: none; }
.ad-slot:has(ins)::before { display: none; }

/* Leaderboard: 728×90 desktop → 320×50 mobile */
.ad-slot--leaderboard {
  min-height: 90px;
  margin: 1.5rem 0;
}

/* Rectangle: 300×250 — sidebar, between sections */
.ad-slot--rectangle {
  min-height: 250px;
  margin-top: 1.25rem;
}

/* In-article: responsive, inside long-form content */
.ad-slot--in-article {
  min-height: 250px;
  margin: 2rem 0;
}

/* Footer banner: full-width above footer */
.ad-slot--footer-banner {
  min-height: 90px;
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

@media (max-width: 640px) {
  .ad-slot--leaderboard   { min-height: 50px; }
  .ad-slot--footer-banner { min-height: 50px; }
  .ad-slot--rectangle,
  .ad-slot--in-article    { min-height: 250px; }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    gap: 0.25rem;
  }
  .nav-toggle { display: block; }

  .hero { padding: 3rem 1rem 2.5rem; }
  .features-grid { grid-template-columns: 1fr; }
  .highlight { flex-direction: column; gap: 1rem; }
  .stats { gap: 1.5rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
