:root {
  --ink: #0b1020;
  --ink-deep: #050811;
  --ink-soft: #1b2440;
  --paper: #f3f6fc;
  --paper-deep: #e7ecf7;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --line: #d8e0ef;
  --line-strong: #bcc8de;
  --text: #172033;
  --muted: #5c6880;
  --muted-soft: #7c879c;
  --blue: #2f5fd0;
  --blue-soft: #e8eefc;
  --accent: #c26a1b;
  --accent-dark: #9a4f10;
  --accent-soft: #fdf0e2;
  --green: #1f6b52;
  --green-soft: #e4f3ec;
  --amber: #8a5a11;
  --amber-soft: #fbf0d8;
  --error: #a3332a;
  --error-soft: #fbeae7;
  --gold: #e7c47a;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(10, 18, 38, 0.05), 0 8px 24px rgba(10, 18, 38, 0.04);
  --shadow-md: 0 18px 50px rgba(10, 18, 38, 0.10);
  /* Clearance below page content for the fixed Portal Assistant bar. */
  --assistant-clearance: 6.75rem;
  --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Keyboard and anchor scrolling stop above the fixed assistant bar. */
  scroll-padding-bottom: calc(1.5rem + var(--assistant-clearance));
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 4%, rgba(47, 95, 208, 0.08), transparent 26rem),
    radial-gradient(circle at 10% 20%, rgba(231, 196, 122, 0.08), transparent 22rem),
    var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(5, 8, 17, 0.94);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

.brand__mark {
  position: relative;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(231, 196, 122, 0.55);
  border-radius: 50%;
  flex: 0 0 auto;
}

.brand__orbit {
  position: absolute;
  inset: 0.42rem 0.18rem;
  border: 1px solid rgba(126, 164, 255, 0.75);
  border-radius: 50%;
  transform: rotate(-28deg);
}

.brand__dot {
  position: absolute;
  width: 0.42rem;
  height: 0.42rem;
  right: 0.18rem;
  top: 0.95rem;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(231, 196, 122, 0.9);
}

.brand__copy {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
  min-width: 0;
}

.brand__name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__tagline {
  max-width: 32rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-link {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.header-link:hover,
.header-link:focus-visible {
  color: #fff;
  border-color: var(--gold);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.primary-nav__tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.primary-nav__tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.primary-nav__tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: 0.5rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--muted-soft);
}

.status-badge[data-tone="live"] .status-badge__dot {
  background: #4fd1a5;
  box-shadow: 0 0 10px rgba(79, 209, 165, 0.8);
}

.status-badge[data-tone="empty"] .status-badge__dot {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(231, 196, 122, 0.7);
}

.status-badge[data-tone="offline"] .status-badge__dot {
  background: #e08b82;
}

.header-status__meta {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, rgba(231, 196, 122, 0.16), transparent 18rem),
    radial-gradient(circle at 18% 88%, rgba(47, 95, 208, 0.35), transparent 26rem),
    linear-gradient(140deg, var(--ink-deep), var(--ink) 55%, var(--ink-soft));
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.hero::before {
  width: 34rem;
  height: 34rem;
  right: -12rem;
  top: -16rem;
}

.hero::after {
  width: 22rem;
  height: 22rem;
  left: -10rem;
  bottom: -14rem;
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 3.4rem 1.5rem 3.1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(16rem, 0.9fr);
  gap: 2.4rem;
  align-items: end;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--gold);
}

.hero__title {
  margin: 0;
  max-width: 18ch;
  font-size: clamp(2rem, 4.4vw, 3.65rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 750;
}

.hero__description {
  max-width: 58ch;
  margin: 1.15rem 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
}

.hero__note {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
}

.hero__note strong {
  display: block;
  color: var(--gold);
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.hero__note p {
  margin: 0.5rem 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.86rem;
  line-height: 1.55;
}

.scope-banner {
  max-width: 1320px;
  margin: 1.25rem auto 0;
  padding: 0.8rem 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
}

/* -------------------------------------------------------------- workspace */
.workspace {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem calc(3.5rem + var(--assistant-clearance));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.primary-panel {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  scroll-margin-top: 5.4rem;
  animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.explorer,
.assistant,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.explorer {
  padding: 1.5rem;
}

.assistant {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 55;
  width: min(50rem, calc(100vw - 2rem));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.assistant__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.6rem 0.55rem 1rem;
  background: var(--surface);
}

.assistant__mark {
  position: relative;
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.assistant__mark::after {
  content: "";
  position: absolute;
  width: 0.42rem;
  height: 0.42rem;
  right: 0.05rem;
  top: 0.72rem;
  background: var(--gold);
  border-radius: 50%;
}

.assistant__bar-copy {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.assistant__bar-title {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.assistant__bar-context {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assistant__bar-hint {
  color: var(--muted-soft);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assistant__toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 650;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.assistant__toggle:hover,
.assistant__toggle:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
  outline: none;
}

.assistant__toggle-icon {
  width: 0.48rem;
  height: 0.48rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(0.12rem) rotate(-135deg);
  transition: transform 0.15s ease;
}

.assistant[data-state="open"] .assistant__toggle-icon {
  transform: translateY(-0.12rem) rotate(45deg);
}

.assistant__panel {
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 38rem);
  overflow-y: auto;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
  animation: fade-in 0.18s ease-out;
}

.assistant__panel-head {
  margin-bottom: 0.55rem;
}

.assistant__panel-head .eyebrow {
  margin: 0;
}

.panel-stack {
  display: grid;
  gap: 1.4rem;
  align-content: start;
}

.panel {
  padding: 1.5rem;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.section-head--compact {
  margin-bottom: 0.9rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.section-head .eyebrow {
  margin-bottom: 0.3rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* --------------------------------------------------------------- toolbar */
.toolbar {
  display: flex;
  gap: 0.6rem;
}

.search-field {
  position: relative;
  flex: 1 1 auto;
}

.search-field__icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 0.78rem;
  height: 0.78rem;
  border: 1.8px solid var(--muted-soft);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.search-field__icon::after {
  content: "";
  position: absolute;
  width: 0.42rem;
  height: 1.8px;
  right: -0.3rem;
  bottom: -0.15rem;
  background: var(--muted-soft);
  border-radius: 2px;
  transform: rotate(45deg);
}

.search-field input {
  width: 100%;
  padding: 0.72rem 0.9rem 0.72rem 2.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.62rem 1rem;
  font-size: 0.85rem;
  font-weight: 650;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.button--primary:hover {
  background: #244fb4;
}

.button--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--muted);
}

.button--ghost:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.button--small {
  padding: 0.42rem 0.7rem;
  font-size: 0.76rem;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.filter-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.22rem;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.filter-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.34rem 0.66rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.filter-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(10, 18, 38, 0.06);
}

.filter-selects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.select-field {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.select-field__label {
  color: var(--muted-soft);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.select-field select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0.42rem 1.6rem 0.42rem 0.55rem;
  font-size: 0.76rem;
  max-width: 13rem;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.1rem 0 0.6rem;
}

.results-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.export-format {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.export-format__label {
  color: var(--muted-soft);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.export-format select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0.36rem 1.4rem 0.36rem 0.5rem;
  font-size: 0.74rem;
  max-width: 12rem;
}

.results {
  display: grid;
  gap: 1rem;
}

.result-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0.4rem 0 0.55rem;
}

.result-group__head h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.section-count {
  color: var(--muted-soft);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.card-grid {
  display: grid;
  /* min() keeps a 16rem card from overflowing a viewport narrower than it. */
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
  gap: 0.8rem;
}

.dataset-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 0.95rem;
  min-width: 0;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.dataset-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.dataset-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem 0.6rem;
  min-width: 0;
  margin-bottom: 0.55rem;
}

.dataset-card__title {
  flex: 1 1 12rem;
  min-width: 0;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.25;
  /* break-word wraps long tokens; it never shrinks the box to one character. */
  overflow-wrap: break-word;
  hyphens: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  white-space: nowrap;
}

/* Card chips wrap their label so the badge cannot push past the card edge. */
.dataset-card__chip {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  text-align: left;
  line-height: 1.3;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
  margin-bottom: 0.55rem;
}

.badge-row .badge {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
}

.badge {
  border-color: var(--line-strong);
  color: var(--text);
}

.badge--orbit-class {
  background: var(--blue-soft, var(--surface));
  border-color: var(--blue, var(--line-strong));
}

.badge--pha {
  background: var(--amber-soft, var(--surface));
  border-color: var(--amber, var(--line-strong));
}

.dataset-card__body {
  display: grid;
  gap: 0.32rem;
  flex: 1 1 auto;
  min-width: 0;
}

.data-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.1rem 0.7rem;
  min-width: 0;
  padding-bottom: 0.3rem;
  border-bottom: 1px dashed var(--line);
  font-size: 0.78rem;
}

.data-row:last-child {
  border-bottom: 0;
}

/* Both halves take a share of the row, so a long label can never starve the
   value (or the reverse) into a one-character column. */
.data-row__label {
  flex: 1 1 45%;
  min-width: 0;
  color: var(--muted-soft);
  overflow-wrap: break-word;
}

.data-row__value {
  flex: 1 1 45%;
  min-width: 0;
  max-width: 100%;
  color: var(--text);
  font-weight: 600;
  text-align: right;
  overflow-wrap: break-word;
}

.card-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}

.card-source__chip {
  max-width: 100%;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow-wrap: break-word;
}

.card-source__time {
  max-width: 100%;
  color: var(--muted-soft);
  font-size: 0.66rem;
  overflow-wrap: break-word;
}

.empty-state {
  position: relative;
  margin-top: 0.7rem;
  padding: 3rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(47, 95, 208, 0.06), transparent 16rem),
    var(--surface-soft);
}

.empty-state__orbit {
  display: block;
  width: 3.6rem;
  height: 3.6rem;
  margin: 0 auto 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  position: relative;
}

.empty-state__orbit::after {
  content: "";
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  right: 0.1rem;
  top: 1.4rem;
  background: var(--gold);
  border-radius: 50%;
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.empty-state p {
  max-width: 46ch;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state__note {
  margin-top: 0.8rem !important;
  color: var(--muted-soft) !important;
  font-size: 0.74rem !important;
}

.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

/* -------------------------------------------------------------- assistant */
.assistant__welcome {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--blue-soft);
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.assistant__welcome p {
  margin: 0 0 0.45rem;
}

.assistant__welcome p:last-child {
  margin-bottom: 0;
}

.assistant__messages {
  display: grid;
  gap: 0.6rem;
  max-height: 14rem;
  overflow-y: auto;
  margin-top: 0.8rem;
}

.chat-message {
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.chat-message--user {
  background: var(--ink);
  color: #fff;
  margin-left: 1.2rem;
}

.chat-message--assistant {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  margin-right: 0.6rem;
}

.chat-message__role {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

.chat-message__body {
  margin: 0;
  overflow-wrap: anywhere;
}

.assistant__form {
  margin-top: 0.85rem;
}

.assistant__form textarea {
  width: 100%;
  resize: vertical;
  min-height: 4.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-size: 0.82rem;
}

.assistant__form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.assistant__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.assistant__hint {
  color: var(--muted-soft);
  font-size: 0.65rem;
  line-height: 1.35;
}

.assistant__context {
  margin-top: 0.8rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  display: grid;
  gap: 0.25rem;
}

.assistant__context-label,
.assistant__starters-label {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.assistant__context-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.assistant__context .button {
  justify-self: start;
  margin-top: 0.2rem;
}

.assistant__starters {
  margin-top: 0.8rem;
}

.assistant__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.assistant__chip {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.assistant__chip:hover,
.assistant__chip:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
  outline: none;
}

.assistant__status {
  margin: 0.55rem 0 0;
  min-height: 1rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

/* ------------------------------------------------------------------ risk */
.panel-intro {
  max-width: 70ch;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.7rem;
}

.source-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.source-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.84rem;
}

.muted-note {
  margin: 0.8rem 0 0;
  color: var(--muted-soft);
  font-size: 0.78rem;
}

/* --------------------------------------------------- tables and row drawers */
.section-note {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: var(--text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
  line-height: 1.45;
}

.section-note strong {
  display: block;
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-note p {
  margin: 0.35rem 0 0;
}

.toolbar--compact {
  margin-top: 0.9rem;
}

.filter-bar--compact {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.toggle-field input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--blue);
}

.select-field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.select-field--inline .select-field__label {
  letter-spacing: 0.04em;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th,
.data-table td {
  padding: 0.48rem 0.65rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted-soft);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-sort {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.table-sort::after {
  content: "↕";
  opacity: 0.45;
  font-size: 0.7rem;
}

.data-table th[aria-sort="ascending"] .table-sort::after {
  content: "↑";
  opacity: 1;
  color: var(--blue);
}

.data-table th[aria-sort="descending"] .table-sort::after {
  content: "↓";
  opacity: 1;
  color: var(--blue);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table__row:hover {
  background: var(--surface-soft);
}

.data-table__drawer td {
  padding: 0.75rem;
  background: var(--paper-deep);
}

.col-designation {
  min-width: 11rem;
}

.cell-designation {
  font-weight: 600;
}

.cell-designation .cell-secondary {
  display: block;
  margin-top: 0.15rem;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cell-secondary {
  color: var(--muted-soft);
  font-size: 0.7rem;
  font-weight: 500;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.table-link {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-weight: 650;
  text-align: left;
  text-decoration: underline dotted;
  text-underline-offset: 0.16em;
}

.table-link:hover,
.table-link:focus-visible {
  color: var(--accent-dark);
}

.chip--status {
  margin-left: 0.4rem;
  text-transform: lowercase;
}

.row-drawer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.25rem 1rem;
}

.row-drawer .data-row {
  padding-bottom: 0.25rem;
}

.table-status {
  margin-top: 0.55rem;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.table-pager .muted-note {
  margin: 0;
}

/* ---------------------------------------------------------------- footer */
.site-footer {
  background: var(--ink-deep);
  color: rgba(255, 255, 255, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.8rem 1.5rem calc(2.2rem + var(--assistant-clearance));
  display: grid;
  gap: 0.35rem;
  font-size: 0.76rem;
}

.site-footer__inner p {
  margin: 0;
}

.site-footer__note {
  color: rgba(255, 255, 255, 0.5);
  max-width: 78ch;
}

.site-footer__notice {
  display: grid;
  gap: 0.4rem;
  max-width: 92ch;
  margin: 0.35rem 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.72rem;
  line-height: 1.5;
}

.site-footer__notice p {
  margin: 0;
}

.site-footer__notice strong {
  color: rgba(255, 255, 255, 0.78);
}

.link-button {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
}

.link-button:hover,
.link-button:focus-visible {
  color: #fff;
}

.site-footer__meta {
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.7rem;
}

.site-footer__meta a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.site-footer__meta a:hover,
.site-footer__meta a:focus-visible {
  color: #fff;
}

.site-footer__license {
  max-width: 78ch;
}

.noscript {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--error);
  color: #fff;
  font-size: 0.84rem;
  text-align: center;
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .primary-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.4rem;
  }

  .hero__title {
    max-width: 22ch;
  }
}

@media (max-width: 760px) {
  .site-header__inner {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }

  .header-status {
    margin-left: auto;
  }

  .header-status__meta {
    display: none;
  }

  .header-link {
    order: 2;
  }

  .brand__tagline {
    max-width: 15rem;
  }

  .hero__inner,
  .workspace {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .scope-banner {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .explorer,
  .panel {
    padding: 1rem;
  }

  .assistant {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    width: auto;
    transform: none;
    border-radius: var(--radius-md);
  }

  .assistant__bar {
    padding: 0.5rem 0.5rem 0.5rem 0.85rem;
  }

  .assistant__bar-hint {
    display: none;
  }

  .assistant__toggle {
    padding: 0.4rem 0.58rem;
    font-size: 0.7rem;
  }

  .assistant__panel {
    max-height: min(76vh, 32rem);
    padding: 0.85rem 0.85rem 0.9rem;
  }

  .assistant__messages {
    max-height: 11rem;
  }

  .toolbar {
    flex-direction: column;
  }

  .filter-bar {
    align-items: stretch;
  }

  .filter-tabs {
    overflow-x: auto;
    max-width: 100%;
  }

  .filter-selects {
    display: grid;
    grid-template-columns: 1fr;
  }

  .select-field select {
    max-width: none;
    width: 100%;
  }

  .results-head,
  .section-head,
  .table-pager {
    flex-wrap: wrap;
  }

  .toggle-field {
    white-space: normal;
  }

  .select-field--inline {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  /* One full-width card per row instead of a squeezed two-column grid. */
  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------ object drawer */
body.is-drawer-open {
  overflow: hidden;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 17, 0.58);
  backdrop-filter: blur(2px);
}

.drawer__panel {
  position: relative;
  width: min(760px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  box-shadow: -24px 0 60px rgba(5, 8, 17, 0.28);
  border-left: 1px solid var(--line);
  animation: drawer-in 0.18s ease-out;
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.drawer__head h2 {
  margin: 0.2rem 0 0;
  font-size: 1.3rem;
  line-height: 1.25;
}

.drawer__body {
  padding: 1rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.drawer__section {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 1rem;
}

.drawer__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.drawer__section-head h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.drawer__note {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.drawer__empty {
  margin: 0.25rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.drawer__link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.detail-grid .data-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
}

.snapshot-block {
  margin-bottom: 0.7rem;
}

.elements {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}

.element-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto auto auto;
  gap: 0.4rem;
  align-items: baseline;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.element-row__name {
  color: var(--muted);
}

.element-row__value {
  font-weight: 600;
  text-align: right;
}

.element-row__sigma,
.element-row__unit {
  color: var(--muted);
  font-size: 0.76rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  min-width: 0;
  margin-top: 0.6rem;
}

.card-actions .button {
  max-width: 100%;
  text-align: center;
  white-space: normal;
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.candidate {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  color: var(--text);
}

.candidate:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.candidate span {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ------------------------------------------------------- methodology modal */
body.is-modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 17, 0.62);
  backdrop-filter: blur(3px);
}

.modal__dialog {
  position: relative;
  width: min(840px, 100%);
  max-height: min(88vh, 920px);
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.modal__head h2 {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.modal__head .eyebrow {
  margin-bottom: 0.2rem;
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.1rem 1.4rem 2rem;
}

.modal__intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal__section {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.modal__section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.modal__section p {
  margin: 0.3rem 0;
  font-size: 0.84rem;
  line-height: 1.55;
}

.modal__table {
  width: 100%;
  margin-top: 0.45rem;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.modal__table th,
.modal__table td {
  padding: 0.4rem 0.45rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.modal__table th {
  color: var(--muted-soft);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal__table tbody tr:last-child td {
  border-bottom: 0;
}

.modal__note {
  color: var(--muted);
  font-size: 0.78rem !important;
}

.future-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

/* ---------------------------------------------------------- gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  text-align: left;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  outline: none;
}

.gallery-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--ink-soft);
  overflow: hidden;
}

.gallery-card__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.75rem;
  color: var(--paper);
  font-size: 0.72rem;
  text-align: center;
}

.gallery-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem 0.85rem 0.9rem;
}

.gallery-card__badge {
  align-self: flex-start;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-card__title {
  font-size: 0.92rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.gallery-card__tag {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

/* --------------------------------------------------------- gallery modal */
.modal__dialog--gallery {
  width: min(1120px, 100%);
  max-height: min(92vh, 1100px);
}

/* Expanded stage: a larger frame for the same asset. */
.modal__dialog--gallery.is-expanded {
  width: min(1720px, 97vw);
  max-height: 96vh;
}

.modal__dialog--gallery.is-expanded .gallery-stage {
  height: clamp(16rem, 82vh, 60rem);
}

.gallery-viewer {
  background: var(--ink-deep);
}

.gallery-viewer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.gallery-viewer__group {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.gallery-view__button {
  min-width: 2.15rem;
  padding: 0.28rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.25;
}

.gallery-view__button[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--text);
}

.gallery-view__button:disabled {
  opacity: 0.45;
  cursor: default;
}

.gallery-zoom__readout {
  min-width: 3.1rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.gallery-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Matches the old 62vh image cap so the default view is no smaller. */
  height: clamp(14rem, 62vh, 40rem);
  overflow: hidden;
  background: var(--ink-deep);
  cursor: zoom-in;
  /* Suppress selection here rather than via pointerdown preventDefault. */
  user-select: none;
}

/* Panning is only enabled once the scaled image actually overflows the stage. */
.gallery-stage.is-pannable {
  cursor: grab;
  touch-action: none;
}

.gallery-stage.is-panning {
  cursor: grabbing;
}

.gallery-stage.is-panning .gallery-hero__image {
  transition: none;
}

.gallery-hero__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: var(--ink-deep);
  transform-origin: center center;
  transition: transform 140ms cubic-bezier(0.22, 0.61, 0.36, 1);
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-stage--actual .gallery-hero__image {
  max-width: none;
  max-height: none;
}

.gallery-viewer__hint {
  margin: 0;
  padding: 0.4rem 0.7rem;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

.gallery-hero {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--ink-deep);
}

.gallery-hero__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 14rem;
  color: var(--paper);
  font-size: 0.85rem;
}

.gallery-hero__caption {
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.gallery-download {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.gallery-download__spec {
  margin: 0;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.gallery-download__button {
  text-decoration: none;
}

.gallery-download__checksum {
  margin: 0;
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .drawer__panel {
    width: 100%;
  }

  .drawer__head,
  .drawer__body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .modal {
    padding: 0.6rem;
  }

  .modal__dialog {
    max-height: 92vh;
    border-radius: var(--radius-md);
  }

  /* Keep the expanded dialog full width instead of clipping at the viewport. */
  .modal__dialog--gallery.is-expanded {
    width: 100%;
    max-height: 96vh;
  }

  .gallery-stage {
    height: clamp(11rem, 46vh, 26rem);
  }

  .modal__dialog--gallery.is-expanded .gallery-stage {
    height: clamp(12rem, 62vh, 30rem);
  }

  .modal__head,
  .modal__body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .element-row {
    grid-template-columns: 1fr auto;
  }

  .element-row__sigma,
  .element-row__unit {
    display: none;
  }
}
