/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #161b22; padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em; }

/* ── Header ──────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid #21262d;
}
header h1 { font-size: 1.5rem; font-weight: 700; }
header h1 a { color: #e6edf3; }
.dot { color: #58a6ff; }
nav { display: flex; gap: 1.5rem; }
nav a { color: #8b949e; font-weight: 500; }
nav a:hover, nav a.active { color: #e6edf3; text-decoration: none; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 5rem 2rem 4rem;
}
.hero h2 {
  font-size: 2.4rem;
  line-height: 1.2;
  margin-bottom: 1rem;
}
.hero p { color: #8b949e; font-size: 1.15rem; margin-bottom: 2rem; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: #2ea043; text-decoration: none; }
.btn-secondary { background: #21262d; }
.btn-secondary:hover { background: #30363d; }

/* ── Cards ───────────────────────────────────────────────── */
.services, .api-docs { padding: 3rem 2rem; max-width: 900px; margin: 0 auto; }
.services h2, .api-docs h2 { margin-bottom: 1.5rem; font-size: 1.8rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 1.5rem;
}
.card h3 { margin-bottom: 0.5rem; }
.card p { color: #8b949e; font-size: 0.95rem; margin-bottom: 0.75rem; }
.badge {
  display: inline-block;
  background: #30363d;
  color: #8b949e;
  font-size: 0.75rem;
  padding: 0.2em 0.6em;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── API Docs ────────────────────────────────────────────── */
.endpoint {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.endpoint code { background: #0d1117; font-weight: 600; }
.protocol-steps { padding-left: 1.5rem; color: #8b949e; }
.protocol-steps li { margin-bottom: 0.5rem; }
.protocol-steps strong { color: #e6edf3; }

/* ── Collapsible API Reference ───────────────────────────── */
.api-ref-compact {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 2rem;
}
.api-ref-compact details {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
}
.api-ref-compact summary {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #8b949e;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.api-ref-compact summary::-webkit-details-marker { display: none; }
.api-ref-compact summary::before {
  content: "▸ ";
  margin-right: 0.35rem;
}
.api-ref-compact details[open] > summary::before {
  content: "▾ ";
}
.api-ref-compact .api-ref-body {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.85rem;
  color: #8b949e;
  line-height: 1.5;
}
.api-ref-compact .api-ref-body h4 {
  font-size: 0.85rem;
  color: #e6edf3;
  margin: 1rem 0 0.5rem;
}
.api-ref-compact .api-ref-body h4:first-child { margin-top: 0; }
.api-ref-compact .protocol-steps { font-size: 0.82rem; }
.api-ref-compact .protocol-steps li { margin-bottom: 0.35rem; }
.api-ref-compact .endpoint {
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
}
.api-ref-compact .endpoint code { font-size: 0.8rem; }
.api-ref-compact .endpoint p { margin: 0.25rem 0 0; font-size: 0.8rem; }

/* ── Transfer Page ───────────────────────────────────────── */
.transfer-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}
.phase { text-align: center; }
.phase h2 { margin-bottom: 0.75rem; }
.phase p { color: #8b949e; margin-bottom: 1rem; }
.hidden { display: none !important; }

/* QR container */
.qr-container {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}
.qr-container canvas { border-radius: 8px; }
.qr-loading { color: #8b949e; padding: 4rem 0; }
.qr-link-wrap { margin: 1rem 0; }
.qr-link-wrap .btn { word-break: break-all; white-space: normal; }

/* Status bar */
.status-bar {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.status-bar.secure { background: #0d2818; color: #3fb950; border: 1px solid #238636; }

/* File input */
.transfer-controls { margin: 1.5rem 0; }
.file-pick { position: relative; overflow: hidden; }
.file-pick input[type="file"] {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Offer card */
.offer {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
  color: #8b949e;
  margin: 0.75rem 0 1rem;
  font-size: 0.9rem;
}
.offer-actions { display: flex; gap: 1rem; justify-content: center; }

/* Progress */
.progress-bar {
  width: 100%;
  height: 12px;
  background: #21262d;
  border-radius: 99px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #238636, #3fb950);
  border-radius: 99px;
  transition: width 0.2s;
}
#progress-text { font-variant-numeric: tabular-nums; }

/* Spinner */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid #21262d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 1.5rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Complete phase */
#download-link { margin-bottom: 1rem; }

/* ── Footer ──────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  color: #484f58;
  border-top: 1px solid #21262d;
  font-size: 0.85rem;
}
footer .git-ref:empty {
  display: none;
}
footer .git-ref {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.1em 0.45em;
  border-radius: 4px;
  background: #21262d;
  color: #8b949e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85em;
  vertical-align: middle;
}

/* ── Connection mode indicator (WebRTC transfer) ────────── */
.connection-mode {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.connection-mode.direct { background: #0d2818; color: #3fb950; border: 1px solid #238636; }
.connection-mode.relay { background: #1d2229; color: #8b949e; border: 1px solid #30363d; }
.connection-mode.establishing { background: #1a2230; color: #58a6ff; border: 1px solid #58a6ff; }

/* Transfer stats (direct vs relay byte counters) */
.transfer-stats {
  color: #8b949e;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.5rem;
}

/* ── Debug panel (developer page) ────────────────────────── */
.debug-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1.5rem;
}
.debug-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  max-height: 20rem;
  overflow-y: auto;
  color: #c9d1d9;
}
.debug-log .entry-warn { color: #f0883e; }
.debug-log .entry-error { color: #f85149; }
.debug-log .entry-info { color: #58a6ff; }

/* ── Capability map (/map) ───────────────────────────────── */
.map-page { flex: 1; }
.map-hero {
  text-align: center;
  padding: 4rem 2rem 2rem;
}
.map-hero h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.map-hero .subtitle {
  color: #8b949e;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.map-hero .counter {
  color: #8b949e;
  font-size: 0.95rem;
  font-weight: 600;
}
.capability-map {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
.pillar {
  background: #111827;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 1.5rem;
}
.pillar-transfer { border-top: 3px solid #4caf50; }
.pillar-transform { border-top: 3px solid #42a5f5; }
.pillar-trust { border-top: 3px solid #ab47bc; }
.pillar-header {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pillar-transfer .pillar-header { color: #4caf50; }
.pillar-transform .pillar-header { color: #42a5f5; }
.pillar-trust .pillar-header { color: #ab47bc; }
.pillar-icon { font-size: 1.4rem; }
.sub-group { margin-bottom: 1.5rem; }
.sub-group:last-child { margin-bottom: 0; }
.sub-group-header {
  font-size: 0.95rem;
  color: #8b949e;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #21262d;
}
.capability-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.capability-card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 1rem;
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
}
.capability-card.live { cursor: pointer; color: inherit; }
.capability-card.live:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  text-decoration: none;
}
.capability-card.coming-soon { opacity: 0.7; }
.capability-card.planned {
  opacity: 0.45;
  border-style: dashed;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.card-icon { font-size: 1.25rem; }
.card-title {
  font-weight: 600;
  color: #e6edf3;
  font-size: 0.95rem;
}
.card-desc {
  color: #8b949e;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}
.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.card-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15em 0.45em;
  border-radius: 99px;
  font-weight: 600;
}
.badge-live {
  background: #0d2818;
  color: #3fb950;
  border: 1px solid #238636;
}
.badge-soon {
  background: #1a2230;
  color: #58a6ff;
  border: 1px solid #58a6ff;
}
.badge-affiliate {
  background: #2d1b11;
  color: #f0883e;
  border: 1px solid #f0883e;
}
.badge-seo {
  background: #1f2937;
  color: #c9d1d9;
  border: 1px solid #30363d;
}
.badge-label {
  background: #21262d;
  color: #8b949e;
  border: 1px solid #30363d;
}

/* ── Header (shared) ─────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid #21262d;
  gap: 1rem;
  flex-wrap: wrap;
}
header h1 { font-size: 1.5rem; font-weight: 700; }
header h1 a { color: #e6edf3; }
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid #30363d;
  color: #e6edf3;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 1.1rem;
  cursor: pointer;
}
nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  justify-content: center;
}
nav a { color: #8b949e; font-weight: 500; }
nav a:hover, nav a.active { color: #e6edf3; text-decoration: none; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-signin {
  color: #8b949e;
  font-weight: 500;
  font-size: 0.95rem;
}
.header-signin:hover { color: #e6edf3; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.9rem; }

.auth-providers {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  margin: 1.5rem 0;
}

/* ── Footer (shared) ─────────────────────────────────────── */
footer {
  border-top: 1px solid #21262d;
  padding: 0;
  color: #8b949e;
  font-size: 0.85rem;
}
.footer-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  padding: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}
.footer-column h3 {
  font-size: 0.95rem;
  color: #e6edf3;
  margin-bottom: 0.75rem;
}
.footer-column ul { list-style: none; }
.footer-column li { margin-bottom: 0.4rem; }
.footer-column a {
  color: #8b949e;
  font-size: 0.85rem;
}
.footer-column a:hover { color: #e6edf3; text-decoration: none; }
.footer-column a.disabled {
  color: #484f58;
  pointer-events: none;
  cursor: default;
}
.footer-bar {
  text-align: center;
  padding: 1rem 2rem;
  border-top: 1px solid #21262d;
  color: #484f58;
  font-size: 0.8rem;
}
.footer-bar a { color: #8b949e; }

/* ── Hub pages (/transfer, /transform, /trust) ───────────── */
.hub-page { flex: 1; }
.hub-hero {
  text-align: center;
  padding: 4rem 2rem 2rem;
}
.hub-hero h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.hub-hero .subtitle {
  color: #8b949e;
  font-size: 1.1rem;
}
.hub-pillar {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}
.hub-pillar.pillar-transfer { color: inherit; }
.hub-pillar.pillar-transfer .sub-group-header { color: #4caf50; border-color: #4caf50; }
.hub-pillar.pillar-transform .sub-group-header { color: #42a5f5; border-color: #42a5f5; }
.hub-pillar.pillar-trust .sub-group-header { color: #ab47bc; border-color: #ab47bc; }

/* ── Affiliate box ───────────────────────────────────────── */
.affiliate-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}
.affiliate-box h3 {
  font-size: 0.95rem;
  color: #8b949e;
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.affiliate-items {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.affiliate-item {
  flex: 1;
  min-width: 200px;
  padding: 1rem;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
}
.affiliate-item h4 {
  font-size: 0.95rem;
  color: #e6edf3;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.affiliate-item p {
  color: #8b949e;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}
.affiliate-item a {
  color: #58a6ff;
  font-size: 0.9rem;
  font-weight: 600;
}
.affiliate-item a:hover { text-decoration: underline; }
.affiliate-badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15em 0.45em;
  border-radius: 99px;
  background: #2d1b11;
  color: #f0883e;
  border: 1px solid #f0883e;
  font-weight: 600;
}

/* ── Article / content pages ─────────────────────────────── */
.content-page { flex: 1; }
.article {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem;
}
.article-hero {
  text-align: center;
  margin-bottom: 2rem;
}
.article-hero h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}
.article-hero .subtitle {
  color: #8b949e;
  font-size: 1.1rem;
}
.article-hero .last-reviewed {
  color: #8b949e;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.article .lead {
  color: #c9d1d9;
  font-size: 1.05rem;
  margin-bottom: 2rem;
}
.article .section { margin-bottom: 2rem; }
.article .section h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  color: #e6edf3;
}
.article .section p { color: #c9d1d9; margin-bottom: 0.75rem; }
.article .section ul,
.article .section ol {
  color: #c9d1d9;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.article .section li { margin-bottom: 0.5rem; }
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  border: 1px solid #21262d;
  border-radius: 8px;
}
.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.article th,
.article td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #21262d;
}
.article th {
  background: #161b22;
  color: #e6edf3;
  font-weight: 600;
}
.article td { color: #c9d1d9; }
.article tr:last-child td { border-bottom: none; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .capability-map { grid-template-columns: 1fr; }
  .footer-columns { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  header {
    flex-wrap: nowrap;
    position: relative;
  }
  .nav-toggle { display: block; }
  nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: #0d1117;
    border-bottom: 1px solid #21262d;
    padding: 1rem 2rem;
    gap: 0.75rem;
    display: none;
    z-index: 100;
  }
  body.nav-open nav { display: flex; }
  .header-actions { display: none; }
  .footer-columns { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero h2 { font-size: 1.6rem; }
  .transfer-page { padding: 1rem; }
  .capability-grid { grid-template-columns: 1fr; }
  .map-hero h1 { font-size: 1.8rem; }
  .hub-hero h1 { font-size: 1.8rem; }
}
