/* Stellar ZK Login — Educational Site */

/* ===== Design Tokens ===== */
:root {
  --bg: #0a0e17;
  --surface: #131825;
  --surface-hover: #1a2030;
  --surface-alt: #0f1320;
  --border: #252d3d;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-dim: #0c4a6e;
  --green: #4ade80;
  --green-dim: #064e3b;
  --yellow: #fbbf24;
  --yellow-dim: #451a03;
  --red: #f87171;
  --red-dim: #450a0a;
  --purple: #a78bfa;
  --purple-dim: rgba(139, 92, 246, 0.15);
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Navigation ===== */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--surface-hover); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }

/* ===== Layout ===== */
.main { min-height: calc(100vh - 52px - 80px); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  max-width: 700px;
  margin: 0 auto;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Feature Grid ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.card p { margin-bottom: 0.5rem; }
.card a { color: var(--accent); text-decoration: none; }
.card a:hover { text-decoration: underline; }

/* ===== Flow Diagram ===== */
.flow-diagram {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 1.5rem 0;
  justify-content: center;
  flex-wrap: wrap;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 100px;
}

.flow-step-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.flow-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.flow-step-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  max-width: 90px;
}

.flow-arrow {
  color: var(--text-dim);
  font-size: 1.2rem;
  margin: 0 0.25rem;
  flex-shrink: 0;
}

/* ===== Status Grid ===== */
.status-grid { display: flex; flex-direction: column; gap: 0.5rem; }

.status-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.status-badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 55px;
  text-align: center;
}

.status-item.real .status-badge {
  background: var(--green-dim);
  color: var(--green);
}

/* ===== Comparison Table ===== */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.comparison-table th,
.comparison-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.comparison-table th {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.comparison-table td {
  color: var(--text);
}

/* ===== Section Navigation (Learn page) ===== */
.learn-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.section-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.section-nav a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.section-nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* ===== Learn Sections ===== */
.learn-section {
  margin-bottom: 3rem;
  scroll-margin-top: 70px;
}

.learn-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.learn-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--text);
}

.learn-section p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.learn-section p strong { color: var(--text); }

.learn-section ul, .learn-section ol {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  line-height: 1.7;
}

.learn-section li { margin-bottom: 0.35rem; }

/* ===== Code Blocks ===== */
.code-block {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0.75rem 0 1rem;
  max-height: 500px;
  overflow-y: auto;
}

.code-block .kw { color: #c084fc; }       /* keywords: signal, template, component */
.code-block .fn { color: #38bdf8; }       /* functions */
.code-block .str { color: #4ade80; }      /* strings */
.code-block .cm { color: #64748b; }       /* comments */
.code-block .num { color: #fbbf24; }      /* numbers */
.code-block .ty { color: #f472b6; }       /* types */
.code-block .op { color: #94a3b8; }       /* operators */

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

.inline-code {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--accent);
}
code.addr {
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--text-muted);
}

/* ===== Formula ===== */
.formula {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  color: var(--accent);
  overflow-x: auto;
}

/* ===== Info Box ===== */
.info-box {
  font-size: 0.85rem;
  background: var(--accent-dim);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  color: var(--text);
}

.info-box strong { color: var(--accent); }

/* ===== IO Table (circuit inputs/outputs) ===== */
.io-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0.75rem 0;
}

.io-table th,
.io-table td {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.io-table th {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
}

.io-table code {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover:not(:disabled) { background: var(--accent-dim); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover { opacity: 0.9; background: var(--accent); }

.btn-secondary {
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn-warn {
  border-color: var(--yellow);
  color: var(--yellow);
}
.btn-warn:hover:not(:disabled) { background: var(--yellow-dim); }

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
}

.btn-link { margin-top: 0.75rem; }

/* ===== Chapter Cards (Try page) ===== */
.chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  opacity: 0.4;
  transition: opacity 0.3s;
}
.chapter-card.active { opacity: 1; }

.chapter-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.chapter-num {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
}

.chapter-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  flex-grow: 1;
}

.trust-badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.trust-badge.offchain { background: var(--accent-dim); color: var(--accent); }
.trust-badge.client { background: var(--green-dim); color: var(--green); }
.trust-badge.onchain { background: var(--yellow-dim); color: var(--yellow); }
.trust-badge.wallet { background: var(--purple-dim); color: var(--purple); }

/* Chapter learn/do/result sections */
.chapter-learn {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.learn-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.5rem 0;
  user-select: none;
}

.learn-toggle::before {
  content: '\25B6';
  font-size: 0.6rem;
  transition: transform 0.2s;
}

.learn-toggle.open::before {
  transform: rotate(90deg);
}

.learn-content {
  display: none;
  padding: 0.5rem 0 0.75rem;
}
.learn-content.open { display: block; }

.learn-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}
.learn-content p strong { color: var(--text); }
.learn-content code {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}

.chapter-do {
  padding: 1rem 1.5rem;
}

.chapter-do .step-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
}

.chapter-result {
  padding: 0 1.5rem 1rem;
}

/* ===== Provider Tabs ===== */
.provider-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.provider-tab {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.provider-tab:not(:last-child) { border-right: 1px solid var(--border); }
.provider-tab:hover { background: var(--surface-hover); color: var(--text); }
.provider-tab.active { background: var(--accent-dim); color: var(--accent); }
.provider-panel { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Step Insight (reused in chapters) ===== */
.step-insight {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}
.step-insight strong { color: var(--text); }
.step-insight code {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}

.step-warning {
  font-size: 0.85rem;
  background: var(--yellow-dim);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--yellow);
}

.step-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.step-detail strong { color: var(--text); }

/* ===== Spinner ===== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.timing {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--green);
}

/* ===== Results ===== */
.step-result {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.result-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  margin-top: 0.5rem;
}
.result-label:first-child { margin-top: 0; }

.result-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.result-data {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-muted);
  max-height: 200px;
  overflow-y: auto;
}

.result-data.compact { max-height: 120px; }

.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
}

/* ===== Verdict ===== */
.verdict {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.75rem;
  border-radius: 6px;
  text-align: center;
}
.verdict.verified {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.verdict.failed {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ===== Error ===== */
.error {
  color: var(--red);
  font-size: 0.85rem;
  padding: 0.5rem;
  background: var(--red-dim);
  border-radius: 4px;
}

/* ===== Wallet ===== */
.wallet-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.wallet-section:first-of-type { border-top: none; margin-top: 0.75rem; padding-top: 0; }

.wallet-address-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.wallet-address { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); word-break: break-all; }
.wallet-address-full { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); word-break: break-all; margin-top: 0.25rem; }

.wallet-balance-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.25rem; }
.wallet-balance-amount { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; color: var(--green); }
.wallet-balance-amount.unfunded { color: var(--text-muted); font-size: 0.9rem; font-weight: 400; }

.wallet-send-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.wallet-send-row { display: flex; align-items: center; gap: 0.5rem; }

.wallet-input {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.wallet-input:focus { border-color: var(--accent); }
.wallet-input::placeholder { color: var(--text-muted); opacity: 0.5; }
.wallet-input-amount { width: 120px; flex-shrink: 0; }
.wallet-input-label { font-family: var(--mono); font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }

.wallet-status { margin-top: 0.5rem; font-size: 0.85rem; }
.wallet-status.error { color: var(--red); background: var(--red-dim); padding: 0.5rem; border-radius: 4px; }

.send-success {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 2rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.75rem; }
  .flow-diagram { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); margin: 0.25rem 0; }
}

@media (max-width: 600px) {
  .container, .container-narrow, .learn-layout { padding: 1rem; }
  .chapter-header { flex-wrap: wrap; }
  .result-row { flex-direction: column; gap: 0.25rem; }
  .wallet-send-row { flex-wrap: wrap; }
  .wallet-input-amount { width: 100%; }
  .nav-inner { padding: 0 1rem; }
  .section-nav { gap: 0.15rem; }
  .section-nav a { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
}
