/* ===========================
   Bitcoin Learning Site
   Design system + shared styles
   =========================== */

:root {
  --bg: #0a0a0f;
  --bg-elev: #12121a;
  --bg-card: rgba(24, 24, 36, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f7;
  --text-muted: #a0a0b0;
  --text-dim: #6c6c7a;
  --orange: #f7931a;
  --orange-dim: rgba(247, 147, 26, 0.15);
  --orange-glow: rgba(247, 147, 26, 0.35);
  --green: #00d97e;
  --red: #ff4d6d;
  --gradient-orange: linear-gradient(135deg, #f7931a 0%, #ffb347 100%);
  --gradient-bg: radial-gradient(ellipse at top, #1a1a2e 0%, #0a0a0f 60%);
  --shadow-glow: 0 8px 40px rgba(247, 147, 26, 0.18);
  --radius: 14px;
  --radius-sm: 8px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(247, 147, 26, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(100, 80, 200, 0.06), transparent);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--orange);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.8; }

/* === NAVIGATION === */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 10, 15, 0.7);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-brand .logo {
  width: 32px;
  height: 32px;
  background: var(--gradient-orange);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--border);
  opacity: 1;
}

.nav-links a.active {
  color: var(--orange);
  background: var(--orange-dim);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 18px;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
  }
  .nav-links.open { display: flex; }
  .nav-inner { flex-wrap: wrap; }
}

/* === CONTAINER & LAYOUT === */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

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

section { padding: 80px 0; }
section.compact { padding: 48px 0; }

/* === TYPOGRAPHY === */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin-bottom: 24px; }
h3 { font-size: 1.3rem; margin-bottom: 12px; }

p { color: var(--text-muted); margin-bottom: 16px; font-size: 1.05rem; }
p.lead {
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 400;
  line-height: 1.55;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--orange);
  margin-bottom: 16px;
  padding: 6px 12px;
  background: var(--orange-dim);
  border-radius: 999px;
  border: 1px solid rgba(247, 147, 26, 0.25);
}

.gradient-text {
  background: var(--gradient-orange);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === HERO === */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  position: relative;
}

.hero h1 {
  margin-bottom: 24px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.hero .lead {
  max-width: 720px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 32px;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient-orange);
  color: #1a1004;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { transform: translateY(-1px); opacity: 1; box-shadow: 0 12px 50px rgba(247, 147, 26, 0.3); }

.btn-ghost {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border-strong);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: var(--border); opacity: 1; }

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover {
  border-color: var(--border-strong);
}

.card h3 { color: var(--text); }

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--orange-dim);
  display: grid;
  place-items: center;
  font-size: 22px;
  margin-bottom: 16px;
  color: var(--orange);
}

.grid {
  display: grid;
  gap: 20px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* === STAT === */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === KNOWLEDGE BOX === */
.knowledge-box {
  background: linear-gradient(135deg, rgba(247, 147, 26, 0.08), rgba(247, 147, 26, 0.02));
  border: 1px solid rgba(247, 147, 26, 0.25);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 32px 0;
}
.knowledge-box .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  margin-bottom: 12px;
}
.knowledge-box h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}
.knowledge-box p { margin-bottom: 0; color: var(--text); font-size: 0.98rem; }
.knowledge-box p + p { margin-top: 12px; }

/* === QUOTE === */
.quote {
  font-size: 1.25rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--text);
  padding: 24px 0 24px 28px;
  border-left: 3px solid var(--orange);
  margin: 32px 0;
  background: linear-gradient(90deg, rgba(247, 147, 26, 0.05), transparent);
  padding-right: 24px;
}
.quote cite {
  display: block;
  font-style: normal;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-weight: 500;
}

/* === TIMELINE === */
.timeline {
  position: relative;
  padding-left: 32px;
  margin: 32px 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--orange), transparent);
}
.timeline-item {
  position: relative;
  padding-bottom: 32px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--bg), 0 0 12px var(--orange-glow);
}
.timeline-item h3 {
  color: var(--text);
  margin-bottom: 4px;
  font-size: 1.15rem;
}
.timeline-item .era {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--orange);
  font-weight: 600;
  margin-bottom: 8px;
}

/* === FORMS === */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-group .hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

input[type="number"], input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-dim);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-strong);
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gradient-orange);
  cursor: pointer;
  box-shadow: 0 0 12px var(--orange-glow);
  border: 2px solid var(--bg);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.range-row input[type="number"] {
  width: 110px;
  flex-shrink: 0;
}

/* === CALCULATOR LAYOUT === */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 32px 0;
}
@media (max-width: 768px) {
  .calc-grid { grid-template-columns: 1fr; }
}

.calc-result {
  background: linear-gradient(135deg, rgba(247, 147, 26, 0.12), rgba(247, 147, 26, 0.02));
  border: 1px solid rgba(247, 147, 26, 0.3);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: none; padding-bottom: 0; }
.result-label { color: var(--text-muted); font-size: 14px; }
.result-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.result-value.highlight { color: var(--orange); font-size: 1.8rem; }
.result-value.bad { color: var(--red); }
.result-value.good { color: var(--green); }

/* === CHART === */
.chart-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}
.chart-wrap canvas { width: 100% !important; height: 280px !important; }

/* === VISUAL CONTAINERS === */
.visual {
  margin: 32px 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.visual svg { display: block; width: 100%; height: auto; }

.visual-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  margin: 32px 0;
}
.visual-card .visual-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.visual-card .visual-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.visual-card .visual-caption {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
  font-style: italic;
}

.hero-visual {
  margin: 32px auto 0;
  max-width: 520px;
}

/* === FOOTER === */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  margin-top: 80px;
  text-align: center;
}
.footer p { color: var(--text-dim); font-size: 14px; margin: 0; }

/* === MISC === */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  margin: 48px 0;
}

ul.feature-list {
  list-style: none;
  margin: 16px 0;
}
ul.feature-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
  color: var(--text-muted);
}
ul.feature-list li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--orange);
  font-size: 12px;
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.6s ease forwards; }
.fade-up.delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-up.delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-up.delay-3 { animation-delay: 0.3s; opacity: 0; }

/* Selection */
::selection { background: var(--orange-dim); color: var(--text); }
