/* Heading size overrides — each level is at least 30% larger than the next */

/* Mobile sizes (1.3x ratio between each level) */
h1 { font-size: 2.6rem !important; }
h2 { font-size: 2rem !important; }
h3 { font-size: 1.5rem !important; }
h4 { font-size: 1.15rem !important; }
h5 { font-size: 0.9rem !important; }
h6 { font-size: 0.7rem !important; }

/* Desktop sizes (1.3x ratio between each level) */
@media (min-width: 768px) {
  h1 { font-size: 3.4rem !important; }
  h2 { font-size: 2.6rem !important; }
  h3 { font-size: 2rem !important; }
  h4 { font-size: 1.5rem !important; }
  h5 { font-size: 1.15rem !important; }
  h6 { font-size: 0.9rem !important; }
}

/* Sidebar menu text hierarchy — section > subsection > link, 30% between each */
.toc__section-title {
  font-size: 1.35rem !important;
}
.toc__subsection-title {
  font-size: 1.05rem !important;
}
.toc__link {
  font-size: 0.8rem !important;
}

/* Indent subsection links to match first-level visual indent */
.toc__subsection > .toc__list {
  padding-left: 1.25rem;
}

/* Difficulty level indicators (signal-strength bars) */
.difficulty {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  vertical-align: middle;
  margin-left: 0.4em;
  white-space: nowrap;
}

.difficulty-bars {
  height: 0.55em;
  width: auto;
}

.difficulty-label {
  font-size: 0.38em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Color by difficulty level — dark mode (catppuccin-mocha) */
.difficulty--1 { color: #a6e3a1; } /* green - beginner */
.difficulty--2 { color: #94e2d5; } /* teal - easy */
.difficulty--3 { color: #f9e2af; } /* yellow - intermediate */
.difficulty--4 { color: #fab387; } /* peach - advanced */
.difficulty--5 { color: #f38ba8; } /* red - expert */

/* Light mode — catppuccin-latte (saturated, readable on white) */
[data-theme="light"] .difficulty--1 { color: #40a02b; }
[data-theme="light"] .difficulty--2 { color: #179299; }
[data-theme="light"] .difficulty--3 { color: #df8e1d; }
[data-theme="light"] .difficulty--4 { color: #fe640b; }
[data-theme="light"] .difficulty--5 { color: #d20f39; }

/* Bars in section page listings */
.page-list .difficulty-bars {
  height: 0.9em;
}

.page-list .difficulty-label {
  font-size: 0.8em;
}

/* Tutorial links in sidebar — slightly brighter to stand out from topic headings */
.toc__link {
  color: #b4befe !important; /* catppuccin lavender */
}
[data-theme="light"] .toc__link {
  color: #5c6cdb !important;
}
.toc__link.active {
  color: var(--color-accent) !important;
}

/* Sidebar home link */
.toc__home {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted, #a6adc8);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.toc__home:hover {
  color: var(--color-text);
  background-color: var(--color-bg-elevated);
}

/* Compact sidebar footer */
.sidebar__footer {
  padding: 0.5rem 1.25rem;
  gap: 0.5rem;
}

/* Parts table — affiliate component list */
.parts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0 0.5rem;
  font-size: 0.95rem;
}

.parts-table th,
.parts-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border, #313244);
}

.parts-table th {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted, #a6adc8);
}

.parts-table tbody tr:hover {
  background: rgba(127, 127, 127, 0.06);
}

.parts-buy a {
  display: inline-block;
  padding: 0.15em 0.5em;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.75em;
  background: var(--color-accent, #89b4fa);
  color: var(--color-bg, #1e1e2e) !important;
  text-decoration: none;
  white-space: nowrap;
}

.parts-buy a:hover {
  opacity: 0.85;
}

.parts-sep {
  margin: 0 0.15em;
  color: var(--color-text-muted, #a6adc8);
}

.parts-disclosure {
  font-size: 0.78rem;
  color: var(--color-text-muted, #a6adc8);
  margin: 0.25rem 0 1.5rem;
}

/* Responsive: stack buy links on small screens */
@media (max-width: 600px) {
  .parts-table th:nth-child(4),
  .parts-table td:nth-child(4) {
    display: none;
  }
}

/* ===== Landing page ===== */

/* Let the landing page use the full content width instead of the theme's 900px cap */
.main-content:has(.landing) {
  max-width: none;
}

.landing {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.landing__hero {
  text-align: center;
  padding: 3rem 0 1.5rem;
}

.landing__logo {
  display: block;
  margin: 0 auto 1rem;
}

.landing__title {
  font-size: 2.8rem !important;
  margin: 0 0 0.5rem;
}

.landing__tagline {
  font-size: 1.2rem;
  color: var(--color-text-muted, #a6adc8);
  margin: 0;
}

.landing__about {
  text-align: center;
  max-width: 38rem;
  margin: 1.5rem auto 2.5rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-muted, #a6adc8);
}

.landing__about p {
  margin: 0.5rem 0;
}

.landing__sections {
  margin: 2rem 0;
}

.landing__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 600px) {
  .landing__grid {
    grid-template-columns: 1fr;
  }
  .landing__title {
    font-size: 2.2rem !important;
  }
}

.landing__card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--color-border, #313244);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.landing__card:hover {
  border-color: var(--color-accent, #89b4fa);
  background: rgba(137, 180, 250, 0.05);
}

.landing__card-icon {
  color: var(--color-accent, #89b4fa);
  margin-bottom: 0.75rem;
}

.landing__card-title {
  font-size: 1.25rem !important;
  margin: 0 0 0.4rem;
}

.landing__card-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted, #a6adc8);
  margin: 0;
  line-height: 1.5;
}

.landing__stats {
  text-align: center;
  margin-top: 2.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted, #a6adc8);
}

.landing__stat-sep {
  margin: 0 0.5em;
  opacity: 0.5;
}

/* ===== Code spoiler — collapsible code blocks ===== */
details.code-spoiler {
  margin: 1rem 0;
  border: 1px solid var(--color-border, #313244);
  border-radius: 6px;
  overflow: hidden;
}

details.code-spoiler summary {
  cursor: pointer;
  padding: 0.6rem 1rem;
  font-weight: 500;
  font-size: 0.9rem;
  background: rgba(127, 127, 127, 0.06);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

details.code-spoiler summary::before {
  content: "\25b6";
  font-size: 0.65em;
  transition: transform 0.15s ease;
}

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

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

details.code-spoiler summary:hover {
  background: rgba(127, 127, 127, 0.12);
}

details.code-spoiler pre {
  margin: 0 !important;
  border-radius: 0 !important;
}

details.code-spoiler > div > pre {
  margin: 0 !important;
  border-radius: 0 !important;
}
