/* ===== Theme Variables ===== */
:root {
  --bg: #f8f5f0;
  --surface: #ffffff;
  --border: #e0d8cc;
  --text: #1a1208;
  --text-secondary: #4a3f30;
  --text-muted: #8a7d6b;
  --accent: #b45309;
  --accent-hover: #92400e;
  --ai-bg: #f5f0ff;
  --ai-border: #ddd0f5;
  --ai-text: #7c3aed;
  --ai-text-muted: #a78bfa;
  --tip-border: #d4a054;
  --tip-bg: #faf7f2;
  --important-border: #dc2626;
  --important-bg: #fef2f2;
  --code-bg: #f3f0eb;
  --code-border: #e0d8cc;
  --nav-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="dark"] {
  --bg: #181818;
  --surface: #212121;
  --border: #2e2e2e;
  --text: #eaeaea;
  --text-secondary: #b0b0b0;
  --text-muted: #909090;
  --accent: #d97706;
  --accent-hover: #b45309;
  --ai-bg: #1c1626;
  --ai-border: #35284a;
  --ai-text: #b490e0;
  --ai-text-muted: #7c60a0;
  --tip-border: #b47a0a;
  --tip-bg: #1e1a10;
  --important-border: #991b1b;
  --important-bg: #1a1010;
  --code-bg: #1e1e1e;
  --code-border: #2e2e2e;
  --nav-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.2s, color 0.2s;
}

/* ===== Header ===== */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.site-header a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

.site-header a:hover { color: var(--accent); }

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Guide Hero ===== */
.guide-hero {
  max-width: 780px;
  margin: 2rem auto 1.5rem;
  padding: 0 2rem;
}

.guide-hero h1 {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.guide-hero .description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.guide-hero .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

.guide-hero .meta span + span::before {
  content: "\00b7";
  margin-right: 1rem;
}

/* ===== Sticky Step Nav ===== */
.step-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--nav-shadow);
  padding: 0.5rem 2rem;
  transition: background 0.2s;
}

.step-nav-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.step-nav-inner::-webkit-scrollbar { display: none; }

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.75rem;
  padding: 0 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.step-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.step-pill.active {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}

/* ===== Content Area ===== */
.content {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem;
}

.guide-intro {
  margin-bottom: 2.5rem;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ===== Step Sections ===== */
.step-section {
  margin-bottom: 3rem;
  padding-top: 1rem;
}

.step-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.step-section h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.step-section p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.step-section ul,
.step-section ol {
  padding-left: 1.75rem;
  margin-bottom: 1rem;
}

.step-section li {
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

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

.step-section a:hover { text-decoration: underline; }

.step-section img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 1rem 0;
}

/* ===== Code Blocks ===== */
.step-section code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

.step-section pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.step-section pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ===== Toolkit Legend ===== */
.toolkit {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  max-width: 780px;
  margin: 1.5rem auto 0;
  background: var(--surface);
}

.toolkit-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.toolkit-header span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.toolkit-link {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
}

.toolkit-link:hover {
  color: var(--accent);
}

.toolkit-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 1rem;
  font-size: 0.85rem;
  align-items: baseline;
}

.toolkit-grid dt {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.toolkit-grid dd {
  color: var(--text-muted);
}

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

.toolkit-grid a:hover { text-decoration: underline; }

/* ===== Toolkit Reference (end of guide) ===== */
.toolkit-reference {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.toolkit-reference h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.toolkit-reference > p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.toolkit-reference h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
}

.toolkit-reference h3 + p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.toolkit-reference .toolkit-grid {
  margin-bottom: 0.5rem;
}

/* ===== Callout Boxes ===== */
.callout {
  border-left: 3px solid var(--tip-border);
  background: var(--tip-bg);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background 0.2s, border-color 0.2s;
}

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

.callout-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.callout.important {
  border-left-color: var(--important-border);
  background: var(--important-bg);
}

/* ===== AI Panel (Collapsible) ===== */
.ai-panel {
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  margin-top: 1rem;
  margin-bottom: 1rem;
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s;
}

.ai-panel-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.7rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ai-text);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-panel-toggle .expand-hint {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--ai-text-muted);
  text-transform: none;
  letter-spacing: normal;
}

.ai-panel-toggle .arrow {
  transition: transform 0.2s;
  display: inline-block;
  margin-right: 0.4rem;
}

.ai-panel.open .ai-panel-toggle .arrow {
  transform: rotate(90deg);
}

.ai-panel-content {
  display: none;
  padding: 0 1rem 1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.ai-panel.open .ai-panel-content { display: block; }

.ai-panel-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ai-text);
  margin-bottom: 0.75rem;
}

.ai-panel-content p { margin-bottom: 0.75rem; }
.ai-panel-content ul { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.ai-panel-content li { margin-bottom: 0.3rem; }
.ai-panel-content code {
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

/* ===== Index Page ===== */
.index-hero {
  max-width: 780px;
  margin: 3rem auto 2rem;
  padding: 0 2rem;
}

.index-hero h1 {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.index-hero p {
  color: var(--text-muted);
  font-size: 1rem;
}

.guide-list {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}

.guide-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

.guide-card .card-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.guide-card .card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
}

.guide-card .card-meta span + span::before {
  content: "\00b7";
  margin-right: 1rem;
}

/* ===== Footer ===== */
.site-footer {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  html { font-size: 15px; }

  .site-header { padding: 0.75rem 1.25rem; }

  .guide-hero {
    padding: 0 1.25rem;
    margin: 1.5rem auto 1rem;
  }

  .guide-hero h1 { font-size: 1.5rem; }

  .step-nav { padding: 0.4rem 1.25rem; }

  .content { padding: 1.5rem 1.25rem; }

  .step-section h2 { font-size: 1.2rem; }

  .index-hero { padding: 0 1.25rem; margin: 2rem auto 1.5rem; }
  .guide-list { padding: 0 1.25rem 2rem; }
}
