/* ==========================================================================
   TesterKeyboard.com - Production Stylesheet (assets/css/style.css)
   Hardware Diagnostic UI & Technical Engineering Typography
   ========================================================================== */
:root {
  --bg-deep: #090d16;
  --bg-panel: #111827;
  --bg-card: #1e293b;
  --bg-key: #1f2937;
  --bg-key-hover: #374151;
  --border-subtle: #1f2937;
  --border-focus: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #0ea5e9;
  --accent-cyan-glow: rgba(14, 165, 233, 0.35);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.28);
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.45);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(14, 165, 233, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 85% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 35%);
}

/* Top Telemetry Status Bar */
.top-status-bar {
  background: #06090f;
  border-bottom: 1px solid #1e293b;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.45rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  display: inline-block;
  margin-right: 6px;
}

/* Main Navigation Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #1e293b;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.05rem;
  color: #06090f;
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.35);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--accent-cyan);
}

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.hero-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #1e293b;
}

.hero-title-block h1 {
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.hero-title-block p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 820px;
}

.btn-action {
  background: #1e293b;
  color: var(--text-main);
  border: 1px solid #334155;
  padding: 0.5rem 0.95rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action:hover {
  background: #334155;
  border-color: var(--accent-cyan);
}

/* Telemetry KPI Strip */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.telemetry-card {
  background: var(--bg-panel);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  position: relative;
  overflow: hidden;
}

.telemetry-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent-cyan);
}

.telemetry-card.card-emerald::before { background: var(--accent-emerald); }
.telemetry-card.card-amber::before { background: var(--accent-amber); }
.telemetry-card.card-rose::before { background: var(--accent-rose); }

.telemetry-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.telemetry-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  font-family: var(--font-mono);
}

/* Control Toolbar */
.tester-toolbar {
  background: var(--bg-panel);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.segmented-control {
  display: inline-flex;
  background: #090d16;
  padding: 3px;
  border-radius: 7px;
  border: 1px solid #1e293b;
}

.seg-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.38rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-btn.active {
  background: var(--accent-cyan);
  color: #06090f;
}

.threshold-select {
  background: #090d16;
  color: var(--text-main);
  border: 1px solid #334155;
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Live Scancode Stream Bar */
.scancode-stream-wrap {
  background: #06090f;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  white-space: nowrap;
}

.stream-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.stream-items {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.stream-pill {
  background: #111827;
  border: 1px solid #1f2937;
  color: #e2e8f0;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
}

.stream-pill.chatter-pill {
  background: rgba(244, 63, 94, 0.18);
  border-color: var(--accent-rose);
  color: #fda4af;
}

/* Interactive Keyboard Deck */
.keyboard-stage {
  background: linear-gradient(180deg, #111827 0%, #0b101b 100%);
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-bottom: 2rem;
  overflow-x: auto;
}

.keyboard-chassis {
  display: flex;
  gap: 1.15rem;
  min-width: 980px;
  justify-content: center;
  user-select: none;
}

.keyboard- chassis.layout-tkl .numpad-cluster {
  display: none;
}

.keyboard-chassis.layout-60 .numpad-cluster,
.keyboard-chassis.layout-60 .nav-cluster,
.keyboard-chassis.layout-60 .f-row {
  display: none;
}

.main-alpha-cluster {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-cluster {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.nav-top-group, .nav-arrows-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.numpad-cluster {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kb-row {
  display: flex;
  gap: 6px;
}

.kb-row.f-row {
  margin-bottom: 8px;
}

.keycap {
   --u: 46px;
  width: var(--u);
  height: 46px;
  background: linear-gradient(180deg, #263244 0%, #1a2332 100%);
  border: 1px solid #334155;
  border-bottom: 3px solid #0f172a;
  border-radius: 6px;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 7px;
  cursor: pointer;
  position: relative;
  transition: transform 0.05s ease, background 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.keycap:hover {
  border-color: #475569;
}

.keycap .key-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  line-height: 1;
}

.keycap .key-count {
  font-size: 0.58rem;
  color: #64748b;
  font-weight: 500;
}

.keycap .key-sub {
  font-size: 0.6rem;
  color: #94a3b8;
  align-self: flex-start;
}

/* Key Width Multipliers */
.u-125 { width: calc(46px * 1.25 + 1.5px); }
.u-150 { width: calc(46px * 1.5 + 3px); }
.u-175 { width: calc(46px * 1.75 + 4.5px); }
.u-200 { width: calc(46px * 2 + 6px); }
.u-225 { width: calc(46px * 2.25 + 7.5px); }
.u-275 { width: calc(46px * 2.75 + 10.5px); }
.u-625 { width: calc(46px * 6.25 + 31.5px); }
.f-gap { margin-left: 19px; }

/* Key States */
.keycap.active-down {
  transform: translateY(2px);
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  color: #06090f;
  border-color: #7dd3fc;
  border-bottom-width: 1px;
  box-shadow: 0 0 18px var(--accent-cyan-glow);
}

.keycap.active-down .key-count,
.keycap.active-down .key-sub {
  color: #06090f;
}

.keycap.tested-latched {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.24) 0%, rgba(5, 150, 105, 0.32) 100%);
  border-color: var(--accent-emerald);
  color: #ecfdf5;
}

.keycap.tested-latched .key-count {
  color: #6ee7b7;
}

.keycap.chatter-fault {
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.38) 0%, rgba(190, 18, 60, 0.48) 100%) !important;
  border-color: var(--accent-rose) !important;
  box-shadow: 0 0 16px var(--accent-rose-glow);
  color: #ffe4e6 !important;
}

/* Legend Strip */
.keyboard-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid #1e293b;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

/* Deep Technical Documentation Layout */
.docs-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.25rem;
  align-items: start;
  margin-top: 2.5rem;
}

@media (max-width: 1024px) {
  .docs-wrapper {
    grid-template-columns: 1fr;
  }
}

.toc-sidebar {
  position: sticky;
  top: 84px;
  background: var(--bg-panel);
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 1.25rem;
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #1e293b;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.toc-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  line-height: 1.35;
  display: block;
  transition: color 0.15s ease, transform 0.15s ease;
}

.toc-list a:hover {
  color: var(--accent-cyan);
  transform: translateX(3px);
}

.author-eeat-box {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #1e293b;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.author-eeat-box strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.2rem;
}

/* Article Content Styling */
.engineering-article {
  background: var(--bg-panel);
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 2.5rem;
}

.article-meta-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #1e293b;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.eeat-badge {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  padding: 0.25rem 0.65rem;
  border-radius: 5px;
}

.doc-section {
  margin-bottom: 3rem;
}

.doc-section h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sec-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.doc-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 1.5rem 0 0.65rem 0;
}

.doc-section p {
  color: #cbd5e1;
  font-size: 0.98rem;
  margin-bottom: 1rem;
  line-height: 1.75;
}

.doc-section ul, .doc-section ol {
  margin: 0.85rem 0 1.25rem 1.4rem;
  color: #cbd5e1;
}

.doc-section li {
  margin-bottom: 0.55rem;
  line-height: 1.65;
}

.doc-section code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: #090d16;
  color: #38bdf8;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #1e293b;
}

/* Raster Image Figures */
.raster-figure {
  margin: 1.75rem 0;
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.seo-raster-img {
  width: 100%;
  height: auto;
  display: block;
}

.raster-figure figcaption {
  padding: 0.85rem 1.15rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  border-top: 1px solid #1e293b;
  background: #0b101b;
}

/* Data Tables */
.table-responsive {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid #1e293b;
  border-radius: 8px;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.tech-table th {
  background: #090d16;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #1e293b;
}

.tech-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #1e293b;
  color: #cbd5e1;
}

.tech-table tr:last-child td {
  border-bottom: none;
}

/* Callout Box */
.lab-callout {
  background: rgba(14, 165, 233, 0.07);
  border-left: 4px solid var(--accent-cyan);
  padding: 1.1rem 1.35rem;
  border-radius: 0 8px 8px 0;
  margin: 1.4rem 0;
}

.lab-callout strong {
  color: #ffffff;
  display: block;
  margin-bottom: 0.3rem;
}

/* FAQ Accordion */
.faq-item {
  border: 1px solid #1e293b;
  border-radius: 8px;
  margin-bottom: 0.85rem;
  background: #090d16;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  padding: 0 1.25rem 1.15rem 1.25rem;
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.7;
  border-top: 1px solid #1e293b;
  padding-top: 0.9rem;
}

/* Footer */
.site-footer {
  background: #06090f;
  border-top: 1px solid #1e293b;
  margin-top: 4rem;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

.footer-col h4 {
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.5rem;
}

.footer-col a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--accent-cyan);
}

.footer-bottom {
  max-width: 1400px;
  margin: 2rem auto 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Cyrillic Dual-Legend & Language Switcher Extensions */
.keycap .key-cyr {
  font-size: 0.68rem;
  color: #38bdf8;
  font-weight: 700;
  align-self: flex-end;
  line-height: 1;
}
.keycap.active-down .key-cyr {
  color: #06090f;
}
.lang-switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #111827;
  border: 1px solid #334155;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-main);
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.lang-switch-pill:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
