/* Page styles for the architecture docs. Colours, spacing, radii, shadows and type sizes
   come from the framework's UI kit tokens (--dcui-*), so load
   assets/libs/dc-ui-kit/0.0.2/dc-ui-kit.css before this file. Diagram internals are
   styled by diagram-kit.js, because Mermaid needs those rules while it measures boxes. */

/* The UI kit and Font Awesome declare their fonts with paths that only work behind the
   web server. Re-declare the faces this page uses with paths relative to this file;
   being declared later, they win. */
@font-face {
  font-family: "Lato";
  font-weight: 400;
  src: url("../../assets/fonts/Lato/Lato-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Lato";
  font-weight: 600;
  src: url("../../assets/fonts/Lato/Lato-Semibold.woff2") format("woff2");
}

@font-face {
  font-family: "Lato";
  font-weight: 700;
  src: url("../../assets/fonts/Lato/Lato-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "Font Awesome 6 Pro";
  font-style: normal;
  font-weight: 900;
  font-display: block;
  src: url("../../assets/libs/font-awesome/6-pro/webfonts/fa-solid-900.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --dc-doc-max-width: 1440px;
  --dc-doc-nav-width: 220px;
  --dc-doc-gutter: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--dcui-bg-canvas);
  color: var(--dcui-text-primary);
  font-family: var(--dcui-font-family);
  font-size: var(--dcui-type-body-md-size);
  line-height: var(--dcui-type-body-md-lineheight);
}

code {
  font-family: var(--dcui-type-mono-family);
  font-size: var(--dcui-type-mono-size);
  color: var(--dcui-text-heading);
  overflow-wrap: anywhere;
}

a {
  color: var(--dcui-text-link);
}

a:hover {
  color: var(--dcui-text-link-hover);
}

.dc-doc {
  max-width: var(--dc-doc-max-width);
  margin: 0 auto;
  padding: var(--dcui-space-30) var(--dc-doc-gutter) var(--dcui-space-60);
}

/* One quiet, predictable route between the architecture pages. The bar uses only the
   framework's neutral surface and text tokens; page-specific navigation stays in the
   left panel below it. */
.dc-doc-global-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--dcui-space-5);
  margin-bottom: var(--dcui-space-25);
  padding: var(--dcui-space-10);
  border: 1px solid var(--dcui-border-subtle);
  border-radius: var(--dcui-radius-panel);
  background: var(--dcui-bg-surface);
}

.dc-doc-global-nav a {
  display: inline-flex;
  align-items: center;
  padding: var(--dcui-space-5) var(--dcui-space-10);
  border-radius: var(--dcui-radius-control);
  color: var(--dcui-text-primary);
  font-size: var(--dcui-type-label-md-size);
  line-height: var(--dcui-type-label-md-lineheight);
  font-weight: var(--dcui-type-label-md-weight);
  text-decoration: none;
}

.dc-doc-global-nav a:hover,
.dc-doc-global-nav a[aria-current="page"] {
  background: var(--dcui-bg-surface-sunken);
  color: var(--dcui-text-heading);
}

.dc-doc-global-nav a:focus-visible,
.dc-doc-nav a:focus-visible,
.dc-doc-page-nav a:focus-visible {
  outline: 2px solid var(--dcui-text-link);
  outline-offset: 2px;
}

.dc-doc h1,
.dc-doc h2,
.dc-doc h3 {
  margin: 0;
  color: var(--dcui-text-heading);
}

.dc-doc h1 {
  font-size: var(--dcui-type-display-size);
  line-height: var(--dcui-type-display-lineheight);
  font-weight: var(--dcui-type-display-weight);
}

.dc-doc h2 {
  font-size: var(--dcui-type-heading-2-size);
  line-height: var(--dcui-type-heading-2-lineheight);
  font-weight: var(--dcui-type-heading-2-weight);
}

.dc-doc h3 {
  font-size: var(--dcui-type-heading-3-size);
  line-height: var(--dcui-type-heading-3-lineheight);
  font-weight: var(--dcui-type-heading-3-weight);
}

.dc-doc p {
  max-width: 75ch;
  margin: var(--dcui-space-10) 0 0;
}

.dc-doc ul,
.dc-doc ol {
  max-width: 75ch;
  margin: var(--dcui-space-10) 0 0;
  padding-left: var(--dcui-space-20);
}

.dc-doc li + li {
  margin-top: var(--dcui-space-5);
}

.dc-lead {
  color: var(--dcui-text-secondary);
}

.dc-doc-header {
  margin-bottom: var(--dcui-space-30);
}

.dc-template-note {
  margin-bottom: var(--dcui-space-25);
  padding: var(--dcui-space-15);
  border: 1px solid var(--dcui-border-subtle);
  border-radius: var(--dcui-radius-panel);
  background: var(--dcui-bg-surface-sunken);
}

.dc-template-note p {
  margin: 0;
}

.dc-doc-layout {
  display: grid;
  grid-template-columns: var(--dc-doc-nav-width) minmax(0, 1fr);
  gap: var(--dcui-space-30);
  align-items: start;
}

.dc-doc-nav {
  position: sticky;
  top: var(--dcui-space-20);
  padding: var(--dcui-space-15);
  border: 1px solid var(--dcui-border-subtle);
  border-radius: var(--dcui-radius-panel);
  background: var(--dcui-bg-surface);
}

.dc-doc-nav-title {
  margin: 0 0 var(--dcui-space-10);
  color: var(--dcui-text-secondary);
  font-size: var(--dcui-type-label-sm-size);
  line-height: var(--dcui-type-label-sm-lineheight);
  font-weight: var(--dcui-type-label-sm-weight);
}

.dc-doc-nav ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dc-doc-nav li + li {
  margin-top: 0;
}

.dc-doc-nav a {
  display: block;
  padding: var(--dcui-space-5) var(--dcui-space-10);
  border-radius: var(--dcui-radius-control);
  color: var(--dcui-text-primary);
  font-size: var(--dcui-type-label-md-size);
  line-height: var(--dcui-type-label-md-lineheight);
  font-weight: var(--dcui-type-label-md-weight);
}

.dc-doc-nav a:hover {
  background: var(--dcui-bg-surface-sunken);
  color: var(--dcui-text-link);
}

.dc-section {
  scroll-margin-top: var(--dcui-space-20);
  padding: var(--dcui-space-25);
  border: 1px solid var(--dcui-border-subtle);
  border-radius: var(--dcui-radius-panel);
  background: var(--dcui-bg-surface);
  box-shadow: var(--dcui-shadow-1);
}

.dc-section + .dc-section {
  margin-top: var(--dcui-space-25);
}

.dc-reading-path li::marker {
  color: var(--dcui-text-secondary);
  font-weight: var(--dcui-type-label-md-weight);
}

.dc-reading-path strong {
  display: block;
  color: var(--dcui-text-heading);
}

.dc-details {
  margin-top: var(--dcui-space-20);
  border-top: 1px solid var(--dcui-border-subtle);
  border-bottom: 1px solid var(--dcui-border-subtle);
}

.dc-details summary {
  padding: var(--dcui-space-15) 0;
  color: var(--dcui-text-link);
  font-size: var(--dcui-type-label-md-size);
  line-height: var(--dcui-type-label-md-lineheight);
  font-weight: var(--dcui-type-label-md-weight);
}

.dc-details[open] summary {
  border-bottom: 1px solid var(--dcui-border-subtle);
}

.dc-details-body {
  padding: 0 0 var(--dcui-space-15);
}

.dc-section h3 {
  margin-top: var(--dcui-space-25);
}

.dc-files {
  margin-top: var(--dcui-space-20);
  padding: var(--dcui-space-15) var(--dcui-space-20);
  border-radius: var(--dcui-radius-control);
  background: var(--dcui-bg-surface-sunken);
}

.dc-files h4 {
  margin: 0;
  color: var(--dcui-text-heading);
  font-size: var(--dcui-type-label-md-size);
  line-height: var(--dcui-type-label-md-lineheight);
  font-weight: var(--dcui-type-label-md-weight);
}

.dc-files ul {
  margin-top: var(--dcui-space-5);
}

.dc-table {
  width: 100%;
  margin-top: var(--dcui-space-15);
  border-collapse: collapse;
}

.dc-table th,
.dc-table td {
  padding: var(--dcui-space-10) var(--dcui-space-10) var(--dcui-space-10) 0;
  border-bottom: 1px solid var(--dcui-border-subtle);
  text-align: left;
  vertical-align: top;
}

.dc-table th {
  color: var(--dcui-text-secondary);
  font-size: var(--dcui-type-label-sm-size);
  line-height: var(--dcui-type-label-sm-lineheight);
  font-weight: var(--dcui-type-label-sm-weight);
}

.dc-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--dcui-space-20);
  margin-top: var(--dcui-space-20);
}

.dc-catalog-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--dcui-space-15);
  border: 1px solid var(--dcui-border-subtle);
  border-radius: var(--dcui-radius-panel);
}

.dc-catalog-item .dc-diagram-figure {
  flex: 1;
}

.dc-catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--dcui-space-10);
}

.dc-catalog-head h3,
.dc-section .dc-catalog-head h3 {
  margin: 0;
}

.dc-tag {
  flex: none;
  padding: 1px var(--dcui-space-10);
  border-radius: var(--dcui-radius-chip);
  background: var(--dcui-bg-surface-sunken);
  color: var(--dcui-text-secondary);
  font-size: var(--dcui-type-caption-size);
  line-height: var(--dcui-type-caption-lineheight);
}

.dc-code {
  margin: var(--dcui-space-15) 0 0;
  overflow-x: auto;
  padding: var(--dcui-space-10) var(--dcui-space-15);
  border-radius: var(--dcui-radius-control);
  background: var(--dcui-bg-surface-sunken);
  font-family: var(--dcui-type-mono-family);
  font-size: var(--dcui-type-mono-size);
  line-height: var(--dcui-type-mono-lineheight);
}

/* Wide diagrams scroll inside their box, never the whole page. */
.dc-diagram-figure {
  margin: var(--dcui-space-20) 0 0;
  overflow-x: auto;
}

.dc-diagram-figure svg {
  display: block;
  max-width: none;
  height: auto;
  margin: 0 auto;
}

/* Sticky, so the hint stays in view while the diagram scrolls under it. */
.dc-diagram-figure.is-scrollable::before {
  content: "Scroll sideways to see the whole diagram";
  position: sticky;
  left: 0;
  display: block;
  margin-bottom: var(--dcui-space-10);
  color: var(--dcui-text-secondary);
  font-size: var(--dcui-type-caption-size);
  line-height: var(--dcui-type-caption-lineheight);
}

.dc-diagram-error {
  padding: var(--dcui-space-10) var(--dcui-space-15);
  border-radius: var(--dcui-radius-control);
  background: var(--dcui-color-red-50);
  color: var(--dcui-color-red-700);
}

.dc-doc-page-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--dcui-space-15);
  margin-top: var(--dcui-space-25);
}

.dc-doc-page-nav a {
  display: block;
  padding: var(--dcui-space-15);
  border: 1px solid var(--dcui-border-subtle);
  border-radius: var(--dcui-radius-panel);
  background: var(--dcui-bg-surface);
  color: var(--dcui-text-primary);
  text-decoration: none;
}

.dc-doc-page-nav a:hover {
  background: var(--dcui-bg-surface-sunken);
  color: var(--dcui-text-heading);
}

.dc-doc-page-nav .dc-doc-page-nav-next {
  text-align: right;
}

.dc-doc-page-nav span {
  display: block;
  color: var(--dcui-text-secondary);
  font-size: var(--dcui-type-caption-size);
  line-height: var(--dcui-type-caption-lineheight);
}

.dc-doc-page-nav strong {
  display: block;
  margin-top: var(--dcui-space-5);
}

@media (max-width: 900px) {
  .dc-doc-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dc-doc-nav {
    position: static;
  }
}

@media (max-width: 600px) {
  .dc-doc-global-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dc-section {
    padding: var(--dcui-space-15);
  }

  .dc-doc-page-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .dc-doc-page-nav .dc-doc-page-nav-next {
    text-align: left;
  }
}
