/* Maryland Data Hub homepage. Plain CSS, no build step.

   Colors follow the Maryland Web Design System (MDWDS) palette, designsystem.maryland.gov >
   Foundation > Colors; the hex values are its --maryland-color-* tokens, noted beside each one.
   MDWDS has no dark theme, so dark mode uses the palette's lighter grades for text and accents on
   neutral dark surfaces. Every text/background pair here meets WCAG 2.1 AA (4.5:1; 3:1 for
   borders and focus rings) in both themes. The theme follows the browser unless the visitor
   picks one with the header toggle, which sets data-theme on <html>. */

@font-face {
  /* Source Sans 3, the successor to MDWDS's Source Sans Pro (SIL Open Font License, fonts/OFL-source-sans-3.txt) */
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-wght-normal.woff2?v=19143dca07") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-wght-italic.woff2?v=5fbc14d56c") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f0f0f0; /* base-lightest */
  --surface: #ffffff;
  --surface-2: #f0f0f0; /* base-lightest */
  --text: #1b1b1b; /* base-darkest */
  --text-2: #3d4551; /* base-darker */
  --muted: #565c65; /* base-dark */
  --border: #dfe1e2; /* base-lighter */
  --border-strong: #71767a; /* base: form borders need 3:1 */
  --primary: #005ea2; /* primary */
  --primary-hover: #1a4480; /* primary-dark */
  --primary-soft: #d9e8f6; /* primary-lighter */
  --on-primary: #ffffff;
  --link: #005ea2; /* primary */
  --gold-soft: #faf3d1; /* warning-lighter */
  --hero-tint: #d9e8f6; /* primary-lighter */
  --success: #216e1f; /* success-darker */
  --success-soft: #ecf3ec; /* success-lighter */
  --warning: #5c410a; /* accent-warm-darker */
  --warning-soft: #faf3d1; /* warning-lighter */
  --danger: #b50909; /* error-dark */
  --danger-soft: #f4e3db; /* error-lighter */
  --focus: #0050d8; /* primary-vivid */
  --shadow-sm: 0 1px 2px rgba(27, 27, 27, 0.06);
  --shadow: 0 1px 2px rgba(27, 27, 27, 0.05), 0 6px 20px rgba(27, 27, 27, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1b1b; /* base-darkest */
    --surface: #252525;
    --surface-2: #2e2e2e;
    --text: #f0f0f0; /* base-lightest */
    --text-2: #dfe1e2; /* base-lighter */
    --muted: #a9aeb1; /* base-light */
    --border: #3d4551; /* base-darker */
    --border-strong: #71767a; /* base */
    --primary: #73b3e7; /* primary-light */
    --primary-hover: #97d4ea; /* accent-cool-light */
    --primary-soft: #162e51; /* primary-darker */
    --on-primary: #162e51; /* primary-darker */
    --link: #73b3e7; /* primary-light */
    --gold-soft: #5c410a; /* accent-warm-darker */
    --hero-tint: #1e2a3b; /* primary-darker blended 50% with the surface, for 4.5:1 small text */
    --success: #ecf3ec; /* success-lighter */
    --success-soft: #216e1f; /* success-darker */
    --warning: #fee685; /* warning-light */
    --warning-soft: #5c410a; /* accent-warm-darker */
    --danger: #f4e3db; /* error-lighter */
    --danger-soft: #6f3331; /* error-darker */
    --focus: #73b3e7; /* primary-light */
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1b1b;
  --surface: #252525;
  --surface-2: #2e2e2e;
  --text: #f0f0f0;
  --text-2: #dfe1e2;
  --muted: #a9aeb1;
  --border: #3d4551;
  --border-strong: #71767a;
  --primary: #73b3e7;
  --primary-hover: #97d4ea;
  --primary-soft: #162e51;
  --on-primary: #162e51;
  --link: #73b3e7;
  --gold-soft: #5c410a;
  --hero-tint: #1e2a3b;
  --success: #ecf3ec;
  --success-soft: #216e1f;
  --warning: #fee685;
  --warning-soft: #5c410a;
  --danger: #f4e3db;
  --danger-soft: #6f3331;
  --focus: #73b3e7;
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  color-scheme: dark;
}

/* Base ------------------------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
main,
main:focus-visible {
  flex: 1;
  outline: none;
}
h1,
h2,
h3,
h4 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(2rem, 3.6vw, 2.75rem); /* MDWDS: 32px mobile up to 48px desktop */
  font-weight: 700;
}
h2 {
  font-size: clamp(1.5rem, 2.4vw, 1.75rem);
  font-weight: 700;
}
h3,
h4 {
  font-size: 1.15rem;
  font-weight: 700;
}
p {
  margin: 0 0 0.75rem;
}
a {
  color: var(--link);
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-thickness: 2px;
}
code,
pre {
  font-family: var(--mono);
  font-size: 0.88em;
}
code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Page and section headings take focus after navigation so screen readers announce them; they aren't controls. */
:is(h1, h2, h3)[tabindex="-1"]:focus {
  outline: none;
}
[hidden] {
  display: none !important;
}
[id^="help-"],
[id^="add-data-"],
[id^="ai-"],
[id^="best-practices-"],
[id^="sample-"] {
  scroll-margin-top: 84px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: var(--surface);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.skip-link:focus {
  top: 0.75rem;
}
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 720px) {
  .container {
    padding: 0 28px;
  }
}
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

/* Header ---------------------------------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
@media (min-width: 720px) {
  .topbar-inner {
    padding: 0 28px;
  }
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0;
}
.brand-mark {
  /* The official MDWDS flag mark (img/md_logo.svg), shown unaltered */
  height: 32px;
  width: auto;
  flex: none;
}
.brand-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover {
  background: var(--surface-2);
}
.theme-toggle .icon {
  width: 20px;
  height: 20px;
}
.theme-toggle .icon-sun,
:root[data-effective-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}
:root[data-effective-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}
.nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}
.nav a {
  color: var(--text-2);
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-weight: 550;
  font-size: 0.95rem;
  white-space: nowrap;
}
.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav .nav-account,
.nav .nav-signout {
  display: none; /* shown in the mobile menu, where the account chip and Sign out are hidden */
}
.topbar .signout {
  flex: none;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.95rem;
  padding: 0.25rem 0.6rem 0.25rem 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
}
.user-chip:hover {
  background: var(--surface-2);
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
}
/* Drawn here rather than as text, so the account link's visible text is just the name. */
.avatar::before {
  content: attr(data-initials);
}
.nav-toggle {
  display: none;
}
@media (max-width: 1100px) {
  .user-name {
    display: none;
  }
  .user-chip {
    padding: 0.2rem;
  }
}
/* The menu plus Sign out needs about 1000px, so the menu collapses below 960px. */
@media (max-width: 960px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .nav-toggle {
    /* Source order (menu, then theme, account and Sign out) is also the keyboard order. */
    display: inline-grid;
    place-items: center;
    margin-left: auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
  }
  .nav-toggle::before {
    content: "";
    width: 18px;
    height: 12px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
  }
  .nav {
    display: none;
    order: 10;
    width: 100%;
    flex-direction: column;
    margin: 0 0 0.75rem;
  }
  .nav.open {
    display: flex;
  }
  .nav a {
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
  }
  .user-chip {
    order: 3;
  }
  .topbar .signout {
    order: 4;
  }
  .nav .nav-account,
  .nav .nav-signout {
    display: block;
  }
}
/* Reflow down to 320px wide (WCAG 1.4.10): smaller logo, account chip and Sign out move into the menu. */
@media (max-width: 560px) {
  .brand-mark {
    height: 28px;
  }
  .brand-text {
    font-size: 1.15rem;
  }
  .user-chip,
  .topbar .signout {
    display: none;
  }
}
@media (max-width: 380px) {
  .topbar-inner {
    gap: 0.4rem;
    padding: 0 12px;
  }
  .brand {
    gap: 0.4rem;
  }
  .brand-mark {
    height: 24px;
  }
  .brand-text {
    font-size: 1.05rem;
  }
  .theme-toggle,
  .nav-toggle {
    width: 36px;
    height: 36px;
  }
}

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

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}
.footer-inner p {
  margin: 0;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: center;
}
.link-button {
  font: inherit;
  color: var(--link);
  background: none;
  border: 0;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.env-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--warning-soft);
  color: var(--warning);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* Page scaffolding ------------------------------------------------------------------------ */

.page {
  padding-top: 2rem;
}
.page-header {
  margin-bottom: 1.75rem;
  max-width: 820px;
}
/* Such as a page's main button above its "On this page" links. */
.page-header .row + .row {
  margin-top: 1rem;
}
/* "On this page" links: a label, then bold text links split by a divider rather than chips, like
   the Maryland Data Academy pages. The underline shows on hover and focus. The divider is a
   border, so screen readers don't read it out; the nav's aria-label names the list for them. */
.row.page-nav {
  gap: 0.4rem 0.75rem;
}
.page-nav-label {
  color: var(--text-2);
}
.page-nav a {
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}
.page-nav a + a {
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-strong);
}
.page-nav a:hover,
.page-nav a:focus-visible {
  color: var(--primary-hover);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.lead {
  font-size: 1.1rem;
  color: var(--text-2);
}
.section {
  margin-top: 2.75rem;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.section-head h2 {
  margin: 0;
}
.section-head p {
  margin: 0.25rem 0 0;
  color: var(--text-2);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.88rem;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.breadcrumb a {
  color: var(--text-2);
}
.breadcrumb .sep {
  opacity: 0.6;
}
.grid {
  display: grid;
  gap: 1rem;
}
/* At most two columns, and two down to the width where .grid-3 also has two. */
.grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(300px, calc((100% - 1rem) / 2))), 1fr));
}
.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}
/* Four cards in one row where each gets 230px; narrower, .grid-2's two by two, never three and one. */
@media (min-width: 1024px) {
  .grid-2.four-across {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.stack > * + * {
  margin-top: 0.75rem;
}

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

.hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 55%, var(--hero-tint) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(1.5rem, 4vw, 3rem);
  margin-top: 1.75rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero h1 {
  max-width: 760px;
}
/* The app's homepage heading is a short line about the page, so the chat starts higher up. */
.hero-top h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2rem);
}
.hero-top + .lead {
  margin-top: 0.6rem;
}
.hero .lead {
  max-width: 680px;
}
.search-form {
  display: flex;
  gap: 0.5rem;
  max-width: 680px;
  margin-top: 1.25rem;
}
.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-field .icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-field input[type="search"] {
  width: 100%;
  padding: 0.8rem 0.9rem 0.8rem 2.6rem;
}
.quick-searches {
  margin-top: 0.85rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

/* Genie One chat in the hero, the full width of the card: questions on the right, answers in
   cards, the question box below. */
.genie-chat {
  margin-top: 1.25rem;
}
.genie-thread:not(:empty) {
  margin-bottom: 1rem;
}
.genie-turn + .genie-turn {
  margin-top: 1.25rem;
}
.genie-question {
  width: fit-content;
  max-width: 85%;
  margin: 0 0 0.6rem auto;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius) var(--radius) var(--radius-sm) var(--radius);
  background: var(--primary-soft);
  color: var(--text);
  /* A heading, so screen readers can jump between turns, but it reads as a chat message. */
  font-size: 1rem;
  line-height: 1.55;
  letter-spacing: normal;
  font-weight: 600;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.genie-answer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.genie-answer > * + * {
  margin-top: 0.85rem;
}
.genie-answer .prose {
  max-width: none;
}
.genie-answer .prose p:last-child,
.genie-answer .prose ul:last-child,
.genie-answer .prose ol:last-child {
  margin-bottom: 0;
}
.genie-answer .results {
  margin-top: 0.85rem;
}
/* The spinner centered on the note's first line; a longer note wraps beside it, not under it. */
.genie-progress {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.genie-progress .spinner {
  margin-top: calc((1lh - 1em) / 2);
}
.genie-code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.genie-sources ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  overflow-wrap: anywhere;
}
.genie-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
/* One line, as tall as the Ask button, growing with the question (genie-chat.js) up to six lines,
   then scrolling. */
.genie-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: calc(6 * 1.4em + 1.2rem + 2px);
  overflow-y: auto;
  resize: none;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
}
.genie-form textarea::placeholder {
  color: var(--muted);
}
.genie-form textarea:focus {
  outline: 3px solid var(--focus);
  outline-offset: 0;
  border-color: transparent;
}
.genie-starters,
.genie-actions {
  margin-top: 0.85rem;
}
/* Under the Ask button, apart from the Continue in Genie One note. */
.genie-new {
  margin-left: auto;
}
.genie-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.genie-tablist {
  display: flex;
  flex-wrap: wrap;
}
.genie-tab {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 0.55rem 0.8rem;
  min-height: 44px;
  cursor: pointer;
}
.genie-tab:hover {
  color: var(--text);
}
.genie-tab[aria-selected="true"] {
  color: var(--link);
  border-bottom-color: var(--link);
}
.genie-tabs .btn {
  margin-bottom: 0.35rem;
}
.genie-examples {
  padding-top: 0.85rem;
}
.genie-examples > p {
  margin: 0 0 0.6rem;
}
.genie-more {
  margin-top: 0.5rem;
  min-height: 44px;
}
.genie-footnote {
  margin: 0.85rem 0 0;
}

/* Chat history: a modal <dialog> shown as a panel along the right edge of the page. */
.genie-history {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(400px, 100vw);
  height: 100%;
  max-width: 100vw;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.genie-history::backdrop {
  background: rgba(27, 27, 27, 0.45);
}
@media (prefers-reduced-motion: no-preference) {
  .genie-history[open] {
    animation: slide-in-right 0.2s ease-out;
  }
}
@keyframes slide-in-right {
  from {
    transform: translateX(100%);
  }
}
body:has(.genie-history[open]) {
  overflow: hidden;
}
.genie-history-body {
  height: 100%;
  overflow-y: auto;
  padding: 1.25rem;
}
.genie-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.genie-history-head h2 {
  margin: 0;
  font-size: 1.35rem;
}
.genie-history-list {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
}
.genie-history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.genie-history-item:hover {
  background: var(--surface-2);
}
.genie-history-item[aria-current="true"] {
  background: var(--primary-soft);
}
.genie-history-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Inputs and buttons ---------------------------------------------------------------------- */

input[type="search"],
input[type="text"],
select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  min-height: 44px;
}
input::placeholder {
  color: var(--muted);
}
input:focus,
select:focus {
  outline: 3px solid var(--focus);
  outline-offset: 0;
  border-color: transparent;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 42px;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-2);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--link);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.btn-ghost:hover {
  background: var(--primary-soft);
}
/* At the narrowest widths a long label wraps rather than pushing the page sideways (WCAG 1.4.10). */
@media (max-width: 380px) {
  .btn {
    white-space: normal;
  }
}
.btn-sm {
  min-height: 34px;
  padding: 0.3rem 0.7rem;
  font-size: 0.88rem;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-2);
}
.chip .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip-question {
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  justify-content: space-between;
}

/* Pills ----------------------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.3;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.pill .icon {
  width: 1em;
  height: 1em;
}
.pill-open {
  background: var(--success-soft);
  color: var(--success);
}
.pill-locked,
.pill-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.pill-none {
  background: var(--surface-2);
  color: var(--muted);
}
.pill-info {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Cards ----------------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card h3,
.card h4 {
  margin-bottom: 0.35rem;
}
.card p:last-child {
  margin-bottom: 0;
}
a.card,
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
a.card:hover,
.card-link:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: no-preference) {
  a.card:hover {
    transform: translateY(-1px);
  }
}
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
/* Beside a card's icon, a long pill wraps instead of running out of a narrow card. The radius
   still rounds a one-line pill fully. */
.card-top .pill {
  min-width: 0;
  white-space: normal;
  border-radius: 0.9rem;
}
.icon-tile {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}
.icon-tile .icon {
  width: 22px;
  height: 22px;
}
.icon-tile.gold {
  background: var(--gold-soft);
  color: var(--warning);
}
.card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.card-footer .grow {
  flex: 1;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.card.action-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.action-card .arrow {
  margin-left: auto;
  color: var(--muted);
  align-self: center;
}
.action-card p {
  color: var(--text-2);
  font-size: 0.95rem;
}
.examples {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.6rem;
}
.callout {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--text);
  border: 1px solid transparent;
}
.callout .icon {
  margin-top: 0.15rem;
  color: var(--primary);
}
.callout-warning {
  background: var(--warning-soft);
}
.callout-warning .icon {
  color: var(--warning);
}
.callout-danger {
  background: var(--danger-soft);
}
.callout-danger .icon {
  color: var(--danger);
}
.callout p {
  margin: 0;
}
.callout .row {
  margin-top: 0.6rem;
}
.section-note {
  margin-top: 1rem;
}
/* Rules beside a section's options, in the warning callout's colors. */
.card-warning {
  background: var(--warning-soft);
}
.card-warning .icon-tile {
  background: var(--surface);
}
.card .prose + .label {
  margin-top: 1rem;
}

/* Lists of datasets ----------------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
}
.toolbar .search-field {
  flex: 1 1 260px;
}
.toolbar .search-field input[type="search"] {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.toolbar select {
  flex: 0 1 240px;
  min-width: 0;
}
.check-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
}
.check-field input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--primary);
}
.result-count {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 0.75rem;
}
.dataset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.dataset-list li + li {
  border-top: 1px solid var(--border);
}
.dataset-item {
  display: flex;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  color: inherit;
  text-decoration: none;
}
.dataset-item:hover {
  background: var(--surface-2);
}
.dataset-item .icon-tile {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}
.dataset-item .icon-tile .icon {
  width: 18px;
  height: 18px;
}
.dataset-main {
  min-width: 0;
  flex: 1;
}
.dataset-title {
  font-weight: 650;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.dataset-summary {
  color: var(--text-2);
  font-size: 0.93rem;
  margin: 0.15rem 0 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dataset-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.dataset-meta code {
  font-size: 0.8rem;
}
/* All collections: a catalog row that opens to show its schemas. */
.catalog-group summary {
  cursor: pointer;
  list-style: none;
}
.catalog-group summary::-webkit-details-marker {
  display: none;
}
.catalog-group .chevron {
  flex: none;
  align-self: center;
  color: var(--muted);
  transition: transform 0.15s;
}
.catalog-group[open] .chevron {
  transform: rotate(180deg);
}
.catalog-group-body {
  padding: 0 1.15rem 0.5rem calc(2.15rem + 38px);
}
.show-more {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

/* Dataset page ---------------------------------------------------------------------------- */

.title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}
.title-row h1 {
  margin-bottom: 0.25rem;
}
header.title-row {
  justify-content: space-between;
  align-items: flex-start;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin: 1.25rem 0;
}
/* The deprecated and locked notices sit between the facts and the action buttons: the same gap below them. */
.lifecycle-note,
.access-note {
  margin-bottom: 1.25rem;
}
.fact {
  padding: 0.85rem 1.1rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0 -1px -1px 0;
  min-width: 0;
}
.fact dt {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fact dd {
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
}
.prose {
  max-width: 780px;
  color: var(--text-2);
}
.prose ul,
.prose ol {
  padding-left: 1.3rem;
  margin: 0 0 0.75rem;
}
.prose li + li {
  margin-top: 0.3rem;
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  overflow-x: auto;
}
.prose pre code {
  border: 0;
  background: none;
  padding: 0;
}

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

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: auto;
  max-height: 560px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
th,
td {
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-weight: 650;
  color: var(--text-2);
  white-space: nowrap;
  z-index: 1;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
td.null {
  color: var(--muted);
  font-style: italic;
}
td .cell-text {
  display: block;
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-cell {
  position: relative;
}
.bar-cell .bar {
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  background: var(--primary-soft);
  border-radius: 0 4px 4px 0;
  z-index: 0;
}
.bar-cell span {
  position: relative;
  z-index: 1;
}
.results {
  margin-top: 1rem;
}
.results-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.5rem;
}
.columns-table td:first-child {
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}
.columns-table .type {
  white-space: nowrap;
}
.sql-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre;
}
.sql-block code {
  border: 0;
  background: none;
  padding: 0;
  font-size: inherit;
}
.table-wrap.full {
  max-height: none;
}

/* Embeds ---------------------------------------------------------------------------------- */

.embed-frame {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: block;
}
.embed-dashboard {
  height: clamp(640px, calc(100vh - 230px), 1100px);
}
.embed-note {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

/* Dashboards ------------------------------------------------------------------------------ */

.dash-card {
  display: flex;
  flex-direction: column;
}
.dash-card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  color: var(--text-2);
  font-size: 0.93rem;
}
.dash-card .card-actions {
  margin-top: auto;
  padding-top: 1rem;
}
/* The example prompt on each Use AI card, as on the public website. */
/* A quotation, not a box: boxed examples look like the homepage's clickable question chips. */
.example-prompt {
  margin: 0.4rem 0 0;
  padding: 0.1rem 0 0.1rem 0.75rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text-2);
  font-style: italic;
}
.dash-card .questions-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.9rem;
}

/* Help ------------------------------------------------------------------------------------ */

/* Numbered steps. The list sits inside a .card rather than being one, so the list reset
   (padding: 0) can't strip the card's padding. Each step: number badge | title, text, link. */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 1rem;
  padding: 1.1rem 0;
}
.steps li:first-child {
  padding-top: 0;
}
.steps li:last-child {
  padding-bottom: 0;
}
.steps li + li {
  border-top: 1px solid var(--border);
}
.steps li::before {
  content: counter(step);
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: var(--text);
  font-weight: 700;
}
.steps li > * {
  grid-column: 2;
}
.steps h3 {
  margin: 0.3rem 0 0.3rem; /* centers the title on the badge */
}
.steps .prose p {
  margin-bottom: 0.65rem;
}
.steps .btn {
  justify-self: start;
}
.faq-group + .faq-group {
  margin-top: 1.75rem;
}
.faq-group h3 {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
details.faq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
details.faq + details.faq {
  margin-top: 0.5rem;
}
details.faq summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
}
details.faq summary::-webkit-details-marker {
  display: none;
}
details.faq summary .icon {
  transition: transform 0.15s;
  color: var(--muted);
}
details.faq[open] summary .icon {
  transform: rotate(180deg);
}
details.faq .prose {
  padding: 0 1rem 0.5rem;
}
details.plain summary {
  cursor: pointer;
  color: var(--link);
  font-weight: 600;
}
.glossary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 0.75rem;
  margin: 0;
}
.glossary > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.glossary dt {
  font-weight: 650;
}
.glossary dd {
  margin: 0.25rem 0 0;
  color: var(--text-2);
  font-size: 0.94rem;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
}
.label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tag-list li {
  font-size: 0.88rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.tag-list li.indirect {
  border-style: dashed;
}
.ent-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ent-list li + li {
  margin-top: 0.5rem;
}
.ent-list strong {
  display: block;
  font-size: 0.92rem;
}
.ent-list span {
  color: var(--text-2);
  font-size: 0.9rem;
}

/* Feedback -------------------------------------------------------------------------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2));
  background-size: 200% 100%;
  border-radius: 8px;
  height: 1rem;
  margin-bottom: 0.75rem;
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: shimmer 1.3s linear infinite;
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.skeleton-title {
  height: 2.2rem;
  width: min(420px, 70%);
  margin-bottom: 1rem;
}
.skeleton-line.short {
  width: 55%;
}
.skeleton-card {
  height: 150px;
  border-radius: var(--radius);
}
.page-loading {
  padding-top: 2.5rem;
}
.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  /* Centered on the text beside it, as .icon is. */
  vertical-align: -0.2em;
}
@media (prefers-reduced-motion: no-preference) {
  .spinner {
    animation: spin 0.8s linear infinite;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 1rem);
  background: var(--text);
  color: var(--bg);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 600px) {
  .search-form,
  .genie-form {
    flex-direction: column;
    align-items: stretch;
  }
  .genie-question {
    max-width: 100%;
  }
  .genie-new {
    margin-left: 0;
  }
  /* Your chats wraps under the greeting here; keep it off the lead. */
  .hero-top {
    margin-bottom: 0.75rem;
  }
  .dataset-item .icon-tile {
    display: none;
  }
  .catalog-group-body {
    padding-left: 1.15rem;
  }
  .card {
    padding: 1rem;
  }
}

/* People who ask their system for less motion get none (WCAG 2.3.3). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
