/* Dev dashboard (index.html). Dev tooling only; not a suite deliverable.
   Layout: sticky header with section links, a centered 1440px container,
   one card grid per section. Light by default; dark only when the viewer
   picks it with the header toggle (dashboard-theme.js). */

/* Tokens */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #d9dfe7;
  --text: #17202b;
  --muted: #5d6877;
  --accent: #1d5fd1;
  --accent-soft: #e5edfb;
  --screen: #14171c;
  --ok: #16794a;
  --ok-soft: #e2f3ea;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --info: #5b3fb8;
  --info-soft: #eee9fb;
  --off: #6b7482;
  --off-soft: #eceef1;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 2px 8px rgba(20, 30, 45, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

:root.theme-dark {
  --bg: #0f1318;
  --surface: #171c23;
  --surface-2: #1e242d;
  --border: #2b333e;
  --text: #e5e9ef;
  --muted: #98a3b3;
  --accent: #7aa7ff;
  --accent-soft: #1c2a44;
  --screen: #0a0c10;
  --ok: #5fcf95;
  --ok-soft: #15301f;
  --warn: #e9b949;
  --warn-soft: #33290f;
  --info: #b5a2ff;
  --info-soft: #262040;
  --off: #8d96a3;
  --off-soft: #222830;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* Base */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 24px;
}

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  padding-block: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--screen);
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark span {
  width: 18px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 2px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.internal-pill {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.theme-toggle {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}

.theme-toggle-glyph {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.section-nav {
  border-top: 1px solid var(--border);
}

.section-nav .wrap {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-block: 6px;
}

.section-nav a {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.section-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.scope-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 110ch;
}

/* Sections */
main {
  padding-block: 8px 48px;
}

section {
  padding-top: 36px;
  scroll-margin-top: 110px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.section-ref {
  font-weight: 500;
  color: var(--muted);
  font-size: 14px;
  margin-left: 6px;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  max-width: 80ch;
}

.legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.group-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-done {
  color: var(--ok);
  background: var(--ok-soft);
}

.badge-todo {
  color: var(--warn);
  background: var(--warn-soft);
}

.badge-review {
  color: var(--info);
  background: var(--info-soft);
}

.badge-none {
  color: var(--off);
  background: var(--off-soft);
}

/* Module and demo cards */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 14px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.module-card h3 {
  margin: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.card-meta > span {
  flex: 1 1 0;
  min-width: 0;
}

.mc {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
  white-space: nowrap;
}

.open-link,
.app-card-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 11px;
  border-radius: 6px;
  white-space: nowrap;
}

.open-link:hover,
.app-card-footer a:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.module-card.is-todo {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}

.module-card.is-todo h3 {
  color: var(--muted);
}

/* Application cards */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 14px;
}

.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-card-header {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.app-card-header .spec-label {
  font-weight: 700;
  font-size: 14px;
  min-width: 0;
}

.app-card-header .app-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* The app is laid out at 1280x720 and scaled to the box width (app-screen.js). */
.app-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: var(--screen);
  overflow: hidden;
  margin: 0 10px;
  border-radius: 4px;
}

.app-screen iframe {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 720px;
  border: 0;
  transform-origin: 0 0;
}

.app-card-footer {
  padding: 10px 14px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

.app-facts,
.app-card-footer > span {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.app-vc {
  font-family: var(--mono);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.apps-message {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--muted);
}

.apps-message::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
  flex: none;
}

/* Footer */
.page-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.page-footer .wrap {
  padding-block: 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
}

/* Narrow screens and reduced motion */
@media (max-width: 600px) {
  .wrap {
    padding-inline: 16px;
  }

  .internal-pill {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
