/* Theme colours sampled from the Campinácios logo (tent + sun emblem):
   red #e11b1c, bright green #008d00, dark green #004e01, yellow #fcd704,
   brown #95411f. Primary is the tent's green; accent is the badge red,
   chosen for its contrast against light and dark backgrounds. */
[data-md-color-primary="custom"] {
  --md-primary-fg-color: #006b00;
  --md-primary-fg-color--light: #4caf50;
  --md-primary-fg-color--dark: #003f00;
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: hsla(0, 0%, 100%, 0.7);
}

[data-md-color-accent="custom"] {
  --md-accent-fg-color: #e11b1c;
  --md-accent-fg-color--transparent: #e11b1c1a;
  --md-accent-bg-color: #ffffff;
  --md-accent-bg-color--light: hsla(0, 0%, 100%, 0.7);
}

[data-md-color-scheme="slate"][data-md-color-accent="custom"] {
  --md-accent-fg-color: #ff6f6a;
  --md-accent-fg-color--transparent: #ff6f6a1a;
}

/* The header keeps the full-strength green in both schemes, but body
   links need a lighter shade against the near-black slate background
   to clear WCAG contrast (the dark green reads at ~2.4:1 there). */
[data-md-color-scheme="slate"][data-md-color-primary="custom"] {
  --md-typeset-a-color: #4caf50;
}

/* The graph page has no table of contents: give its width to the graph.
   Nor do the restricted pages (their headings are encrypted), and the home
   page, like the wiki's, also uses the navigation's width (pages carry no
   front matter to say so). */
.md-main__inner:has(.wiki-graph) > .md-sidebar--secondary,
.md-main__inner:has(.wiki-restrito) > .md-sidebar--secondary,
.md-main__inner:has(.wk-grid) > .md-sidebar--secondary {
  display: none;
}

@media screen and (min-width: 76.25em) {
  .md-main__inner:has(.wk-grid) > .md-sidebar--primary {
    display: none;
  }
}

.wiki-graph {
  position: relative;
  height: 75vh;
  min-height: 420px;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
  overflow: hidden;
  background: var(--md-default-bg-color);
}

.wiki-graph canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.wiki-graph canvas.dragging {
  cursor: grabbing;
}

.wiki-graph .wiki-graph-controls {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  font-size: 0.65rem;
  pointer-events: none;
}

.wiki-graph .wiki-graph-controls > * {
  pointer-events: auto;
}

.wiki-graph input {
  font: inherit;
  padding: 3px 6px;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 4px;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}

.wiki-graph .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  background: var(--md-default-bg-color);
  padding: 1px 4px;
  border-radius: 3px;
}

.wiki-graph .legend-item.off {
  opacity: 0.35;
}

.wiki-graph .legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* Home page: the layout and colours of the wiki's Página principal. */
:root {
  --wk-banner-bg: #f2f5fd;
  --wk-banner-border: #c7d0f8;
  --wk-box-bg: #ffffff;
  --wk-box-border: #cedff2;
  --wk-blue: #cedff2;
  --wk-blue-border: #b1cdeb;
  --wk-yellow: #f0f3cd;
  --wk-yellow-border: #dddda4;
  --wk-green: #cef2e8;
  --wk-green-border: #8be0c9;
  --wk-index-bg: #ccd5f4;
  --wk-index-border: #778fe1;
  --wk-rule: #aaaaaa;
  --wk-head-fg: #000000;
}

[data-md-color-scheme="slate"] {
  --wk-banner-bg: #1f2438;
  --wk-banner-border: #3a4570;
  --wk-box-bg: var(--md-default-bg-color);
  --wk-box-border: #34405e;
  --wk-blue: #253552;
  --wk-blue-border: #3b5580;
  --wk-yellow: #3a3a22;
  --wk-yellow-border: #5c5c34;
  --wk-green: #1f3b35;
  --wk-green-border: #2f6b5c;
  --wk-index-bg: #262e4d;
  --wk-index-border: #4a5a9c;
  --wk-rule: #555b6e;
  --wk-head-fg: var(--md-default-fg-color);
}

.md-typeset .wk-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.md-typeset .wk-top {
  text-align: right;
  font-size: 0.85em;
  margin: 0 0 2px;
}

.md-typeset .wk-banner {
  background: var(--wk-banner-bg);
  border: 1px solid var(--wk-banner-border);
  padding: 7px 10px 9px;
  margin-bottom: 8px;
  display: flow-root;
  clear: both;  /* below the floating "edit" button */
}

.md-typeset .wk-count {
  float: right;
  font-size: 0.85em;
  margin-left: 1em;
}

.md-typeset .wk-welcome {
  font-size: 1.6em;
  line-height: 1.3;
}

.md-typeset .wk-tagline {
  padding: 2px 0 0 20px;
  font-size: 0.9em;
}

.md-typeset .wk-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 8px;
  align-items: start;
}

.md-typeset .wk-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.md-typeset .wk-box {
  background: var(--wk-box-bg);
  border: 1px solid var(--wk-box-border);
  border-radius: 10px;
  padding: 5px 8px 2px;
  font-size: 0.9em;
}

.md-typeset .wk-box > p,
.md-typeset .wk-box > ul {
  margin: 0.6em 0;
}

.md-typeset .wk-head {
  border-radius: 10px;
  padding: 2px 7px;
  font-weight: 700;
  border: 1px solid var(--wk-blue-border);
  background: var(--wk-blue);
  margin: 0 0 0.4em;
  font-size: 1.05em;
}

.md-typeset .wk-head a {
  color: var(--wk-head-fg);
}

.md-typeset .wk-yellow .wk-head {
  background: var(--wk-yellow);
  border-color: var(--wk-yellow-border);
}

.md-typeset .wk-green .wk-head {
  background: var(--wk-green);
  border-color: var(--wk-green-border);
}

.md-typeset .wk-more {
  text-align: right;
  margin: 0 0 0.6em;
}

.md-typeset .wk-index {
  background: var(--wk-index-bg);
  border: 1px solid var(--wk-index-border);
  border-radius: 10px;
  padding: 5px;
  font-size: 0.85em;
  line-height: 1.45;
}

.md-typeset .wk-section {
  background: var(--wk-box-bg);
  padding: 5px 8px 5px 5%;
  border-bottom: 1px dashed var(--wk-rule);
}

.md-typeset .wk-section:first-child {
  border-radius: 8px 8px 0 0;
}

.md-typeset .wk-section:last-child {
  border-radius: 0 0 8px 8px;
  border-bottom: 0;
}

@media screen and (max-width: 60em) {
  .md-typeset .wk-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Restricted pages (assets/restrito.js) */
.md-typeset .wiki-restrito:not(.aberto) {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
  padding: 0.2em 1em 1em;
}

.md-typeset .wiki-restrito-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em 1em;
  align-items: center;
}

.md-typeset .wiki-restrito-form input[type="password"] {
  font: inherit;
  margin-left: 0.4em;
  padding: 0.3em 0.5em;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 4px;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}

.md-typeset .wiki-restrito-form .lembrar {
  font-size: 0.9em;
}

.md-typeset .wiki-restrito-form .erro,
.md-typeset .wiki-restrito > .erro {
  flex-basis: 100%;
  margin: 0;
  color: #c62828;
}

.md-typeset .wiki-restrito-barra {
  font-size: 0.8em;
  color: var(--md-default-fg-color--light);
}

/* Logo gallery (Movimento/Campinácios.md) */
.md-typeset .wk-logos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 1rem;
  margin: 1em 0 1.5em;
}

.md-typeset .wk-logos figure {
  margin: 0;
  width: auto;
  display: flex;
  flex-direction: column;
  padding: 0.6em;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
}

.md-typeset .wk-logos figure > a {
  margin: auto 0;
}

.md-typeset .wk-logos img {
  max-height: 9rem;
  width: auto;
  object-fit: contain;
}

.md-typeset .wk-logos figcaption {
  margin: 0.5em 0 0;
  max-width: none;
  font-size: 0.8em;
}

/* Full-width page banner photo (e.g. Categorias/Acampamentos.md) */
.md-typeset .wk-page-banner {
  margin: 0 0 1.5em;
}

.md-typeset .wk-page-banner img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.md-typeset .wk-page-banner figcaption {
  margin: 0.4em 0 0;
  max-width: none;
  font-size: 0.8em;
  text-align: right;
}
