/* Kartoza Brand Pack — Material for MkDocs adapter.
 *
 * Consumes kartoza-tokens.css as the single source of colour and type. Aligned
 * with kartoza/InfrastructureMapper so Kartoza documentation reads as one family.
 *
 * Brand rules enforced here:
 *   · Flat — no shadows, bevels, glows or gradients on UI elements. Depth comes
 *     from the map motif only.
 *   · Charcoal carries body text and the header. Blue is the primary accent,
 *     Amber the secondary.
 *   · Blue and Amber are never body text — they fail WCAG AA on white.
 *   · Nunito throughout; JetBrains Mono for code.
 *
 * This file must NOT redefine the brand hues themselves — those live in
 * kartoza-tokens.css, which loads first.
 */

/* ---- Material primary/accent mapping ---- */

[data-md-color-primary="custom"] {
  --md-primary-fg-color: var(--text-default);
  --md-primary-fg-color--light: var(--text-muted);
  --md-primary-fg-color--dark: #1f1f1f;
  --md-primary-bg-color: var(--surface-white);
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.7);
}

[data-md-color-accent="custom"] {
  --md-accent-fg-color: var(--kartoza-blue);
  --md-accent-fg-color--transparent: rgba(84, 162, 204, 0.1);
  --md-accent-bg-color: var(--surface-white);
  --md-accent-bg-color--light: rgba(255, 255, 255, 0.7);
}

/* Flat charcoal bar — no gradient. */
.md-header,
.md-tabs {
  background: var(--text-default);
  color: var(--surface-white);
  box-shadow: none;
}

.md-tabs__link--active,
.md-tabs__link:hover {
  color: var(--kartoza-amber) !important;
  opacity: 1;
}

/* ---- Typography ---- */

body,
.md-typeset,
.md-header,
.md-tabs {
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "ss02";
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  font-family: var(--font-sans);
  color: var(--md-default-fg-color);
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.2;
}

.md-typeset h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.4em;
}

.md-typeset h2 {
  font-size: 1.4rem;
  margin-top: 2.2em;
  border-bottom: 2px solid var(--kartoza-amber);
  padding-bottom: 0.25rem;
}

.md-typeset h3 {
  font-size: 1.1rem;
}

.md-typeset code,
.md-typeset pre {
  font-family: var(--font-mono);
}

/* Eyebrow — spaced uppercase label above a hero title. */
.md-typeset .kz-eyebrow {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ---- Hero ---- */

.kz-hero {
  position: relative;
  text-align: center;
  padding: 2.5rem 1.75rem;
  margin: -1.5rem -0.75rem 2rem -0.75rem;
  border-radius: 0.75rem;
  background-color: var(--surface-cloud);
  background-image: linear-gradient(
      rgba(245, 245, 242, 0.88),
      rgba(245, 245, 242, 0.92)
    ),
    url("../brand/slant-title-background.png");
  background-size: cover;
  background-position: center;
  color: var(--text-default);
  overflow: hidden;
}

[data-md-color-scheme="slate"] .kz-hero {
  background-image: linear-gradient(
      rgba(28, 29, 29, 0.82),
      rgba(28, 29, 29, 0.88)
    ),
    url("../brand/slant-title-background.png");
  color: var(--surface-cloud);
}

.kz-hero h1 {
  margin: 0.25rem auto 0.5rem;
  max-width: 24ch;
  font-size: 2.2rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.01em;
  border-bottom: 0;
}

.kz-hero p {
  margin: 0 auto 1.5rem;
  max-width: 52ch;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-default);
}

.kz-hero .kz-eyebrow {
  margin-bottom: 0.5rem;
}

[data-md-color-scheme="slate"] .kz-hero p {
  color: var(--surface-cloud);
}

/* ---- Call-to-action buttons ---- */

.kz-cta,
.kz-cta > p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  justify-content: center;
}

/* Prefixed with .md-typeset so these beat Material's own anchor colour rule,
   which would otherwise repaint the label blue on a blue fill. */
.md-typeset .kz-cta a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: 0.375rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.md-typeset .kz-cta a.kz-cta__primary {
  background: var(--kartoza-blue);
  color: var(--surface-white);
  border: 2px solid var(--kartoza-blue);
}

.md-typeset .kz-cta a.kz-cta__primary:hover {
  background: #4790b8;
  border-color: #4790b8;
  color: var(--surface-white);
}

.md-typeset .kz-cta a.kz-cta__secondary {
  background: var(--surface-white);
  color: var(--text-default);
  border: 2px solid var(--text-default);
}

.md-typeset .kz-cta a.kz-cta__secondary:hover {
  background: var(--text-default);
  color: var(--surface-white);
}

[data-md-color-scheme="slate"] .md-typeset .kz-cta a.kz-cta__secondary {
  background: transparent;
  color: var(--surface-cloud);
  border-color: var(--surface-cloud);
}

[data-md-color-scheme="slate"] .md-typeset .kz-cta a.kz-cta__secondary:hover {
  background: var(--surface-cloud);
  color: var(--text-default);
}

@media (max-width: 768px) {
  .kz-hero {
    padding: 2rem 1.5rem;
  }
  .kz-hero h1 {
    font-size: 1.8rem;
  }
}

/* ---- Grid cards: flat, hairline border, blue on hover ---- */

.md-typeset .grid.cards > ul > li,
.md-typeset .grid.cards > ol > li {
  background: var(--surface-white);
  border: 1px solid var(--rule-line);
  border-radius: 0.5rem;
  box-shadow: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid.cards > ol > li:hover {
  border-color: var(--kartoza-blue);
  background: var(--surface-cloud);
  box-shadow: none;
  transform: none;
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li,
[data-md-color-scheme="slate"] .md-typeset .grid.cards > ol > li {
  background: #232525;
  border-color: #3a3b3b;
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li:hover,
[data-md-color-scheme="slate"] .md-typeset .grid.cards > ol > li:hover {
  border-color: var(--kartoza-blue);
  background: #2a2c2c;
}

.md-typeset .grid.cards .twemoji.lg,
.md-typeset .grid.cards .twemoji.lg svg {
  color: var(--kartoza-blue);
}

/* ---- Badges ---- */

.kz-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 1.5rem 0 2rem;
}

.kz-badges img {
  margin: 0;
}

/* ---- Tables ---- */

.md-typeset table:not([class]) {
  box-shadow: none;
  border: 1px solid var(--rule-line);
  border-radius: 0.25rem;
}

.md-typeset table:not([class]) th {
  background: var(--text-default);
  color: var(--surface-white);
  font-weight: 700;
}

.md-typeset table:not([class]) tr:nth-child(even) {
  background: var(--surface-cloud);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:nth-child(even) {
  background: #2a2b2b;
}

/* ---- Admonitions: flat, 4px brand rule ---- */

.md-typeset .admonition,
.md-typeset details {
  border: 0;
  border-left: 4px solid var(--rule-line);
  border-radius: 0.25rem;
  background: var(--surface-cloud);
  box-shadow: none;
  font-size: 0.78rem;
}

.md-typeset .admonition-title,
.md-typeset summary {
  background: transparent;
  color: var(--text-default);
  font-weight: 700;
}

[data-md-color-scheme="slate"] .md-typeset .admonition-title,
[data-md-color-scheme="slate"] .md-typeset summary {
  color: var(--surface-cloud);
}

.md-typeset .admonition.info,
.md-typeset details.info,
.md-typeset .admonition.tip,
.md-typeset details.tip,
.md-typeset .admonition.abstract,
.md-typeset details.abstract {
  border-left-color: var(--kartoza-blue);
  background: rgba(84, 162, 204, 0.08);
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-left-color: var(--status-warn);
  background: var(--status-warn-tint);
}

.md-typeset .admonition.note,
.md-typeset details.note {
  border-left-color: var(--kartoza-grey);
  background: var(--surface-cloud);
}

.md-typeset .admonition.success,
.md-typeset details.success {
  border-left-color: var(--status-success);
  background: var(--status-success-tint);
}

.md-typeset .admonition.danger,
.md-typeset details.danger,
.md-typeset .admonition.bug,
.md-typeset details.bug,
.md-typeset .admonition.failure,
.md-typeset details.failure {
  border-left-color: var(--status-error);
  background: var(--status-error-tint);
}

[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  background: #2a2b2b;
}

[data-md-color-scheme="slate"] .md-typeset .admonition.info,
[data-md-color-scheme="slate"] .md-typeset .admonition.tip,
[data-md-color-scheme="slate"] .md-typeset .admonition.abstract {
  background: rgba(84, 162, 204, 0.16);
}

/* ---- Footer ---- */

.md-footer-meta {
  background: var(--text-default);
}

.md-footer-meta a {
  color: var(--kartoza-amber) !important;
}

.kz-footer-credits {
  text-align: center;
  margin: 3rem 0 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.kz-footer-credits a {
  font-weight: 700;
  color: var(--kartoza-blue);
}

/* ---- Mermaid ---- */

.mermaid {
  background: transparent !important;
  color: var(--text-default);
}

/* =======================================================================
   Project-specific additions beyond the shared brand pack.
   ======================================================================= */

/* ---- Provenance markers ----
 *
 * A small icon on each figure caption showing whether the illustration is
 * regenerated from the codebase on every docs build, or authored by hand.
 * The legend lives in the Developer Guide; readers of the user guide need no
 * explanation of the build process for the marker to be useful.
 *
 * Delivered as data URIs so the icon needs no relative path, which would
 * otherwise differ per page depth across the doc tree.
 */

.md-typeset figcaption.gen::before,
.md-typeset figcaption.static::before,
.md-typeset .prov-icon::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.4em;
  vertical-align: -0.15em;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
}

/* Generated: a closed cycle, for something that regenerates itself. */
.md-typeset figcaption.gen::before,
.md-typeset .prov-icon.gen::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 2.6a5.4 5.4 0 0 1 5.2 4' fill='none' stroke='%232f7ba5' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M8 13.4a5.4 5.4 0 0 1-5.2-4' fill='none' stroke='%232f7ba5' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M13.6 3.2v3.6h-3.6' fill='none' stroke='%232f7ba5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M2.4 12.8V9.2h3.6' fill='none' stroke='%232f7ba5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='8' cy='8' r='1.5' fill='%2354a2cc'/%3E%3C/svg%3E");
}

/* Static: a pen nib, for something a person drew. */
.md-typeset figcaption.static::before,
.md-typeset .prov-icon.static::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M11.6 1.9a1.4 1.4 0 0 1 2 2L6.3 11.2l-2.9.9.9-2.9z' fill='none' stroke='%23c68f2b' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M10.3 3.2 12.3 5.2' fill='none' stroke='%23c68f2b' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M2.4 14.1h11.2' fill='none' stroke='%23eeb348' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

[data-md-color-scheme="slate"] .md-typeset figcaption.gen::before,
[data-md-color-scheme="slate"] .md-typeset figcaption.static::before,
[data-md-color-scheme="slate"] .md-typeset .prov-icon::before {
  opacity: 1;
}

/* Legend swatches, used in the Developer Guide.
 * attr_list applies the class to each <li> rather than the <ul>, so target both. */
.md-typeset ul.prov-legend,
.md-typeset li.prov-legend {
  list-style: none;
}

.md-typeset li.prov-legend {
  margin-left: 0;
  margin-bottom: 0.6em;
}

.md-typeset ul:has(> li.prov-legend) {
  padding-left: 0;
  margin-left: 0;
}

/* ---- Figures ---- */

.md-typeset figure {
  margin: 1.6rem auto;
  text-align: center;
}

.md-typeset figure img,
.md-typeset figure svg {
  max-width: 100%;
  height: auto;
}

.md-typeset figure figcaption {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 0.5rem;
  max-width: 46rem;
}

[data-md-color-scheme="slate"] .md-typeset figure figcaption {
  color: rgba(255, 255, 255, 0.62);
}

/* ---- Guided path: step navigation ---- */

.md-typeset .step-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--rule-line);
}

/* Only one button (first or last step) — push it to the right. */
.md-typeset .step-nav > a:only-child {
  margin-left: auto;
}

/* The Next button is the primary call to action. Flat, per the brand rules. */
.md-typeset .step-nav .next-step {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.7em 1.4em;
  background-color: var(--kartoza-blue);
  border-color: var(--kartoza-blue);
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.md-typeset .step-nav .next-step:hover,
.md-typeset .step-nav .next-step:focus {
  background-color: #4790b8;
  border-color: #4790b8;
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .step-nav .next-step {
    transition: none;
  }
}
