/* ── Reset & Base ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --sidebar-w: 260px;
  --bg: #07070a;
  --bg-card: #0e0e12;
  --bg-card-hover: #141418;
  --bg-code: #0a0a0e;
  --border: #1a1a22;
  --border-hover: #2a2a35;
  --text: #ececef;
  --text-muted: #7e7e8a;
  --accent: #d4a257;
  --accent-soft: rgba(212, 162, 87, 0.08);
  --accent-glow: rgba(212, 162, 87, 0.15);
  --accent-bright: #e8b86a;
  --green: #4ade80;
  --radius: 14px;
  --radius-sm: 8px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(rgba(212, 162, 87, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Floating Orbs ── */
.bg-orbs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: var(--accent);
  top: -10%;
  right: -5%;
  animation: orbFloat1 25s ease-in-out infinite;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: #8b6a3a;
  bottom: 10%;
  left: -10%;
  animation: orbFloat2 30s ease-in-out infinite;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: #c48a3a;
  top: 40%;
  right: 20%;
  animation: orbFloat3 20s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-40px, 60px); }
  66% { transform: translate(30px, -40px); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(50px, -30px); }
  66% { transform: translate(-30px, 50px); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-30px, -40px); }
  66% { transform: translate(40px, 30px); }
}

/* ── Progress Bar ── */
.progress-container {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 150;
  margin-bottom: -3px;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transition: width 0.3s ease;
  box-shadow: 0 0 12px var(--accent-glow), 0 0 4px var(--accent);
}

/* ── Sidebar Search ── */
.sidebar-search-container {
  padding: 0 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

#sidebar-search {
  width: 100%;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#sidebar-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Semantic Callouts ── */
.card.warning {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.05);
}
.card.warning h3 { color: #f87171; }

.card.tip {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}
.card.tip h3 { color: var(--accent); }

.card.success {
  border-left: 4px solid var(--green);
  background: rgba(74, 222, 128, 0.05);
}
.card.success h3 { color: var(--green); }

.card.info {
  border-left: 4px solid #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}
.card.info h3 { color: #60a5fa; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: rgba(12, 12, 15, 0.85);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-right: 1px solid var(--border);
  padding: 1.75rem 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.logo-icon {
  color: var(--accent);
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.sidebar-nav {
  list-style: none;
  padding: 0.75rem 0;
}

.nav-section-label {
  padding: 1rem 1.25rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.nav-section-label.active-section {
  color: var(--accent);
}

/* ── Syntax highlighting (Manual) ── */
.token-cmd { color: var(--accent); font-weight: 600; }
.token-arg { color: #a5d6ff; }
.token-str { color: #8bba7d; }
.token-comment { color: var(--text-muted); font-style: italic; }

.nav-link {
  display: block;
  padding: 0.5rem 1.25rem;
  margin: 1px 0.6rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 450;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 12px rgba(212, 162, 87, 0.08);
}

/* ── Mobile Top Bar ── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: rgba(7, 7, 10, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
}

.mobile-page-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sidebar-toggle {
  display: flex;
  background: transparent;
  border: none;
  padding: 8px 4px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* ── Content ── */
.content {
  position: relative;
  z-index: 1;
  margin-left: var(--sidebar-w);
  max-width: 740px;
  padding: 2.5rem 2.5rem 6rem;
}

/* ── Pages ── */
.page {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ── Page header (Memory / Skills / Tips) ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.page-icon {
  font-size: 2.5rem;
  line-height: 1;
  background: var(--bg-card);
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.page-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.2rem;
}

.page-header .subtitle {
  margin-bottom: 0;
}

/* ── Hero ── */
.hero {
  position: relative;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.hero-glow {
  position: absolute;
  top: -80px;
  left: -60px;
  width: 450px;
  height: 250px;
  background: radial-gradient(ellipse, rgba(212, 162, 87, 0.2), transparent 70%);
  pointer-events: none;
  z-index: -1;
  animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.1); }
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.35rem;
  background: linear-gradient(135deg, var(--accent-bright), #fff8e7, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.hero-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
}

/* ── Sections ── */
.section {
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.section:last-child {
  border-bottom: none;
}

.section > p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.6rem;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-bright), #a07730);
  color: #0a0a0a;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(212, 162, 87, 0.25), 0 0 0 3px rgba(212, 162, 87, 0.08);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(212, 162, 87, 0.06);
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.6rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.card ul,
.card ol {
  padding-left: 1.25rem;
  margin-bottom: 0.6rem;
}

.card ul li,
.card ol li {
  padding: 0.2rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.card ul li code,
.card ol li code,
.card ul li strong,
.card ol li strong {
  color: var(--text);
}

.platform-list {
  list-style: none;
  padding-left: 0 !important;
}

.platform-list li {
  padding: 0.35rem 0 !important;
}

/* ── Card grid (for inner pages) ── */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.card-grid .full-width {
  grid-column: 1 / -1;
}

/* ── Code blocks ── */
.code-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
  gap: 0.75rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.code-block code {
  font-family: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  font-size: 0.82rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

code {
  font-family: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  font-size: 0.82em;
  background: var(--bg-code);
  padding: 0.15em 0.45em;
  border-radius: 5px;
  border: 1px solid var(--border);
}

kbd {
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 0.78em;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.15em 0.5em;
}

/* ── Copy button (icon) ── */
.copy-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  position: relative;
}

.copy-btn::after {
  content: "Copied!";
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
}

.copy-btn.copied::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ── Next Section Button ── */
.next-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(212, 162, 87, 0.06), rgba(212, 162, 87, 0.02));
  border: 1px solid rgba(212, 162, 87, 0.15);
  border-radius: var(--radius);
  transition: all 0.25s ease;
  cursor: pointer;
}

.next-section:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(212, 162, 87, 0.1), rgba(212, 162, 87, 0.04));
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(212, 162, 87, 0.1);
}

.next-label {
  display: flex;
  flex-direction: column;
}

.next-label span:first-child {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.next-label span:last-child {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.next-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.copy-btn svg {
  width: 15px;
  height: 15px;
}

.copy-btn .icon-copy {
  color: var(--text-muted);
  display: block;
}

.copy-btn .icon-check {
  color: var(--green);
  display: none;
}

.copy-btn:hover {
  background: var(--accent-soft);
}

.copy-btn:hover .icon-copy {
  color: var(--accent);
}

.copy-btn.copied .icon-copy {
  display: none;
}

.copy-btn.copied .icon-check {
  display: block;
}

/* ── Callout ── */
.callout {
  background: var(--accent-soft);
  border: 1px solid rgba(212, 162, 87, 0.2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

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

.callout a {
  color: var(--accent);
}

.callout ol {
  margin-top: 0.4rem;
  padding-left: 1.25rem;
}

.callout ol li {
  padding: 0.15rem 0;
}

/* ── Hint text ── */
.hint {
  font-size: 0.82rem !important;
  opacity: 0.7;
}

/* ── Command table ── */
.command-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.4rem 0;
}

.command-table td {
  padding: 0.45rem 0.5rem;
  font-size: 0.87rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.command-table td:first-child {
  white-space: nowrap;
  width: 1%;
}

.command-table td:last-child {
  color: var(--text-muted);
}

.command-table tr:last-child td {
  border-bottom: none;
}

/* ── Key list (y/n/a) ── */
.key-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ── VS Code tab visual ── */
.vscode-tab-visual {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #2d2d2d;
  border: 1px solid #4a4a4a;
  border-radius: 6px;
  padding: 0.3rem 0.7rem 0.3rem 0.5rem;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 400;
  color: #ccc;
  margin: 0 0.35rem;
  vertical-align: middle;
  letter-spacing: 0.01em;
}

/* ── Example blocks ── */
.example {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  margin-bottom: 0.5rem;
  font-style: italic;
}

.example.bad {
  background: rgba(239, 68, 68, 0.07);
  border-left: 3px solid #ef4444;
  color: #fca5a5;
}

.example.good {
  background: rgba(74, 222, 128, 0.07);
  border-left: 3px solid var(--green);
  color: #bbf7d0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    top: 52px;
    height: calc(100vh - 52px);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding: 68px 1.25rem 4rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .code-block code {
    font-size: 0.76rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .bg-orbs {
    display: none;
  }
}
