/* Code generated by ayida from deployment.ayida.hcl, gateway.ayida.hcl, main.ayida.hcl, notifications.ayida.hcl, orders.ayida.hcl, platform.ayida.hcl, users.ayida.hcl. DO NOT EDIT. */
/* ayida site theme (feature 021): Madstone branding, light and dark.
   Colour tokens live in one block per theme; contrast_test.go checks every
   text/background pair at WCAG AA. The WCAG overrides (--link and
   --accent-text in light mode) are ayida's own, not the brand tokens'.
   The fonts are declared in the generated fonts.css, the icons in icons.css. */

/* ---- tokens: light (the default when no preference is known) ---- */
:root {
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --txt-1: #111827;
  --txt-2: #374151;
  --txt-3: #4B5563;
  --txt-4: #9CA3AF; /* decoration only: borders, rules, never text */
  --border: #E5E7EB;
  --link: #2D66AE;
  --accent: #18C800;
  --accent-text: #128200;
  --accent-tint: rgba(24, 200, 0, 0.10);
  --chip-bg: #EEF2F7;
  --chip-text: #374151;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 1px 3px rgba(17, 24, 39, 0.08);
  --paper: #FFFFFF;
  --paper-border: #E5E7EB;

  --side-bg: #1E1E1E;
  --side-txt: #E5E7EB;
  --side-muted: #A3A3A3;
  --side-link: #E5E7EB;
  --side-hover: rgba(255, 255, 255, 0.06);

  --kind-person-bg: #1A4275;    --kind-person-fg: #FFFFFF;
  --kind-system-bg: #1E4F8F;    --kind-system-fg: #FFFFFF;
  --kind-container-bg: #2D66AE; --kind-container-fg: #FFFFFF;
  --kind-component-bg: #93C5FD; --kind-component-fg: #0F1117;
  --kind-external-bg: #525252;  --kind-external-fg: #FFFFFF;

  --radius-card: 6px;
  --radius-button: 4px;
  --radius-tag: 3px;

  --font-heading: "Orbitron", system-ui, sans-serif;
  --font-prose: "Source Sans 3", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-ui: "JetBrains Mono", ui-monospace, monospace;
  --font-display: "Audiowide", "Orbitron", system-ui, sans-serif;

  color-scheme: light;
}

/* ---- tokens: dark, from the system preference unless the reader chose light ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1117;
    --card: #1A1D24;
    --txt-1: #F3F4F6;
    --txt-2: #D1D5DB;
    --txt-3: #A7AFBB;
    --txt-4: #4B5563;
    --border: #2A2F3A;
    --link: #4A90E2;
    --accent-text: #18C800;
    --accent-tint: rgba(24, 200, 0, 0.12);
    --chip-bg: #252A33;
    --chip-text: #D1D5DB;
    --shadow: none;
    --paper-border: #2A2F3A;
    color-scheme: dark;
  }
}

/* ---- tokens: dark, chosen with the toggle ---- */
:root[data-theme="dark"] {
  --bg: #0F1117;
  --card: #1A1D24;
  --txt-1: #F3F4F6;
  --txt-2: #D1D5DB;
  --txt-3: #A7AFBB;
  --txt-4: #4B5563;
  --border: #2A2F3A;
  --link: #4A90E2;
  --accent-text: #18C800;
  --accent-tint: rgba(24, 200, 0, 0.12);
  --chip-bg: #252A33;
  --chip-text: #D1D5DB;
  --shadow: none;
  --paper-border: #2A2F3A;
  color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt-1);
  font-family: var(--font-prose);
  font-size: 17px;
  line-height: 1.6;
}
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.88em; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; letter-spacing: 0.02em; color: var(--txt-1); line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.75rem; }
img { max-width: 100%; height: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: var(--font-ui); font-size: 0.78rem; font-weight: 600; color: var(--txt-3); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 20; background: var(--card); color: var(--link); padding: 0.5rem 1rem; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---- page frame ---- */
.container { display: flex; min-height: 100vh; }
.main-content { flex: 1; min-width: 0; padding: 1.5rem 2.5rem 3rem; max-width: 1280px; }
.topbar { display: flex; align-items: center; gap: 1rem; min-height: 2rem; }
.topbar .breadcrumb { flex: 1; }
.menu-toggle { display: none; }

/* ---- sidebar ---- */
.sidebar {
  width: 280px; flex: none; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
  background-color: var(--side-bg); color: var(--side-txt); font-family: var(--font-ui); font-size: 0.8rem;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px); background-size: 16px 16px;
  padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1rem;
}
.sidebar a { color: var(--side-link); text-decoration: none; }
.sidebar a:hover { text-decoration: underline; }
.brand-link { display: flex; align-items: center; gap: 0.6rem; }
.wordmark { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: 0.08em; color: #FFFFFF; }
.cursor { color: var(--accent); animation: ayida-blink 1s steps(1) 3; }
@keyframes ayida-blink { 50% { opacity: 0; } }
.project-name { margin: 0; font-weight: 600; font-size: 0.9rem; }
.project-description { margin: 0.25rem 0 0; color: var(--side-muted); line-height: 1.45; }
.nav-section h2 { font-family: var(--font-ui); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-muted); margin: 0.5rem 0; }
.search-input {
  width: 100%; padding: 0.45rem 0.6rem; border-radius: var(--radius-button); border: 1px solid #3A3A3A;
  background: #141414; color: var(--side-txt); font-family: var(--font-ui); font-size: 0.8rem;
}
.search-input::placeholder { color: var(--side-muted); }
.sidebar .element-list, .system-list, .tree ul { list-style: none; margin: 0; padding: 0; }
.sidebar .element-list li, .system-list li { padding: 0.2rem 0.4rem; border-left: 3px solid transparent; }
.system-list small, .sidebar .element-list small { color: var(--side-muted); }
.system-list li.active { border-left-color: var(--accent); background: var(--accent-tint); }
.tree ul ul { padding-left: 0.9rem; }
.tree-row { display: flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.3rem; border-left: 3px solid transparent; border-radius: 0 var(--radius-button) var(--radius-button) 0; }
.tree-row:hover { background: var(--side-hover); }
.tree-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tree-item.active > .tree-row { border-left-color: var(--accent); background: var(--accent-tint); }
.tree-item.active > .tree-row a { color: #FFFFFF; font-weight: 600; }
.twisty, .twisty-spacer { width: 1rem; flex: none; }
.twisty { background: none; border: 0; padding: 0; color: var(--side-muted); font: inherit; cursor: pointer; }
html:not(.js) .twisty { pointer-events: none; }
.tree .icon { color: var(--side-muted); }
.sidebar-footer { margin-top: auto; color: var(--side-muted); line-height: 1.45; }
.sidebar-footer code { color: var(--side-txt); }

/* ---- breadcrumb, header, pager ---- */
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0; font-family: var(--font-ui); font-size: 0.78rem; color: var(--txt-3); }
.breadcrumb li + li::before { content: "›"; margin-right: 0.25rem; color: var(--txt-3); }
.breadcrumb [aria-current] { color: var(--txt-2); }
.page-header { margin: 1rem 0 1.5rem; }
.accent-bar { width: 48px; height: 4px; background: var(--accent); border-radius: 2px; margin-bottom: 0.9rem; }
.kind-label { margin: 0; font-family: var(--font-ui); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--txt-3); }
.page-header h1 { display: flex; align-items: center; gap: 0.75rem; margin: 0.35rem 0; font-size: 1.9rem; overflow-wrap: anywhere; }
.page-header h1 .icon-tile { width: 2.2rem; height: 2.2rem; font-size: 1.2rem; }
.meta { margin: 0.25rem 0; font-family: var(--font-ui); font-size: 0.8rem; color: var(--txt-3); overflow-wrap: anywhere; }
.lead { margin: 0.75rem 0 0; font-size: 1.15rem; color: var(--txt-2); max-width: 70ch; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.pager a { display: flex; flex-direction: column; text-decoration: none; padding: 0.6rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); min-width: 0; }
.pager a:hover { border-color: var(--accent); }
.pager-next { margin-left: auto; text-align: right; }
.pager-dir { font-family: var(--font-ui); font-size: 0.72rem; color: var(--txt-3); }
.pager-name { overflow-wrap: anywhere; }
.footer { margin-top: 2rem; font-size: 0.85rem; color: var(--txt-3); }
.theme-toggle, .diagram-toolbar button, .menu-toggle {
  font-family: var(--font-ui); font-size: 0.75rem; color: var(--txt-2); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-button); padding: 0.3rem 0.65rem; cursor: pointer;
}
.theme-toggle[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.theme-toggle:hover, .diagram-toolbar button:hover, .menu-toggle:hover { border-color: var(--accent); }

/* ---- element page ---- */
.element-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "main rail"; gap: 2rem; align-items: start; }
.element-main { grid-area: main; min-width: 0; }
.rail { grid-area: rail; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.rail-card, .children, .stat-card, .in-this-view .rows, .views .rows, .systems .rows {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow);
}
.rail-card { padding: 0.9rem 1rem; }
.rail-card h2 { margin: 0 0 0.6rem; font-size: 0.85rem; }
.children { padding: 0.25rem 1rem 1rem; margin-top: 2rem; }
.part-of-up { margin: 0.6rem 0 0; font-size: 0.9rem; color: var(--txt-3); }
.markdown-content { max-width: 75ch; }
.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.15rem; }
.markdown-content pre { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 0.75rem 1rem; overflow-x: auto; }
.source-note, .prose-missing, .prose-inherited { font-size: 0.9rem; color: var(--txt-3); }

/* ---- rows, chips, tiles ---- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.rows > .row:last-child { border-bottom: 0; }
.in-this-view .rows, .views .rows, .systems .rows { padding: 0 1rem; }
.row-body { min-width: 0; flex: 1; }
.row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; overflow-wrap: anywhere; }
.row-kind { font-family: var(--font-ui); font-size: 0.72rem; color: var(--txt-3); }
.row-desc { margin: 0.15rem 0 0; font-size: 0.92rem; color: var(--txt-2); }
.row-tags { margin: 0.15rem 0 0; font-family: var(--font-ui); font-size: 0.75rem; color: var(--txt-3); }
.row.current { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-tint); padding-left: 0.5rem; }
.row.current .row-name { font-weight: 600; }
.rows.compact .row { padding: 0.35rem 0; }
.dir { font-family: var(--font-ui); color: var(--txt-3); width: 1.1rem; flex: none; text-align: center; padding-top: 0.15rem; }
.chip, .tag {
  display: inline-block; font-family: var(--font-ui); font-size: 0.7rem; line-height: 1.5; padding: 0 0.4rem;
  border-radius: var(--radius-tag); background: var(--chip-bg); color: var(--chip-text); white-space: nowrap;
}
.tags { margin: 0.5rem 0; }
.icon-tile {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.6rem; height: 1.6rem; border-radius: var(--radius-button); font-size: 0.95rem;
  background: var(--kind-system-bg); color: var(--kind-system-fg);
}
.icon-tile.kind-person { background: var(--kind-person-bg); color: var(--kind-person-fg); }
.icon-tile.kind-system { background: var(--kind-system-bg); color: var(--kind-system-fg); }
.icon-tile.kind-container { background: var(--kind-container-bg); color: var(--kind-container-fg); }
.icon-tile.kind-component { background: var(--kind-component-bg); color: var(--kind-component-fg); }
.icon-tile.kind-external { background: var(--kind-external-bg); color: var(--kind-external-fg); }

/* ---- overview ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 0 0 2rem; }
.stat-card { padding: 1rem 1.1rem; }
.stat-number { margin: 0; font-family: var(--font-display); font-size: 2rem; line-height: 1.1; color: var(--txt-1); }
.stat-label { margin: 0.2rem 0 0; font-family: var(--font-ui); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--txt-2); }
.stat-sub { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--txt-3); }

/* ---- diagrams: always on light paper ---- */
figure { margin: 1.5rem 0; }
figcaption { margin-top: 0.5rem; font-family: var(--font-ui); font-size: 0.75rem; color: var(--txt-3); }
.diagram-panel, .diagram-figure .diagram-link {
  display: block; background: var(--paper); border: 1px solid var(--paper-border); border-radius: var(--radius-card); padding: 0.75rem; overflow: hidden;
}
.diagram-panel svg { display: block; width: 100%; height: auto; max-height: 80vh; }
.zoomable .diagram-panel { cursor: zoom-in; touch-action: none; }
.zoomable .diagram-panel.panning { cursor: grabbing; }
.diagram-toolbar { display: flex; gap: 0.4rem; justify-content: flex-end; margin-bottom: 0.4rem; }
.context-figure { margin: 0; }
.context-figure svg g[data-ayida-address]:not(.ayida-focus), .context-figure svg .connection { opacity: 0.3; }
.context-figure svg .ayida-focus rect, .context-figure svg .ayida-focus path { stroke: #18C800 !important; stroke-width: 4px !important; }
.diagram-legend { font-size: 0.85rem; color: var(--txt-3); }

/* ---- motion ---- */
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- narrow screens: header → rail → main ---- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .container { display: block; }
  .main-content { padding: 1rem; }
  .element-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rail" "main"; }
  .meta, .row-head, .breadcrumb { overflow-wrap: anywhere; }
  .page-header h1 { font-size: 1.45rem; }
  html.js .menu-toggle { display: inline-block; }
  html.js .sidebar {
    position: fixed; z-index: 10; left: 0; top: 0; height: 100vh; width: min(85vw, 300px);
    transform: translateX(-100%); visibility: hidden;
  }
  html.js body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45); }
  html:not(.js) .sidebar { position: static; width: auto; height: auto; }
}

/* ---- print: light, no chrome, header → main → rail ---- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #FFFFFF; --card: #FFFFFF; --txt-1: #111827; --txt-2: #374151; --txt-3: #4B5563;
    --border: #D1D5DB; --link: #2D66AE; --accent-text: #128200; --chip-bg: #EEF2F7; --chip-text: #374151;
    --shadow: none; --paper-border: #D1D5DB; color-scheme: light;
  }
  body { font-size: 11pt; }
  .sidebar, .topbar, .menu-toggle, #theme-toggle, nav.pager, .diagram-toolbar, .skip-link { display: none !important; }
  .container { display: block; }
  .main-content { padding: 0; max-width: none; }
  .element-layout { display: block; }
  .rail { margin-top: 1.5rem; }
  .rail-card, .card, .stat-card, .row, tr, figure { break-inside: avoid; }
  .diagram-panel { background-image: none; box-shadow: none; overflow: visible; }
  .diagram-panel svg { width: 100%; max-height: none; }
  .sidebar { background-image: none; }
  a { color: var(--txt-1); }
}
