*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Primary colors */
  --primary: #6366F1;
  --primary-dark: #4F46E5;
  --primary-light: #818CF8;
  --accent: #8B5CF6;
  --accent-dark: #7C3AED;

  /* Neutral colors - light mode */
  --bg: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --bg-tertiary: #F3F4F6;
  --text: #111827;
  --text-secondary: #6B7280;
  --border: #E5E7EB;
  --code-bg: #F3F4F6;
  --shadow: rgba(0, 0, 0, 0.1);

  /* Semantic colors */
  --success: #10B981;
  --warning: #F59E0B;
  --note-bg: #EEF2FF;
  --note-border: var(--primary-light);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --bg-secondary: #1F2937;
    --bg-tertiary: #374151;
    --text: #F9FAFB;
    --text-secondary: #9CA3AF;
    --border: #374151;
    --code-bg: #1F2937;
    --shadow: rgba(0, 0, 0, 0.3);
    --note-bg: #1E1B4B;
    --note-border: var(--primary);
  }
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 4px 6px var(--shadow);
}

header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.subtitle {
  margin: 0;
  font-size: 1.125rem;
  opacity: 0.95;
  font-weight: 400;
}

/* Navigation */
.table-of-contents {
  max-width: 65ch;
  margin: 2rem auto;
  padding: 1.5rem 2rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.table-of-contents h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  color: var(--primary);
}

.table-of-contents ol {
  margin: 0;
  padding-left: 1.5rem;
}

.table-of-contents li {
  margin: 0.5rem 0;
}

.table-of-contents a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.table-of-contents a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Main content */
main {
  max-width: 65ch;
  margin: 0 auto;
  padding: 2rem;
}

section {
  margin-bottom: 4rem;
}

section:last-child {
  margin-bottom: 2rem;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin: 2rem 0 1rem 0;
  color: var(--text);
  border-bottom: 3px solid var(--primary);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1.5rem 0 1rem 0;
  color: var(--text);
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem 0;
  color: var(--text);
}

p {
  margin: 1rem 0;
}

ul, ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

li {
  margin: 0.5rem 0;
}

a {
  color: var(--primary);
  text-decoration: underline;
}

a:hover {
  color: var(--primary-dark);
}

code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: var(--text);
}

kbd {
  font-family: inherit;
  font-size: 0.875em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  box-shadow: 0 1px 2px var(--shadow);
  white-space: nowrap;
}

/* Steps */
.step {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  border-left: 4px solid var(--primary);
}

/* Command blocks */
.command-block {
  position: relative;
  margin: 1rem 0;
}

.command-block pre {
  margin: 0;
  padding: 1rem 1rem 1rem 1rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  overflow-x: auto;
  position: relative;
}

.command-block code {
  background: none;
  padding: 0;
  color: var(--text);
  display: block;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.copy-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px var(--shadow);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  background: var(--success);
}

/* Notes */
.note {
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0.25rem;
}

/* Details/summary for verification steps */
details {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 0.375rem;
  border: 1px solid var(--border);
}

details.verify {
  background: var(--bg);
  border: 1px dashed var(--border);
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s;
}

details[open] summary::before {
  transform: rotate(90deg);
}

summary:hover {
  color: var(--primary-dark);
}

details > *:not(summary) {
  margin-top: 1rem;
}

/* Next steps section */
.next-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.next-step-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.next-step-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
  border-color: var(--primary-light);
}

.next-step-card h3 {
  margin-top: 0;
  color: var(--primary);
  font-size: 1.25rem;
}

.next-step-card ul {
  margin-bottom: 0;
}

.tips {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
  color: white;
  padding: 2rem;
  border-radius: 0.5rem;
  margin: 2rem 0;
}

.tips h3 {
  margin-top: 0;
  color: white;
}

.tips code {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* Footer */
footer {
  max-width: 65ch;
  margin: 4rem auto 2rem auto;
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}

footer p {
  margin: 0.25rem 0;
}

/* Print styles */
@media print {
  @page {
    margin: 2cm;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }

  header {
    background: none;
    color: black;
    border-bottom: 2px solid black;
    padding: 1rem 0;
    box-shadow: none;
  }

  .table-of-contents {
    background: none;
    border: 1px solid #ccc;
    page-break-after: always;
  }

  .copy-btn {
    display: none;
  }

  .step,
  .next-step-card,
  .tips {
    background: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  details {
    border: 1px solid #ccc;
  }

  summary::before {
    content: "";
  }

  a {
    color: black;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
    color: #666;
  }

  h2, h3 {
    page-break-after: avoid;
  }

  .tips {
    background: #f0f0f0;
    color: black;
  }

  .note {
    background: #f9f9f9;
    border-left: 4px solid #6366F1;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  main {
    padding: 1rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  .step {
    padding: 1rem;
  }

  .next-steps-grid {
    grid-template-columns: 1fr;
  }

  .command-block pre {
    font-size: 0.875rem;
  }

  .copy-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
}
