/* ESP-Provisioning-BLE community site
   Palette sampled directly from the org logo: navy board #0b3d65,
   BLE/Wi-Fi cyan #02e8f4, mounting-hole amber #ffba0d. Dark mode uses the
   board's own navy as the page background — the page becomes the board. */

:root {
  --bg: #f4f7fa;
  --bg-elevated: #ffffff;
  --ink: #0d1b2a;
  --ink-muted: #4d6478;
  --border: rgba(11, 61, 101, 0.14);
  --navy: #0b3d65;
  --cyan: #007b83;
  --cyan-bright: #02e8f4;
  --amber: #93590a;
  --amber-bright: #ffba0d;
  --console-bg: #071f33;
  --console-ink: #cfe9ec;
  --shadow: 0 1px 2px rgba(11, 61, 101, 0.06), 0 8px 24px rgba(11, 61, 101, 0.08);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071f33;
    --bg-elevated: #0d3355;
    --ink: #eef4f8;
    --ink-muted: #9db3c9;
    --border: rgba(255, 255, 255, 0.14);
    --cyan: #4ff0fa;
    --amber: #ffc636;
    --console-bg: #051726;
    --console-ink: #bdeef2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--cyan);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan-bright);
  outline-offset: 3px;
}

.wrap {
  width: min(1080px, 100% - 3rem);
  margin-inline: auto;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

section {
  padding-block: clamp(3rem, 6vw, 5rem);
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 0 0 1.25rem;
}

p {
  color: var(--ink-muted);
  max-width: 62ch;
}

code, pre {
  font-family: var(--mono);
}

/* ---------- Header ---------- */

.site-header {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.site-header img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.site-header span {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---------- Hero ---------- */

.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero .wrap > * {
  min-width: 0;
}

@media (max-width: 800px) {
  .hero .wrap {
    grid-template-columns: 1fr;
  }
}

.hero h1 {
  font-size: clamp(2rem, 4.2vw, 3rem);
  margin: 0.6rem 0 1rem;
}

.hero p.lede {
  font-size: 1.05rem;
  color: var(--ink-muted);
}

.cta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    background: var(--cyan-bright);
    color: #04222b;
  }
}

.btn-secondary {
  border-color: var(--border);
  color: var(--ink);
}

/* ---------- BLE console (signature element) ---------- */

.console {
  background: var(--console-bg);
  color: var(--console-ink);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

.console::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--cyan-bright), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

.console-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.console-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.console-log {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.9;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.console-log .line {
  opacity: 0;
  transform: translateY(4px);
  animation: console-in 0.4s ease forwards;
}

.console-log .line:nth-child(1) { animation-delay: 0.2s; }
.console-log .line:nth-child(2) { animation-delay: 0.4s; }
.console-log .line:nth-child(3) { animation-delay: 0.6s; }
.console-log .line:nth-child(4) { animation-delay: 0.8s; }
.console-log .line:nth-child(5) { animation-delay: 1.4s; }
.console-log .line:nth-child(6) { animation-delay: 2.1s; }
.console-log .line:nth-child(7) { animation-delay: 2.8s; }

.console-log .kw { color: var(--amber-bright); }
.console-log .cls { color: var(--cyan-bright); }

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--cyan-bright);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  animation-delay: 3.2s;
  opacity: 0;
}

.console-log .line:nth-child(7) .cursor {
  animation: blink 1s step-end infinite, console-cursor-in 0s 3.2s forwards;
}

@keyframes console-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes console-cursor-in {
  to { opacity: 1; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .console-log .line {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .cursor {
    animation: none;
    opacity: 1;
  }
}

/* ---------- Flow diagram ---------- */

.flow {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 2.25rem 0 1rem;
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  flex: 0 0 auto;
  width: 6.5rem;
}

.flow-node .icon {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--navy);
}

@media (prefers-color-scheme: dark) {
  .flow-node .icon { color: var(--cyan-bright); }
}

.flow-node .label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.flow-connector {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding-inline: 0.5rem;
}

.flow-connector .rule {
  width: 100%;
  border-top: 2px dashed var(--border);
}

.flow-connector .tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .flow {
    flex-direction: column;
  }
  .flow-connector {
    padding-block: 0.5rem;
  }
  .flow-connector .rule {
    width: 2px;
    height: 2.25rem;
    border-top: none;
    border-left: 2px dashed var(--border);
  }
}

/* ---------- Packages ---------- */

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.pkg-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.5rem 1.35rem;
  box-shadow: var(--shadow);
}

.pkg-card.ghost {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.pkg-card .pin {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber-bright);
  opacity: 0.55;
}

.pkg-card .pin.tl { top: 10px; left: 10px; }
.pkg-card .pin.tr { top: 10px; right: 10px; }
.pkg-card .pin.bl { bottom: 10px; left: 10px; }
.pkg-card .pin.br { bottom: 10px; right: 10px; }

.pkg-card h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}

.pkg-card p {
  font-size: 0.92rem;
  margin: 0 0 1rem;
}

.pkg-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.pkg-tags span {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  background: var(--bg);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

.pkg-links {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.pkg-links a {
  text-decoration: none;
}

.pkg-links a:hover {
  text-decoration: underline;
}

/* ---------- Get started ---------- */

.terminal {
  background: var(--console-bg);
  color: var(--console-ink);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 46rem;
}

.terminal .prompt {
  color: var(--amber-bright);
  margin-right: 0.5rem;
}

.terminal > div {
  min-width: 0;
  overflow-wrap: break-word;
}

.copy-btn {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--console-ink);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  flex: 0 0 auto;
}

.copy-btn:hover {
  border-color: var(--cyan-bright);
  color: var(--cyan-bright);
}

.get-started p.next {
  margin-top: 1.25rem;
  font-size: 0.95rem;
}

/* ---------- Community ---------- */

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.community-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.35rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg-elevated);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

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

.community-card .label {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.4rem;
}

.community-card p {
  font-size: 0.88rem;
  margin: 0;
}

.community-note {
  font-size: 0.92rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.75rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.site-footer a {
  color: var(--ink-muted);
  margin-right: 1rem;
}

.site-footer a:last-child {
  margin-right: 0;
}

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

/* ---------- Error page ---------- */

.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
}

.error-page .wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.error-icon {
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--amber);
  margin-bottom: 1.5rem;
}

.error-code {
  font-family: var(--mono);
  font-size: clamp(3.5rem, 10vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.5rem 0;
}

.error-page .lede {
  margin-bottom: 1.75rem;
}
