/* ===== DESIGN TOKENS ===== */
:root {
  --bg: #FFFFFF;
  --fg: #1A1A1A;
  --primary: #1A1A1A;
  --secondary: #5A5A5A;
  --muted: #6E6E6E;
  --accent: #F09A28;
  --accent-hover: #D4871A;
  --accent-light: #FEF5E6;
  --esphome: #18BCF2;
  --esphome-hover: #0EA3D6;
  --homekit: #F09A28;
  --homekit-hover: #D4871A;
  --border: #E5E5E2;
  --surface: #FFFFFF;
  --surface-alt: #F3F3F0;
  --code-bg: #1C1C2E;
  --code-fg: #D4D4D8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Manrope', system-ui, sans-serif;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main.container { flex: 1 0 auto; }

.container {
  width: 90%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3 {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
h1 { font-size: 2rem; margin-top: 0.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p { margin: 0.75em 0; }

a {
  color: var(--primary);
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color var(--transition), text-decoration-color var(--transition);
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: var(--surface-alt);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1.25em 1.5em;
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  color: inherit;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ===== HEADER / NAV ===== */
header {
  background: rgba(26, 27, 30, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
header .container {
  max-width: 820px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header .brand {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
header .brand a {
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 5px;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.2rem;
  align-items: center;
}
nav li { margin: 0; }
nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
nav a.active {
  color: #fff;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
}

/* Dropdown */
nav .dropdown { position: relative; }
nav .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a2e;
  list-style: none;
  padding: 0.4rem;
  padding-top: 0.6rem;
  margin: 0;
  min-width: 170px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.08);
}
nav .dropdown:hover .dropdown-menu,
nav .dropdown:focus-within .dropdown-menu,
nav .dropdown.open .dropdown-menu {
  display: block;
}
nav .dropdown-menu li { margin: 0; }
nav .dropdown-menu a {
  display: block;
  padding: 0.45rem 0.85rem;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
nav .dropdown-menu a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* Nav CTA button */
.nav-cta { display: flex; align-items: center; }

/* Hamburger */
.nav-toggle {
  display: none !important;
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}
.nav-toggle-label {
  display: none !important;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 5px 0;
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 3.5rem 0 2.5rem;
  margin: -2rem calc(-50vw + 50%) 2rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.045) 1px, transparent 0);
  background-size: 28px 28px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 0.5rem;
  animation: fadeUp 0.5s ease both;
}
.hero .hero-lead {
  font-size: 1.2rem;
  color: var(--secondary);
  max-width: 520px;
  margin: 0 auto 0.4rem;
  animation: fadeUp 0.5s ease 0.08s both;
}
.hero .hero-sub {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 auto;
  animation: fadeUp 0.5s ease 0.14s both;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.75rem;
  animation: fadeUp 0.5s ease 0.2s both;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.65em 1.4em;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border: 1.5px solid transparent;
  background: var(--accent);
  color: #fff;
}
.btn:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240,154,40,0.25);
  text-decoration: none;
}
.btn.nav-cta-btn {
  padding: 0.4rem 0.7rem;
  font-size: 0.92rem;
  line-height: 1.2;
  transform: none;
}
.btn.nav-cta-btn:hover { transform: none; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--primary);
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Platform-colored buttons */
.btn-esphome {
  background: var(--esphome);
}
.btn-esphome:hover {
  background: var(--esphome-hover);
  box-shadow: 0 4px 12px rgba(24,188,242,0.25);
}
.btn-homekit {
  background: var(--homekit);
}
.btn-homekit:hover {
  background: var(--homekit-hover);
  box-shadow: 0 4px 12px rgba(240,154,40,0.25);
}

/* Platform page theming — override accent via CSS custom properties */
.theme-esphome {
  --accent: #18BCF2;
  --accent-hover: #0EA3D6;
}
.theme-homekit {
  --accent: #F09A28;
  --accent-hover: #D4871A;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55em 1.2em;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.action-btn:hover {
  background: #333;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.action-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* ===== FEATURE GRID ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}
.feature-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.feature-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(240,154,40,0.08);
}
.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}
.feature-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.feature-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--secondary);
  line-height: 1.5;
}

/* ===== PLATFORM CHOOSER ===== */
.platform-chooser {
  display: flex;
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.platform-card {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  transition: all var(--transition);
}
.platform-card:hover {
  transform: translateY(-3px);
}
.platform-card.card-esphome:hover {
  border-color: var(--esphome);
  box-shadow: 0 6px 20px rgba(24,188,242,0.1);
}
.platform-card.card-homekit:hover {
  border-color: var(--homekit);
  box-shadow: 0 6px 20px rgba(240,154,40,0.1);
}
.platform-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 0.25rem;
}
.platform-card h3 { margin: 0; font-size: 1.15rem; }
.platform-card p {
  color: var(--secondary);
  font-size: 0.9em;
  line-height: 1.5;
  margin: 0;
}
.platform-card .btn { margin-top: 0.5rem; }
.platform-card .setup-link {
  font-size: 0.88rem;
  color: var(--secondary);
}

/* ===== BOARD CHOOSER ===== */
.board-chooser {
  display: flex;
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.board-card {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  transition: all var(--transition);
}
.board-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(240,154,40,0.1);
}
.board-card h3 { margin: 0; font-size: 1.1rem; }
.board-card p {
  color: var(--secondary);
  font-size: 0.88em;
  line-height: 1.5;
  margin: 0;
}
.board-badge {
  margin-top: 0.5rem;
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.board-specs {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

/* ===== PLATFORM TOGGLE (Flash page) ===== */
.platform-toggle {
  display: flex;
  margin: 1.25rem 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 380px;
  background: var(--surface);
}
.platform-toggle button {
  flex: 1;
  padding: 0.7rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--secondary);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
}
.platform-toggle button.active {
  color: #fff;
}
#toggle-esphome.active {
  background: var(--esphome);
}
#toggle-homekit.active {
  background: var(--homekit);
}
.platform-toggle button:hover:not(.active) {
  background: var(--surface-alt);
  color: var(--primary);
}

.flash-section { display: none; }
.flash-section.active { display: block; }

.flash-device-banner {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--accent-light);
  padding: 1.15em 1.35em 1.3em;
  margin: 1.5em 0;
}
.flash-device-banner p { margin: 0.25em 0; }
.flash-banner-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.flash-banner-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}
.flash-banner-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  letter-spacing: -0.01em;
}
.flash-banner-lead {
  margin: 0.1rem 0 0;
  font-size: 0.9rem;
  color: var(--secondary);
}
.flash-step {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.4rem 0;
}
/* QR scan callout box */
.qr-scan-callout {
  width: 500px;
  max-width: 100%;
  margin: 0.5rem auto;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.qr-scan-callout__label {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.28rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.qr-scan-callout__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  text-align: center;
}
.qr-scan-callout__desc {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--secondary);
}
.flash-step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--homekit);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.35rem;
}
.flash-step-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.2rem 0;
}
.flash-banner-footnote {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--secondary);
  text-align: center;
}
.hk-saved-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  border: 1px solid #BBE3CC;
  border-radius: var(--radius-md);
  background: #F1FAF4;
  padding: 0.7rem 0.95rem;
  margin: 0.75rem 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--fg);
}
.hk-saved-banner__msg {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}
.hk-saved-banner__check {
  flex-shrink: 0;
  margin-top: 0.12em;
  color: #15803D;
}
.hk-saved-banner__clear {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: #15803D;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}
.hk-saved-banner__clear:hover { color: #0E5B2C; }
.hk-inline-qr-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0.5rem 0 0.25rem;
}
.hk-inline-qr-text {
  font-size: 0.88rem;
  line-height: 1.55;
}
.serin-qr-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px 12px;
  background: var(--surface);
  flex-shrink: 0;
}
.serin-qr-card__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
}
.serin-qr-card__head svg {
  flex-shrink: 0;
  color: var(--primary);
}
.serin-qr-card__name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}
.serin-qr-card__sub {
  font-size: 0.72rem;
  color: var(--secondary);
  margin-top: 2px;
}
.serin-qr-card__code {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* ===== TABLES ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.92rem;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.6em 0.85em;
  text-align: left;
}
th {
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--secondary);
}

/* Comparison table */
.compare-intro {
  color: var(--secondary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.compare-table th.compare-highlight,
.compare-table td.compare-highlight {
  background: var(--accent-light);
  font-weight: 600;
}
.compare-table th.compare-highlight {
  color: var(--accent-hover);
  font-weight: 700;
}

/* ===== FORMS ===== */
.form-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1em 1.5em 1.25em;
  background: var(--surface);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.form-card--warning {
  border-left: 3px solid #E53935;
}
/* Callout with a product image on the left, stretched to match card height */
.form-card--media {
  display: flex;
  align-items: stretch;
  gap: 1.25em;
}
.form-card__media {
  flex: 0 0 auto;
  width: 130px;
  align-self: stretch;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.form-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.form-card__body {
  flex: 1 1 auto;
  min-width: 0;
}
.form-card__body > :first-child { margin-top: 0; }
legend {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1.05em;
  font-weight: 700;
  padding: 0 0.4em;
  color: var(--primary);
}
input[type="radio"],
input[type="checkbox"] {
  margin-right: 0.5em;
  accent-color: var(--accent);
}
input[type="radio"] + label,
input[type="checkbox"] + label {
  display: inline-block;
  margin-bottom: 0.3em;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  max-width: 400px;
  padding: 0.65em 0.9em;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--fg);
  margin-bottom: 0.6em;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
  border-color: var(--accent);
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(240,154,40,0.12);
}
select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.4em 0.7em;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
}

/* YAML Output — dark theme */
textarea#dynamic-yaml-output {
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 1.25em 1.5em;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  box-sizing: border-box;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

/* ===== TOAST ===== */
#copy-toast {
  display: none;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 0.7em 1.4em;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
}
#copy-toast.show {
  display: block;
  animation: fadeInOut 2s ease-in-out;
  opacity: 1;
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* ===== ACTION BAR ===== */
.action-btn-group {
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-left: auto;
}
#yaml-action-bar {
  display: flex;
  align-items: center;
  margin-bottom: 0.75em;
  flex-wrap: wrap;
  gap: 0.5em;
}
#yaml-action-bar strong {
  margin-right: auto;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* ===== ERROR ===== */
.error-message {
  background: #FEF2F2;
  color: #B91C1C;
  padding: 1em 1.25em;
  border-radius: var(--radius-md);
  margin: 1em 0;
  border: 1px solid #FECACA;
  font-size: 0.92rem;
}

/* ===== CABLE OPTIONS LAYOUT ===== */
.cable-options-layout {
  display: flex;
  gap: 2em;
  align-items: flex-start;
}
.cable-options-text {
  flex: 1;
  min-width: 0;
}
.cable-options-image {
  flex-shrink: 0;
  width: 120px;
  max-width: 40%;
  height: auto;
  border-radius: var(--radius-md);
}

/* ===== SCREENSHOT ===== */
.screenshot {
  display: block;
  margin: 1em auto;
  max-width: 100%;
  height: auto;
}

.demo-gallery {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  flex-wrap: wrap;
  margin: 1.5em 0;
}
.demo-gallery figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.demo-gallery figcaption {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* ===== PAGE NOTE ===== */
.page-note {
  font-size: 0.85rem;
  color: var(--secondary);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6em 0.9em;
  margin: 0.25em 0 1.5em;
}

/* ===== PAGE CTA ===== */
.page-cta {
  margin: 2rem 0 1rem;
  padding: 2rem 1.75rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.page-cta-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.page-cta h2 {
  margin: 0 0 0.5rem;
}
.page-cta > p {
  color: var(--secondary);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto;
}
.page-cta-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.widget-center {
  display: flex;
  justify-content: center;
  margin: 1em 0;
}

#platforms,
#boards {
  scroll-margin-top: 4rem;
}

/* ===== PAGE SECTION ===== */
.page-section {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* ===== QUICK START ===== */
.quick-start ol {
  counter-reset: quick-step;
  list-style: none;
  padding: 0;
}
.quick-start li {
  counter-increment: quick-step;
  position: relative;
  padding-left: 2.75rem;
  margin-bottom: 1.25rem;
  line-height: 1.55;
}
.quick-start li::before {
  content: counter(quick-step);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
}

/* ===== FOOTER ===== */
footer {
  flex-shrink: 0;
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
  font-size: 0.88rem;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.footer-brand strong {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.footer-brand p {
  margin: 0.3rem 0 0;
  color: rgba(255,255,255,0.45);
  font-size: 0.85rem;
}
.footer-columns {
  display: flex;
  gap: 3rem;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.footer-col strong {
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.footer-col a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1rem;
}
.footer-bottom p {
  margin: 0;
  color: rgba(255,255,255,0.35);
  font-size: 0.8rem;
}
.footer-bottom .trademark-notice {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.25);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

main {
  padding: 2rem 0;
  animation: fadeUp 0.4s ease both;
}

/* ===== ACCESSIBILITY ===== */
/* Visible, consistent keyboard focus. Inputs keep their own focus ring above. */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Toggle lives in an overflow:hidden track, so an offset outline would clip —
   use an inset ring that reads on both the light and filled states. */
.platform-toggle button:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== HIDDEN FIELD (YAML generator) ===== */
.hidden-field { display: none; }
.hidden-field.visible { display: block; margin-top: 0.5em; }
.hidden-field small { display: block; color: var(--muted); font-size: 0.85em; margin-top: 0.25em; }
.option-row { margin-bottom: 0.25em; }
.option-desc {
  display: block;
  color: var(--muted);
  font-size: 0.82em;
  line-height: 1.4;
  margin: -0.1em 0 0.4em 1.75em;
  padding: 0;
}
.field-hint {
  display: block;
  color: var(--muted);
  font-size: 0.85em;
  margin-top: -0.3em;
  margin-bottom: 0.6em;
}

/* ===== FAQ / TROUBLESHOOTING ACCORDION ===== */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  background: var(--surface);
  transition: box-shadow var(--transition);
}
details:hover {
  box-shadow: var(--shadow-sm);
}
details[open] {
  box-shadow: var(--shadow-sm);
}
details summary {
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
details summary::-webkit-details-marker {
  display: none;
}
details summary::before {
  content: "+";
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--muted);
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}
details[open] summary::before {
  content: "\2212";
}
.faq-body {
  padding: 0 1.25rem 1rem 2.75rem;
  color: var(--secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}
.faq-body code {
  font-size: 0.85em;
}
.hk-step-collapse > div {
  padding: 0 1.25rem 1rem;
}
.hk-step-collapse > div > :first-child {
  margin-top: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  header .container {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  header .brand { font-size: 1.2rem; }

  .nav-toggle-label { display: block !important; }
  nav {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav-toggle:checked ~ nav { max-height: 500px; }
  nav ul {
    flex-direction: column;
    gap: 0;
  }
  nav a {
    display: block;
    padding: 0.7rem 1rem;
    border-radius: 0;
  }

  nav .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    transform: none;
    background: transparent;
  }
  nav .dropdown .dropdown-menu { display: none; }
  nav .dropdown:hover .dropdown-menu,
  nav .dropdown:focus-within .dropdown-menu,
  nav .dropdown.open .dropdown-menu { display: block; }
  nav .dropdown-menu a {
    padding-left: 2.5rem;
    font-size: 0.88rem;
  }

  .nav-cta { margin-left: 0; padding: 0.6rem 1rem; }
  .btn.nav-cta-btn { font-size: 0.92rem; padding: 0.5rem 1.2rem; }

  .container { width: 95%; padding: 0 12px; }
  main { padding: 1.25rem 0; }

  .hero {
    padding: 2.5rem 0 2rem;
  }
  .hero h1 { font-size: 1.65rem; }
  .hero .hero-lead { font-size: 1.05rem; }
  .hero-actions,
  .page-cta-actions {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .features-grid { grid-template-columns: 1fr; }
  .platform-chooser { flex-direction: column; }

  .cable-options-layout { flex-direction: column; }
  .cable-options-image {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
  }
  .board-chooser { flex-direction: column; }


  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 100%; }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"] { max-width: 100%; }

  .form-card { padding: 0.75em 1em; }
  .form-card--media { gap: 0.9em; }
  .form-card--media .form-card__media { width: 92px; }

  #yaml-action-bar { flex-direction: column; align-items: stretch; }
  .action-btn-group { margin-left: 0; justify-content: center; }
  .action-btn { padding: 0.5em 1em; font-size: 0.88rem; }

  .footer-content { flex-direction: column; gap: 1rem; }
  .footer-columns { gap: 2rem; }

  .quick-start li { padding-left: 2.5rem; }
}
