/* =============================================================
   Claude Code Course — Design System
   modules.css: Module/Article Content Typography & Components
   ============================================================= */

/* ---------------------------------------------------------------
   Module Body — Reading Container
--------------------------------------------------------------- */
.module-body {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  min-width: 0;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* ---------------------------------------------------------------
   Headings
--------------------------------------------------------------- */
.module-body h1,
.module-body h2,
.module-body h3,
.module-body h4,
.module-body h5,
.module-body h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 64px;
}

.module-body h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0;
  letter-spacing: -0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.module-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border);
}

.module-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.module-body h4 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.module-body h5 {
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.module-body h6 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Anchor links on headings */
.module-body .heading-anchor {
  opacity: 0;
  margin-left: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85em;
  text-decoration: none;
  transition: opacity var(--transition);
}

.module-body h2:hover .heading-anchor,
.module-body h3:hover .heading-anchor,
.module-body h4:hover .heading-anchor {
  opacity: 1;
}

/* ---------------------------------------------------------------
   Paragraphs
--------------------------------------------------------------- */
.module-body p {
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  line-height: 1.8;
}

/* ---------------------------------------------------------------
   Inline Code
--------------------------------------------------------------- */
.module-body :not(pre) > code {
  background-color: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.125em 0.375em;
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono", monospace;
  font-size: 0.875em;
  color: var(--accent);
  white-space: nowrap;
}

/* ---------------------------------------------------------------
   Code Blocks
--------------------------------------------------------------- */
.module-body pre {
  background-color: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.7;
  position: relative;
}

.module-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text-primary);
  white-space: pre;
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono", monospace;
}

/* Language label */
.module-body pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 0.6875rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
}

/* ---------------------------------------------------------------
   Code Block Wrapper (with Copy Button)
--------------------------------------------------------------- */
.code-block-wrapper {
  position: relative;
  margin: 1.5rem 0;
}

.code-block-wrapper pre {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-family: "JetBrains Mono", monospace;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity var(--transition),
    background-color var(--transition),
    color var(--transition);
  z-index: 2;
}

.code-block-wrapper:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.copy-btn.copied {
  background-color: rgba(63, 185, 80, 0.15);
  border-color: rgba(63, 185, 80, 0.4);
  color: var(--success);
  opacity: 1;
}

/* ---------------------------------------------------------------
   Blockquote
--------------------------------------------------------------- */
.module-body blockquote {
  border-left: 3px solid var(--accent);
  background-color: var(--bg-secondary);
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.module-body blockquote p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

.module-body blockquote cite {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-style: normal;
  color: var(--text-muted);
}

.module-body blockquote cite::before {
  content: "— ";
}

/* ---------------------------------------------------------------
   Lists
--------------------------------------------------------------- */
.module-body ul,
.module-body ol {
  margin: 1rem 0 1.25rem 0;
  padding-left: 1.75rem;
  color: var(--text-primary);
}

.module-body ul {
  list-style: none;
}

.module-body ul li {
  position: relative;
  margin-bottom: 0.375rem;
  padding-left: 0.25rem;
  line-height: 1.7;
}

.module-body ul li::before {
  content: "›";
  position: absolute;
  left: -1.25rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1em;
  line-height: 1.5;
}

.module-body ol {
  list-style: decimal;
}

.module-body ol li {
  margin-bottom: 0.375rem;
  padding-left: 0.25rem;
  line-height: 1.7;
}

.module-body ol li::marker {
  color: var(--accent);
  font-weight: 600;
}

.module-body li > ul,
.module-body li > ol {
  margin: 0.375rem 0;
}

/* ---------------------------------------------------------------
   Callout Boxes
--------------------------------------------------------------- */
.callout {
  display: flex;
  gap: 0.875rem;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-secondary);
  border-left-width: 3px;
}

.callout-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 0.0625rem;
}

.callout-content {
  flex: 1;
  min-width: 0;
}

.callout-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.callout-body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

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

/* Tip */
.callout-tip {
  border-left-color: var(--success);
  background-color: rgba(63, 185, 80, 0.05);
}

.callout-tip .callout-title {
  color: var(--success);
}

/* Warning */
.callout-warning {
  border-left-color: var(--warning);
  background-color: rgba(210, 153, 34, 0.05);
}

.callout-warning .callout-title {
  color: var(--warning);
}

/* Info */
.callout-info {
  border-left-color: var(--info);
  background-color: rgba(88, 166, 255, 0.05);
}

.callout-info .callout-title {
  color: var(--info);
}

/* Danger */
.callout-danger {
  border-left-color: var(--accent);
  background-color: rgba(247, 129, 102, 0.05);
}

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

/* ---------------------------------------------------------------
   Exercise Section
--------------------------------------------------------------- */
.exercise-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--info);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}

.exercise-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--info);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


.exercise-task {
  margin: 0.75rem 0;
  padding-left: 1.25rem;
  position: relative;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.exercise-task::before {
  content: "□";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.exercise-task.done::before {
  content: "✓";
  color: var(--success);
}

/* ---------------------------------------------------------------
   Bottom Navigation (Prev / Next)
--------------------------------------------------------------- */
.module-nav-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.module-nav-bottom .nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 48%;
  text-decoration: none;
}

.module-nav-bottom .nav-item-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.module-nav-bottom .nav-item-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: color var(--transition);
}

.module-nav-bottom .nav-item:hover .nav-item-title {
  color: var(--accent);
  text-decoration: none;
}

.module-nav-bottom .nav-prev {
  align-items: flex-start;
}

.module-nav-bottom .nav-next {
  align-items: flex-end;
}

.module-nav-bottom .nav-prev .nav-item-title::before {
  content: "← ";
}

.module-nav-bottom .nav-next .nav-item-title::after {
  content: " →";
}

/* ---------------------------------------------------------------
   Tables
--------------------------------------------------------------- */
.module-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 1.5rem 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.module-body table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.module-body table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
  line-height: 1.6;
}

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

.module-body table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

html.light .module-body table tr:hover td {
  background-color: rgba(0, 0, 0, 0.02);
}

/* ---------------------------------------------------------------
   External Link Indicator
--------------------------------------------------------------- */
.module-body a[href^="http"]::after,
.module-body a[href^="https"]::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.6;
  vertical-align: super;
}

/* ---------------------------------------------------------------
   Images in Module Body
--------------------------------------------------------------- */
.module-body img {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 1.5rem auto;
}

.module-body figure {
  margin: 1.5rem 0;
}

.module-body figcaption {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ---------------------------------------------------------------
   Resources Section
--------------------------------------------------------------- */
.resources-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.resources-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.resource-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition:
    border-color var(--transition),
    transform var(--transition-med),
    box-shadow var(--transition-med);
}

.resource-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}

.resource-card-type {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.resource-card-video .resource-card-type  { color: var(--accent); }
.resource-card-docs .resource-card-type   { color: var(--info); }
.resource-card-github .resource-card-type { color: var(--success); }

.resource-card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.resource-card-description {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------------------------------------------------------------
   Keyboard Shortcut
--------------------------------------------------------------- */
.module-body kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125em;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  white-space: nowrap;
}

/* ---------------------------------------------------------------
   Strong / Em
--------------------------------------------------------------- */
.module-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.module-body em {
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------
   Horizontal Rule
--------------------------------------------------------------- */
.module-body hr {
  margin: 2.5rem 0;
  border-top-color: var(--border);
}

/* ---------------------------------------------------------------
   Responsive Adjustments
--------------------------------------------------------------- */
@media (max-width: 767px) {
  .module-body h1 { font-size: 1.625rem; }
  .module-body h2 { font-size: 1.25rem; }
  .module-body h3 { font-size: 1.0625rem; }

  .module-body pre {
    padding: 1rem;
    font-size: 0.8125rem;
  }

  .module-nav-bottom {
    flex-direction: column;
  }

  .module-nav-bottom .nav-item {
    max-width: 100%;
    width: 100%;
  }

  .module-nav-bottom .nav-next {
    align-items: flex-start;
  }

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

  .module-body table {
    font-size: 0.875rem;
  }

  .module-body table th,
  .module-body table td {
    padding: 0.5rem 0.75rem;
  }
}
