/* How-To Guide (frontend/howto/*.html). Loaded after ../styles.css.
   Layout: a left sidebar with every guide page (desktop), a "Guide menu"
   button that opens the same list (below 768px), the article beside it.
   The page never scrolls sideways; wide tables scroll inside .guide-table-wrap. */

.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 15.5rem) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.guide-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem 0.8rem;
  font-size: 0.9rem;
}

.guide-sidebar a {
  color: var(--text);
  text-decoration: none;
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  line-height: 1.35;
}

.guide-sidebar a:hover,
.guide-sidebar a:focus-visible {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.guide-sidebar a[aria-current="page"] {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
}

.guide-sidebar .guide-hub-link {
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.guide-group + .guide-group {
  margin-top: 0.35rem;
}

.guide-group-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 0;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
}

.guide-group-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.guide-group-toggle::after {
  content: "▾";
  font-size: 0.85rem;
  transition: transform 0.15s;
}

.guide-group-toggle[aria-expanded="false"]::after {
  transform: rotate(-90deg);
}

.guide-group ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.25rem;
}

.guide-group ul[hidden] {
  display: none;
}

.guide-menu-button {
  display: none;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.guide-menu-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.guide-article {
  min-width: 0;
}

.guide-article .card {
  margin-bottom: 1.25rem;
}

.guide-article h2 {
  scroll-margin-top: 1rem;
}

.guide-article p,
.guide-article li {
  line-height: 1.6;
}

.guide-article ol.guide-steps > li {
  margin-bottom: 0.6rem;
}

.guide-toc ol {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
  columns: 2 14rem;
}

.guide-toc a {
  text-decoration: none;
}

.guide-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.guide-table th,
.guide-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.guide-table th {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.guide-faq dt {
  font-weight: 700;
  margin-top: 0.9rem;
}

.guide-faq dd {
  margin: 0.3rem 0 0;
}

.guide-callout {
  border-left: 4px solid var(--warning);
  background: #fff8e6;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
}

.guide-prevnext {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.guide-prevnext a {
  display: block;
  max-width: 48%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  text-decoration: none;
  color: var(--text);
}

.guide-prevnext a span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.guide-prevnext .guide-next {
  margin-left: auto;
  text-align: right;
}

.guide-hub-group {
  margin-bottom: 1.5rem;
}

.guide-hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.9rem;
}

.guide-hub-card {
  display: block;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.guide-hub-card:hover,
.guide-hub-card:focus-visible {
  border-color: var(--primary);
}

.guide-hub-card strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--primary-dark);
}

.guide-hub-card span {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 767px) {
  .guide-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .guide-menu-button {
    display: block;
  }

  .guide-sidebar {
    display: none;
    position: static;
    max-height: none;
    margin-bottom: 1rem;
  }

  .guide-sidebar.is-open {
    display: block;
  }

  .guide-toc ol {
    columns: 1;
  }

  .guide-prevnext a {
    max-width: 100%;
    width: 100%;
  }

  .guide-prevnext .guide-next {
    text-align: left;
  }
}

/* Screenshots (frontend/howto/img/, captured from stage at 1280px). */
.guide-shot {
  margin: 1rem 0 1.25rem;
}
.guide-shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
}
.guide-shot figcaption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #5b6475;
}
