/* Per-guide page width presets (override .page-wrap{max-width:1200px} via higher specificity). */
.page-wrap.guide-width--normal { max-width: 1200px; }
.page-wrap.guide-width--wide   { max-width: min(1320px, 100%); }
.page-wrap.guide-width--full   { max-width: min(1600px, 100%); }
.guide-content-wrap { max-width: 100%; }
.guide-width--normal .guide-content-wrap { max-width: 80ch; }

.guide-category { margin-bottom: 2rem; }
.guide-category__title { margin-bottom: .75rem; }
.guide-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.guide-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; background: var(--surface-2); box-shadow: none; transition: border-color .15s, box-shadow .15s, background .15s, transform .15s; }
.guide-card:hover { border-color: var(--accent); background: var(--surface-3); transform: translateY(-2px); box-shadow: var(--shadow); }
.guide-card__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-3); }
.guide-card__body { padding: .75rem 1rem; }
.guide-card__title { margin: 0 0 .25rem; font-size: 1.05rem; }
.guide-card__excerpt { margin: 0; font-size: .85rem; opacity: .75; }
.guide-category-tag { text-transform: uppercase; letter-spacing: .05em; font-size: .75rem; opacity: .7; }

/* Guide bodies reuse the news prose system (.article-body in styles.css: headings, links, tables,
   hr, code, blockquote). Undo its reading measure — the guide's own width preset owns that. */
.guide-content.article-body { max-width: none; }
.guide-content :is(img) { max-width: 100%; height: auto; border-radius: 8px; }
.guide-content details { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; margin: 1rem 0; }
.guide-content summary { cursor: pointer; font-weight: 600; }
.guide-content tbody tr:nth-child(even) { background: var(--surface-2); }
/* In-page anchors (#section) must clear the sticky site header. */
.guide-content [id] { scroll-margin-top: 96px; }

/* Author-facing content classes. The sanitizer keeps `class`, so guides use these instead of
   inline colours (which cannot follow the theme). */
.guide-lang-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
.guide-content .guide-lang-nav a {
  padding: .35rem .95rem; border: 1px solid var(--line-strong); border-radius: 999px;
  text-decoration: none; font-weight: 600; color: var(--ink-muted);
}
.guide-content .guide-lang-nav a:hover { color: var(--ink); border-color: var(--accent-hover); }
.guide-content .guide-lang-nav a.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* guide-lang.js shows one .guide-lang wrapper at a time; without JS both languages render. */
.guide-content .guide-lang[hidden] { display: none; }
.guide-toc { margin: 0 0 2em; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.guide-toc__label { margin-bottom: .5rem; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.guide-content .guide-toc ul, .guide-content .guide-toc ol { margin: 0; }
.guide-muted { color: var(--ink-muted); }
.guide-hl { color: var(--accent-text); }
.guide-pill { display: inline-block; padding: .05em .6em; border-radius: 999px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.guide-note { margin: 1em 0 1.6em; padding: .75rem 1rem; border-left: 3px solid var(--accent-hover); border-radius: var(--radius-sm); background: var(--accent-soft); }
.guides-empty { opacity: .7; }

/* Manage */
.guides-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
.guides-table th, .guides-table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); }
.guides-dialog { width: min(820px, 92vw); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; transition: width .15s ease; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.guides-dialog::backdrop { background: color-mix(in srgb, var(--ink) 45%, transparent); }
.guides-dialog input[type=text], .guides-dialog input[type=number], .guides-dialog textarea, .guides-dialog select {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .4rem .5rem;
}
.guides-dialog input::placeholder, .guides-dialog textarea::placeholder { color: var(--ink-muted-2); }
.guides-dialog input:focus-visible, .guides-dialog textarea:focus-visible, .guides-dialog select:focus-visible {
  outline: none; box-shadow: var(--focus-ring);
}
/* Dialog grows toward the viewport to match the chosen page-width preset, so the live preview is true-to-size. */
.guides-dialog.gm-width--wide { width: min(1320px, 95vw); }
.guides-dialog.gm-width--full { width: min(1600px, 95vw); }
.guides-dialog label { display: block; margin: .6rem 0; }
.guides-dialog input[type=text], .guides-dialog textarea, .guides-dialog select { width: 100%; }
.guides-preview { border: 1px dashed var(--line-strong); padding: 1rem; border-radius: 8px; min-height: 80px; }
/* Mirror the real page's reading measure: 'normal' caps the preview content the same way .guide-width--normal does. */
.guides-dialog.gm-width--normal .guides-preview { max-width: 80ch; margin-inline: auto; }
.gm-dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.gm-upload-row { display: flex; gap: .5rem; align-items: center; margin: .6rem 0; }
.gm-upload-result-row { display: flex; gap: .5rem; align-items: center; margin: .4rem 0 .6rem; }
.gm-upload-result-row #gm-upload-url { flex: 1; font-family: ui-monospace, monospace; font-size: .8rem; }
.gm-upload-copy, #gm-upload-copy { white-space: nowrap; }
.gm-error { color: var(--danger-text); }
.button.danger { color: var(--danger-text); }

/* Visual/HTML editor toggle */
.gm-body-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.5rem 0 0.25rem;
}
#gm-quill-wrap .ql-editor {
  min-height: 18rem;
}

/* Quill output classes rendered on the public guide page + manage preview (no Quill CSS there). */
.guide-content .ql-align-center { text-align: center; }
.guide-content .ql-align-right { text-align: right; }
.guide-content .ql-align-justify { text-align: justify; }
.guide-content .ql-size-small { font-size: 0.75em; }
.guide-content .ql-size-large { font-size: 1.5em; }
.guide-content .ql-size-huge { font-size: 2.5em; }
.guide-content .ql-indent-1 { padding-left: 3em; }
.guide-content .ql-indent-2 { padding-left: 6em; }
.guide-content .ql-indent-3 { padding-left: 9em; }
.guide-content .ql-indent-4 { padding-left: 12em; }
.guide-content .ql-indent-5 { padding-left: 15em; }
.guide-content .ql-indent-6 { padding-left: 18em; }
.guide-content .ql-indent-7 { padding-left: 21em; }
.guide-content .ql-indent-8 { padding-left: 24em; }
