/* ===== GUIDE PAGE LAYOUT ===== */
html {
  scroll-behavior: smooth;
}

.guide-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* ===== GUIDE HEADER (TOP BAR) ===== */
.guide-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: var(--space-3) var(--space-6);
  background: color-mix(in srgb, var(--color-bg) 85%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-divider);
}

.guide-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
}

.guide-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.guide-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.guide-header-title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ===== GUIDE HERO ===== */
.guide-hero-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.guide-hero-sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-10);
}

/* ===== GUIDE INTRO CONTENT ===== */
.guide-intro h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.guide-intro p {
  margin-bottom: var(--space-3);
}

.guide-intro ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.guide-intro ul li {
  padding-left: var(--space-4);
  position: relative;
}

.guide-intro ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
}

.guide-intro h3 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.guide-intro ol {
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ===== GUIDE CALLOUT ===== */
.guide-callout {
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-top: var(--space-6);
  margin-bottom: var(--space-8);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
}

[data-theme="dark"] .guide-callout {
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface-alt));
}

/* ===== MOBILE MENU BUTTON ===== */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition-interactive);
}

.mobile-menu-btn:hover {
  background: var(--color-surface);
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

/* ===== GUIDE SIDEBAR ===== */
.guide-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 150;
  padding-top: calc(65px + var(--space-6));
  padding-bottom: var(--space-8);
  padding-inline: var(--space-6);
  background: var(--color-surface);
  border-right: 1px solid var(--color-divider);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Thin custom scrollbar for sidebar */
.guide-sidebar::-webkit-scrollbar {
  width: 4px;
}

.guide-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.guide-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

/* ===== GUIDE NAVIGATION ===== */
.guide-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* Nav groups */
.guide-nav-group {
  margin-bottom: var(--space-1);
}

.guide-nav-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-3) var(--space-1);
  margin-top: var(--space-2);
}

.guide-nav-count {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--color-text-faint);
  padding: 0 var(--space-3);
  margin-top: -2px;
}

/* Nav items (links) */
.guide-nav-item,
.guide-nav-section {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--transition-interactive),
              background var(--transition-interactive);
  line-height: 1.5;
}

.guide-nav-item:hover,
.guide-nav-section:hover {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-text) 5%, transparent);
}

.guide-nav-item.active,
.guide-nav-section.active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  font-weight: 600;
}

/* ===== GUIDE MAIN CONTENT ===== */
.guide-main {
  grid-column: 2;
  padding-top: calc(65px + var(--space-10));
  padding-bottom: var(--space-20);
  padding-inline: var(--space-8);
  max-width: calc(800px + var(--space-8) * 2);
  margin-inline: auto;
  width: 100%;
}

/* ===== GUIDE INTRO ===== */
.guide-intro {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-10);
  max-width: 680px;
}

/* ===== GUIDE SECTIONS ===== */
.guide-section {
  margin-bottom: var(--space-32);
  scroll-margin-top: calc(65px + var(--space-8));
}

.guide-section:last-child {
  margin-bottom: 0;
}

.guide-section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: var(--text-xl);
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

/* ===== SECTION DESCRIPTION ===== */
.guide-section-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  margin-right: var(--space-2);
  vertical-align: middle;
}

/* ===== PROMPT CARDS ===== */
.prompt-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-10);
  transition: box-shadow var(--transition-interactive);
}

.prompt-card:hover {
  box-shadow: var(--shadow-md);
}

.prompt-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.prompt-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  color: var(--color-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.prompt-card-header h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.3;
}

.prompt-when {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  line-height: 1.5;
}

.prompt-card-header .section-label {
  margin-bottom: 0;
}

/* ===== TIP DETAILS (collapsible tips) ===== */
.tip-details {
  border-top: 1px solid var(--color-divider);
}

.tip-details summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background var(--transition-interactive);
}

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

.tip-details summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--color-text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out);
}

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

.tip-details summary:hover {
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}

.tip-details .tip-list {
  padding: 0 var(--space-5) var(--space-4);
  margin-top: 0;
}

/* ===== PROMPT CODE BLOCK ===== */
.prompt-block {
  position: relative;
  padding: var(--space-5);
  background: var(--color-bg);
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

[data-theme="dark"] .prompt-block {
  background: var(--color-surface-alt);
}

/* ===== COPY BUTTON ===== */
.copy-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-interactive),
              color var(--transition-interactive),
              background var(--transition-interactive);
}

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

.prompt-block:hover .copy-btn,
.prompt-card:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
  border-color: var(--color-text-faint);
}

.copy-btn.copied {
  opacity: 1;
  color: var(--color-success);
  border-color: var(--color-success);
}

/* ===== COPY TOAST NOTIFICATION ===== */
.copy-toast {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--color-secondary);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.copy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== EXAMPLE OUTPUT (DETAILS/SUMMARY) ===== */
.example-output {
  margin-top: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--color-secondary) 20%, transparent);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: color-mix(in srgb, var(--color-secondary) 4%, var(--color-bg));
}

.example-output summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-secondary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background var(--transition-interactive);
}

.example-output summary::-webkit-details-marker {
  display: none;
}

.example-output summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 6px solid var(--color-secondary);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out);
}

.example-output[open] summary::before {
  transform: rotate(90deg);
}

.example-output summary:hover {
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
}

.example-content {
  padding: var(--space-5);
  padding-top: 0;
  border-top: 1px solid color-mix(in srgb, var(--color-secondary) 15%, transparent);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.7;
}

.example-content p {
  margin-bottom: var(--space-3);
}

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

.example-content pre,
.example-content code {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: var(--text-xs);
}

.example-content pre {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  white-space: pre-wrap;
  margin-bottom: var(--space-4);
  line-height: 1.65;
}

[data-theme="dark"] .example-content pre {
  background: var(--color-surface-alt);
}

/* ===== TIP LIST ===== */
.tip-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  margin-bottom: var(--space-6);
}

.tip-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.6;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
}

[data-theme="dark"] .tip-list li {
  background: var(--color-surface-alt);
}

.tip-list li::before {
  content: '\2192';
  flex-shrink: 0;
  color: var(--color-primary);
  font-weight: 700;
}

/* ===== SIDEBAR OVERLAY (FOR MOBILE) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.sidebar-overlay.visible {
  opacity: 1;
}

/* ===== SIDEBAR TOGGLE (HEADER) ===== */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-interactive), background var(--transition-interactive), border-color var(--transition-interactive);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-text) 5%, transparent);
  border-color: var(--color-text-muted);
}

.sidebar-toggle-btn svg {
  flex-shrink: 0;
}

/* Collapsed state */
.guide-layout.sidebar-collapsed {
  grid-template-columns: 1fr;
}

.guide-layout.sidebar-collapsed .guide-sidebar {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
  opacity: 0;
  pointer-events: none;
  transition: width 0.3s var(--ease-out), padding 0.3s var(--ease-out), opacity 0.2s ease;
}

.guide-layout:not(.sidebar-collapsed) .guide-sidebar {
  transition: width 0.3s var(--ease-out), padding 0.3s var(--ease-out), opacity 0.2s ease 0.1s;
}

.guide-layout.sidebar-collapsed .guide-main {
  grid-column: 1;
  max-width: calc(800px + var(--space-8) * 2);
}


/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 1024px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }

  .guide-main {
    grid-column: 1;
    padding-inline: var(--space-6);
  }

  /* Sidebar becomes slide-out drawer */
  .guide-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease-out);
    z-index: 160;
    background: var(--color-bg);
  }

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

  .sidebar-overlay {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .sidebar-toggle-btn {
    display: none !important;
  }

  /* Reset collapsed state on mobile */
  .guide-layout.sidebar-collapsed .guide-sidebar {
    width: 280px;
    padding-inline: var(--space-6);
    opacity: 1;
    pointer-events: auto;
  }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media (max-width: 640px) {
  .guide-main {
    padding-inline: var(--space-4);
    padding-top: calc(65px + var(--space-6));
  }

  .guide-section {
    margin-bottom: var(--space-20);
  }

  .guide-section-title {
    font-size: var(--text-lg);
  }

  .prompt-card-header {
    padding: var(--space-3) var(--space-4);
  }

  .prompt-block {
    padding: var(--space-4);
    font-size: var(--text-xs);
  }

  .copy-btn {
    opacity: 1;
  }

  .example-output summary {
    padding: var(--space-3) var(--space-4);
  }

  .example-content {
    padding: var(--space-4);
    padding-top: 0;
  }

  .guide-header {
    padding: var(--space-3) var(--space-4);
  }
}

/* ===== RESPONSIVE: SMALL MOBILE ===== */
@media (max-width: 375px) {
  .guide-main {
    padding-inline: var(--space-3);
  }

  .prompt-block {
    padding: var(--space-3);
  }

  .prompt-card-header h3 {
    font-size: var(--text-base);
  }
}
