/* QGISRed manual -- palette matches git_repo_web/src/app/globals.css (the
   qgisred.upv.es site): teal CTA, navy header/footer, green accent. System
   font stack on purpose (no "Work Sans" webfont): the PDF is printed by
   Playwright from this same CSS in CI, and a network font load there is one
   more way for the print to come out different from one run to the next. */

:root {
  --brand-teal: #5fbdd3;
  --brand-teal-dark: #3f9bb0;
  --brand-navy: #000e28;
  --brand-dark-navy: #000919;
  --brand-green: #7ea728;
  --brand-light-grey: #f6f6f6;
  --text: #222222;
  --text-muted: #555b61;
  --border: #e2e5e8;
  --warning-bg: #fff6e6;
  --warning-border: #e3a008;
  --note-bg: #eaf6f9;
  --note-border: var(--brand-teal-dark);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  --nav-width: 280px;
  --toc-width: 240px;
  --header-height: 60px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.manual {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
}

a {
  color: var(--brand-teal-dark);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  color: var(--brand-dark-navy);
  line-height: 1.25;
}
h1 {
  font-size: 1.9rem;
  margin: 0 0 1.2rem;
}
h2 {
  font-size: 1.4rem;
  margin: 2.2rem 0 0.9rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--border);
}
h3 {
  font-size: 1.15rem;
  margin: 1.6rem 0 0.6rem;
}
h1:first-child,
h2:first-of-type {
  border-top: none;
}

.anchor {
  margin-left: 0.4em;
  opacity: 0;
  color: var(--text-muted);
  font-weight: 400;
  text-decoration: none;
}
h1:hover .anchor,
h2:hover .anchor,
h3:hover .anchor {
  opacity: 1;
}

code {
  font-family: var(--font-mono);
  background: var(--brand-light-grey);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}
pre {
  background: var(--brand-dark-navy);
  color: #f6f6f6;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}
pre code {
  background: none;
  padding: 0;
  color: inherit;
}

blockquote {
  margin: 1rem 0;
  padding: 0.8rem 1.1rem;
  border-left: 4px solid var(--brand-teal);
  background: var(--brand-light-grey);
  border-radius: 0 6px 6px 0;
}
blockquote p:last-child {
  margin-bottom: 0;
}

.callout {
  margin: 1.2rem 0;
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  border: 1px solid;
}
.callout p:last-child {
  margin-bottom: 0;
}
.callout-title {
  font-weight: 700;
  margin: 0 0 0.3rem;
}
.callout-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}
.callout-warning .callout-title {
  color: #8a6400;
}
.callout-note {
  background: var(--note-bg);
  border-color: var(--note-border);
}
.callout-note .callout-title {
  color: var(--brand-teal-dark);
}

.table-wrap {
  overflow-x: auto;
  margin: 1.2rem 0;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
th,
td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--brand-light-grey);
  font-weight: 700;
}

figure {
  margin: 1.4rem 0;
  text-align: center;
}
figcaption {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ---- Header ------------------------------------------------------- */

.m-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 1.1rem;
  background: var(--brand-navy);
  color: #fff;
}
.m-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #fff;
  font-size: 1.05rem;
  white-space: nowrap;
}
.m-brand img {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 0;
}
/* button.m-menu, not .m-menu: this button is also .m-btn, whose own
   `display: inline-flex` (below) has the same specificity and comes later
   in the sheet, so a bare class selector here would lose the cascade and
   the toggle would stay visible outside the mobile breakpoint too. */
button.m-menu {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}
.m-spacer {
  flex: 1;
}
.m-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 0.9rem;
  white-space: nowrap;
  background: transparent;
  cursor: pointer;
}
.m-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}
.m-btn-primary {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: var(--brand-dark-navy);
  font-weight: 600;
}
.m-btn-primary:hover {
  background: var(--brand-teal-dark);
  color: #fff;
}

.m-search {
  position: relative;
  flex: 0 1 320px;
}
.m-search input {
  width: 100%;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.9rem;
}
.m-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.m-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  list-style: none;
  margin: 0;
  padding: 0.4rem;
}
.m-results li a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  color: var(--text);
}
.m-results li a:hover,
.m-results li a:focus {
  background: var(--brand-light-grey);
  text-decoration: none;
}
.m-results .m-result-path {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.m-results .m-result-empty {
  padding: 0.6rem;
  color: var(--text-muted);
}

/* ---- Layout --------------------------------------------------------- */

.m-shell {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  max-width: 1400px;
  margin: 0 auto;
}

.m-nav {
  border-right: 1px solid var(--border);
  padding: 1.4rem 1rem;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
}
.m-nav ul {
  list-style: none;
  margin: 0;
  padding-left: 0.9rem;
}
.m-nav > ul {
  padding-left: 0;
}
.m-nav li {
  margin: 0.1rem 0;
}
.m-nav a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.92rem;
}
.m-nav > ul > li > a {
  font-weight: 700;
  color: var(--brand-dark-navy);
}
.m-nav a:hover {
  background: var(--brand-light-grey);
  text-decoration: none;
}
.m-nav a[aria-current="page"] {
  background: var(--brand-teal);
  color: var(--brand-dark-navy);
  font-weight: 700;
}
.m-nav > ul > li > ul {
  display: none;
}
.m-nav > ul > li.is-open > ul {
  display: block;
}
.m-num {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.m-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-width);
  gap: 2.5rem;
  padding: 2rem 1.6rem 4rem;
}
.m-article {
  min-width: 0;
}

.m-toc {
  border-left: 1px solid var(--border);
  padding-left: 1.1rem;
  align-self: start;
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  font-size: 0.88rem;
}
.m-toc-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.m-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.m-toc li {
  margin: 0.25rem 0;
}
.m-toc a {
  color: var(--text-muted);
}
.m-toc-sub {
  padding-left: 0.9rem;
}

.m-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}
.m-prev,
.m-next {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.m-prev:hover,
.m-next:hover {
  border-color: var(--brand-teal);
  text-decoration: none;
}
.m-next {
  text-align: right;
  margin-left: auto;
}
.m-prev small,
.m-next small {
  color: var(--text-muted);
  font-weight: 400;
}

@media (max-width: 900px) {
  button.m-menu {
    display: inline-flex;
  }
  .m-search {
    display: none;
  }
  .m-btn-label {
    display: none;
  }
  .m-shell {
    grid-template-columns: 1fr;
  }
  .m-nav {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: #fff;
    z-index: 15;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .m-nav.is-open {
    transform: translateX(0);
  }
  .m-nav > ul > li > ul {
    display: block;
  }
  .m-main {
    grid-template-columns: 1fr;
    padding: 1.3rem 1.1rem 3rem;
  }
  .m-toc {
    display: none;
  }
}

/* ---- Print page (the PDF's source) ---------------------------------- */

.print-bar {
  padding: 0.8rem 1.1rem;
  background: var(--brand-light-grey);
  text-align: center;
}
.print-doc {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.6rem 4rem;
}
.print-cover {
  text-align: center;
  padding: 4rem 0 3rem;
}
.print-cover img {
  width: 72px;
  height: 72px;
  border: none;
}
.print-cover h1 {
  font-size: 2.4rem;
  margin: 1rem 0 0.2rem;
}
.print-cover-subtitle {
  font-size: 1.2rem;
  color: var(--brand-teal-dark);
  font-weight: 700;
}
.print-toc {
  page-break-after: always;
  margin-bottom: 2rem;
}
.print-toc ul {
  list-style: none;
  padding-left: 1.1rem;
}
.print-toc > ul {
  padding-left: 0;
}
.print-toc > ul > li > a {
  font-weight: 700;
}
.print-page {
  page-break-before: always;
}
.print-page.depth-0 {
  page-break-before: avoid;
}

@media print {
  .print-bar {
    display: none;
  }
  a {
    color: inherit;
  }
  .anchor {
    display: none;
  }
}
