/* styles.css — MeshCadet landing page.
 *
 * Color tokens are lifted 1:1 from firmware/src/ui/theme.slint's `Theme`
 * global ("Mission Control" dark-space + cyan radio-signal palette) so the
 * web presence and the on-device UI read as the same product. If theme.slint
 * ever changes its palette, update the custom properties below to match.
 */

:root {
  --bg-space: #0d1117;
  --surface: #161e28;
  --surface-raised: #1e2a38;
  --surface-alt: #2a3442;
  --brand-signal: #00b4ff;
  --brand-signal-bright: #33c4ff;
  --text-primary: #e8ecf0;
  --text-secondary: #a0a8b0;
  --text-muted: #606870;
  --nebula-violet: #7c5cff;
  --star-gold: #ffd66b;
  --danger: #ff5c6a;
  --danger-bright: #ff7a85;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-space);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.55;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.wrap-narrow {
  max-width: 720px;
}

a {
  color: var(--brand-signal-bright);
}

/* ── Top bar ────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--surface-alt);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.wordmark span {
  color: var(--brand-signal);
}

.topnav {
  display: flex;
  gap: 24px;
}

.topnav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
}

.topnav a:hover {
  color: var(--brand-signal-bright);
}

/* Marks the nav item for the page you're already on — same item set/order
   appears on every page (site/README.md "Conventions"), so this is the only
   visual cue distinguishing "you are here" from the other tool link. */
.topnav a[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Hero ───────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--bg-space);
  padding: 72px 0 96px;
}

.hero-starfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  pointer-events: none;
}

.hero-horizon {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  opacity: 0.6;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-copy {
  max-width: 620px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--star-gold);
  margin: 0 0 12px;
}

.hero h1 {
  font-size: 44px;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

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

.tagline {
  color: var(--text-secondary);
  font-size: 16px;
  margin: 0 0 28px;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--brand-signal);
  color: #06141f;
}

.btn-primary:hover {
  background: var(--brand-signal-bright);
}

.btn-ghost {
  background: transparent;
  border-color: var(--surface-alt);
  color: var(--text-primary);
}

.btn-ghost:hover {
  border-color: var(--brand-signal);
  color: var(--brand-signal-bright);
}

/* Destructive actions (clear-history) — bordered danger, fills on hover so
   it reads as consequential without shouting before the user commits. */
.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger-bright);
}

.btn-danger:hover {
  background: var(--danger);
  color: #06141f;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger:disabled:hover {
  background: transparent;
  color: var(--danger-bright);
}

/* Confirmation gate for a destructive action — a bordered, tinted callout
   revealed only after the first click, holding the acknowledgement checkbox
   and final erase button. */
.warn-box {
  margin-top: 16px;
  padding: 16px 20px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: rgba(255, 92, 106, 0.08);
}

.warn-box > p {
  margin-top: 0;
  color: var(--text-primary);
  font-size: 14px;
}

.hero-art {
  position: relative;
  flex-shrink: 0;
}

.hero-art img {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}

/* ── Sections ───────────────────────────────────────────────────────── */

.section {
  padding: 72px 0;
}

.section-alt {
  background: var(--surface);
  border-top: 1px solid var(--surface-alt);
  border-bottom: 1px solid var(--surface-alt);
}

.section h2 {
  font-size: 28px;
  margin: 0 0 32px;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-alt);
  border-radius: 10px;
  padding: 24px;
}

.card img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.card code {
  font-family: var(--font-mono);
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}

/* ── Getting started ────────────────────────────────────────────────── */

.section-intro {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 640px;
  margin: 0 0 32px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  gap: 16px;
  background: var(--surface-raised);
  border: 1px solid var(--surface-alt);
  border-radius: 10px;
  padding: 24px;
}

.step-number {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-signal);
  color: #06141f;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
}

.step-body h3 {
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.step-body p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.step-body .btn {
  margin-top: 4px;
}

.step-body .learn-more {
  display: inline-block;
  font-size: 14px;
  color: var(--brand-signal-bright);
  text-decoration: none;
}

.step-body .learn-more:hover {
  text-decoration: underline;
}

.browser-note {
  margin-top: 4px !important;
}

/* ── Screenshots gallery ────────────────────────────────────────────── */

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
}

.screenshot-card {
  margin: 0;
  text-align: center;
}

/* Subtle device-frame treatment — rounded corners + a soft drop-shadow,
   deliberately restrained (no bezel/notch chrome) so the on-device UI
   itself stays the focus. Images are the real 320x240 device resolution;
   `max-width: 100%` lets the grid shrink them responsively without
   upscaling past their native size. */
.screenshot-card img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--surface-alt);
}

.screenshot-card figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Web flasher (flash.html) ──────────────────────────────────────── */

.hero-flash {
  padding-bottom: 48px;
}

.flash-panel {
  background: var(--surface);
  border: 1px solid var(--surface-alt);
  border-radius: 10px;
  padding: 32px;
  margin-bottom: 24px;
}

.flash-panel h2 {
  font-size: 16px;
  margin: 28px 0 8px;
}

.flash-panel h2:first-child {
  margin-top: 0;
}

.flash-panel h3 {
  font-size: 14px;
  margin: 20px 0 8px;
  color: var(--text-primary);
}

.flash-panel p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 8px;
}

.version-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.version-select {
  width: 100%;
  max-width: 360px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--surface-alt);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
}

.version-select:disabled {
  color: var(--text-muted);
}

.version-status {
  margin-top: 8px !important;
}

.footnote {
  margin-top: 24px !important;
  padding-top: 16px;
  border-top: 1px solid var(--surface-alt);
}

/* ── Two-path web flasher (Fresh install vs Upgrade — ADR-0009) ───────── */

.path-choice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0 12px;
}

.path-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--surface-alt);
  border-radius: 8px;
  cursor: pointer;
}

.path-option:has(input:checked) {
  border-color: var(--brand-signal);
  background: rgba(0, 180, 255, 0.06);
}

.path-option:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.path-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--brand-signal);
}

.path-option-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.path-option-body strong {
  color: var(--text-primary);
  font-size: 14px;
}

.path-option-body .muted {
  font-size: 13px;
}

/* Informational callout — distinct from .warn-box (which is reserved for
   destructive-action confirmation, e.g. clear-history): brand-signal accent
   rather than danger red, for the Upgrade-availability note and the
   pre-upgrade backup advisory (neither blocks anything by itself). */
.note-box {
  margin: 4px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--surface-alt);
  border-left: 3px solid var(--brand-signal);
  border-radius: 6px;
  background: var(--surface-raised);
  font-size: 13px !important;
  color: var(--text-secondary) !important;
}

/* ── Shared flash status bar + expandable console (ADR-0011) ──────────── */

.flash-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 12px 16px;
  border: 1px solid var(--surface-alt);
  border-left: 3px solid var(--brand-signal);
  border-radius: 6px;
  background: var(--surface-raised);
}

.flash-status-phase {
  font-size: 14px;
  color: var(--text-primary);
}

.flash-console {
  margin-top: 4px;
}

.flash-console summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}

.flash-console summary:hover {
  color: var(--brand-signal-bright);
}

.flash-console-log {
  margin: 10px 0 0;
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--surface-alt);
  border-radius: 6px;
  background: var(--bg-space);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Web provisioner (provisioner.html) ────────────────────────────── */

.mono {
  font-family: var(--font-mono);
}

.status-grid {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 10px 20px;
  margin: 0;
}

.status-grid dt {
  color: var(--text-secondary);
  font-size: 13px;
}

.status-grid dd {
  margin: 0;
  font-size: 14px;
  word-break: break-word;
}

.qr-wrap {
  /* Deliberate exception to the dark palette: a real-world QR scanner needs
     a light quiet zone around dark modules for reliable contrast — the QR
     itself is rendered dark-on-white (see provisioner.js's QRCode.toCanvas
     call), and this wraps it in a matching white card rather than dropping
     dark modules directly onto --bg-space. */
  display: inline-block;
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  line-height: 0;
}

.qr-uri {
  word-break: break-all;
}

/* ── Web provisioner writes (M2: contacts/channels/notif-defaults/commit) ── */

.inline-form h3 {
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.inline-form + .inline-form {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-alt);
}

.text-input {
  display: block;
  width: 100%;
  max-width: 480px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 6px;
  border: 1px solid var(--surface-alt);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
}

.text-input.mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.form-status {
  margin-top: 8px !important;
  min-height: 1.4em;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 13px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface-alt);
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table td {
  color: var(--text-primary);
  word-break: break-word;
}

/* The auto table-layout algorithm gives the mono pubkey/hash column most of
   the row's width and compresses the actions column below the "Remove"
   label's natural width — `.btn`'s default `white-space: normal` then lets
   the label wrap onto two lines mid-word. `nowrap` keeps the label's full
   width as the column's minimum, so layout compresses elsewhere instead. */
.data-table .btn {
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
}

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

.footer {
  border-top: 1px solid var(--surface-alt);
  padding: 32px 0 48px;
}

.footer-inner p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--brand-signal-bright);
}

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

@media (max-width: 640px) {
  .hero h1 {
    font-size: 32px;
  }

  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .topnav {
    gap: 14px;
  }
}
