/* "Build my setup guide" (guide-builder.js, hooks/guide.py). Colors come from the theme's variables, so the form and
   the guide follow the light and dark color schemes. */

/* ----- the form ----- */
.sg-form fieldset {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.2rem;
  margin: 0 0 0.8rem;
  padding: 0.4rem 0.8rem 0.7rem;
  min-width: 0;
}
.sg-form legend { font-weight: 700; padding: 0 0.3rem; }
.sg-options { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.sg-option { position: relative; display: inline-flex; }
/* the native control stays focusable and readable by screen readers; the label is the visible chip */
.sg-option input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.sg-option span {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 1rem;
  color: var(--md-default-fg-color);
  background: var(--md-default-bg-color);
  line-height: 1.4;
  user-select: none;
}
.sg-option input:hover + span { border-color: var(--md-accent-fg-color); }
.sg-option input:checked + span {
  background: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
  color: var(--md-accent-bg-color, #fff);
}
.sg-option input[type="checkbox"]:checked + span::before { content: "✓ "; }
.sg-option input:focus-visible + span { outline: 2px solid var(--md-accent-fg-color); outline-offset: 2px; }
.md-typeset details.sg-more { margin-top: 0.6rem; font-size: inherit; }
.sg-more > summary { cursor: pointer; color: var(--md-default-fg-color--light); }
.md-typeset .sg-error { color: var(--md-code-hl-special-color, #c62828); font-weight: 700; }
.md-typeset .sg-form .md-button { margin-top: 0; }
.sg-change { margin-bottom: 1rem; }
.sg-change > summary { cursor: pointer; font-weight: 700; margin-bottom: 0.6rem; }

/* ----- the guide ----- */
.sg-loading { color: var(--md-default-fg-color--light); }
.sg-head {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-left: 4px solid var(--md-accent-fg-color);
  border-radius: 0.2rem;
  padding: 0.4rem 1rem 0.2rem;
  margin: 1rem 0;
}
.md-typeset .sg-guide-title { font-size: 1.4em; font-weight: 700; margin: 0.4rem 0; }
.md-typeset .sg-summary { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; margin: 0.4rem 0; }
.md-typeset .sg-summary dt { font-weight: 700; margin: 0; }
.md-typeset .sg-summary dd { margin: 0; }
.md-typeset .sg-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.md-typeset .sg-tools .md-button { margin: 0; }
.md-typeset .sg-step > h2 {
  border-top: 2px solid var(--md-default-fg-color--lightest);
  padding-top: 0.8rem;
}
.md-typeset .sg-group { color: var(--md-default-fg-color--light); }
.md-typeset .sg-from {
  font-size: 0.75rem;
  color: var(--md-default-fg-color--light);
  margin-top: -0.4rem;
}
.md-typeset .sg-again { font-style: italic; }
.md-typeset .sg-hint { font-size: 0.75rem; color: var(--md-default-fg-color--light); margin: 0.4rem 0; }
/* folded sections: heading, "From" link and Show here; the text opens in place */
.md-typeset .sg-toggle {
  font: inherit;
  font-size: 0.75rem;
  color: var(--md-accent-fg-color);
  background: none;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.8rem;
  padding: 0 0.6rem;
  margin-left: 0.4rem;
  cursor: pointer;
  white-space: nowrap;
}
.md-typeset .sg-toggle:hover { border-color: var(--md-accent-fg-color); }
.md-typeset .sg-toggle:focus-visible { outline: 2px solid var(--md-accent-fg-color); outline-offset: 2px; }
/* folded, a section is one row of a checklist: its heading, then its page and Show here (wrapping on a phone) */
.md-typeset .sg-section:has(> .sg-body[hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.6rem;
  margin: 0 0 0.35rem;
}
.md-typeset .sg-section:has(> .sg-body[hidden]) > :is(h3, h4, h5, h6) {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  color: var(--md-default-fg-color);
  margin: 0;
}
.md-typeset .sg-section:has(> .sg-body[hidden]) > .sg-from { margin: 0; }
/* a section without a heading of its own (it has the step's title): no gap before its page link */
.md-typeset .sg-section > span:first-child:empty { margin-right: -0.6rem; }
/* notes for older versions ("Before 7.0") start folded */
.md-typeset details.sg-older { font-size: 0.7rem; }
.md-typeset .sg-group { margin: 1rem 0 0.4rem; font-size: 0.9rem; }
.md-typeset .sg-step > h2 { margin-bottom: 0.6rem; }
.md-typeset .sg-text { margin-bottom: 0.4rem; }
.md-typeset .sg-text > p { margin: 0.4rem 0; }
/* a database's links on one line, separated by dots */
.md-typeset ul.sg-inline { list-style: none; margin: 0 0 0.4rem; padding: 0; }
.md-typeset ul.sg-inline > li { display: inline; margin: 0; }
.md-typeset ul.sg-inline > li + li::before { content: " · "; color: var(--md-default-fg-color--light); }
/* sections are nested one or two levels deeper than on their page: keep h5/h6 readable headings, not small capitals */
.md-typeset .sg-section h5,
.md-typeset .sg-section h6 {
  text-transform: none;
  letter-spacing: normal;
  color: var(--md-default-fg-color);
  font-size: 0.8rem;
  font-weight: 700;
}
.md-typeset .sg-section { margin-bottom: 1.2rem; }

/* phone width: nothing wider than the screen */
@media screen and (max-width: 44.9375em) {
  .md-typeset .sg-summary { grid-template-columns: 1fr; }
  .md-typeset .sg-summary dd { margin-bottom: 0.3rem; }
  .sg-form fieldset { padding: 0.3rem 0.5rem 0.6rem; }
}

/* ----- printing the guide: only the guide ----- */
@media print {
  .sg-has-guide .md-header,
  .sg-has-guide .md-tabs,
  .sg-has-guide .md-sidebar,
  .sg-has-guide .md-footer,
  .sg-has-guide .md-top,
  .sg-has-guide .md-content__button,
  .sg-has-guide .md-content__inner > :not(#sg-guide),
  .sg-tools,
  .sg-hint,
  .sg-toggle,
  .sg-form { display: none !important; }
  .sg-has-guide .md-main__inner { margin: 0; }
  .sg-has-guide .md-content { max-width: none; }
  .sg-head { border-left-width: 1px; }
  .md-typeset .sg-step { break-before: page; }
  .md-typeset .sg-step h2, .md-typeset .sg-step h3, .md-typeset .sg-step h4 { break-after: avoid; }
  .md-typeset .sg-from a::after,
  .md-typeset .sg-links a::after { content: " (" attr(href) ")"; word-break: break-all; }
  .md-typeset .sg-section img { max-width: 100%; break-inside: avoid; }
}
