/* ── Explore Workspace Layout ──────────────────────────────────
 * Semantic operations UI. Full viewport takeover on operation run.
 * ──────────────────────────────────────────────────────────── */

/* ── Viewport lock ── */
body:has(.ex-workspace) {
  overflow: hidden;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

body:has(.ex-workspace) main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ── Workspace ── */
.ex-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Workbench (disclosure <details>) ── */
.ex-workbench {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.ex-workbench-header {
  list-style: none;
  cursor: pointer;
  padding: 16px 32px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.ex-workbench-header::-webkit-details-marker {
  display: none;
}

.ex-workbench-header::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--text-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.ex-workbench[open] > .ex-workbench-header::before {
  transform: rotate(90deg);
}

.ex-workbench[open] > .ex-workbench-header {
  padding-bottom: 4px;
}

.ex-workbench > .ex-slots,
.ex-workbench > .ex-controls,
.ex-workbench > .ex-help-tray {
  padding: 0 32px;
}

.ex-workbench > .ex-slots {
  padding-top: 12px;
}

.ex-workbench > .ex-controls {
  padding-bottom: 16px;
}

.ex-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

.ex-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  letter-spacing: 0.01em;
}

/* ── Slots ── */
.ex-slots {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.ex-slot {
  flex: 1;
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-alt);
  min-height: 72px;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.ex-slot--inactive {
  opacity: 0.35;
  pointer-events: none;
}

.ex-slot:focus-within {
  border-color: var(--session-color, #00b7f2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--session-color, #00b7f2) 25%, transparent);
}

.ex-slot-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--session-color, var(--text-muted));
  margin-bottom: 0;
  margin-right: 8px;
}

.ex-slot-hint {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  opacity: 0.5;
}

.ex-slot.filled .ex-slot-hint {
  display: none;
}

.ex-slot-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  outline: none;
  padding: 0;
}

.ex-slot-input::placeholder {
  color: var(--text-subtle);
  font-size: 13px;
}

.ex-slot-card {
  display: none;
}

.ex-slot.filled .ex-slot-input {
  display: none;
}

.ex-slot.filled .ex-slot-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ex-slot-clear {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.15s;
}

.ex-slot-clear:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.ex-slot.filled .ex-slot-clear {
  display: block;
}

.ex-slot-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
}

.ex-slot-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ex-slot-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.ex-slot-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* ── Controls (operations + facets) ── */
.ex-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ex-controls-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ex-controls-group--right {
  align-items: flex-end;
}

.ex-controls-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ex-operations {
  display: flex;
  gap: 6px;
}

.ex-op-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.ex-op-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--hover-bg);
}

.ex-op-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ex-op-btn.active {
  border-color: var(--session-color, #00b7f2);
  color: var(--session-color, #00b7f2);
  background: color-mix(in srgb, var(--session-color, #00b7f2) 8%, var(--surface));
}

/* Info trigger on operation buttons */
.ex-op-info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
  transition: color 0.15s;
}

.ex-op-btn:hover .ex-op-info-trigger {
  color: var(--text-tertiary);
}

.ex-facets {
  display: flex;
  gap: 4px;
}

.ex-facet-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
}

.ex-facet-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.ex-facet-pill.active {
  border-color: var(--session-color, #00b7f2);
  color: var(--session-color, #00b7f2);
  background: color-mix(in srgb, var(--session-color, #00b7f2) 6%, transparent);
}

.ex-facet-pill:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Accuracy ── */
.ex-accuracy-row {
  margin-top: 8px;
}

.ex-accuracy-row .ex-controls-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ex-accuracy {
  display: flex;
  gap: 4px;
}

.ex-accuracy-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
}

.ex-accuracy-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.ex-accuracy-pill.active {
  border-color: var(--session-color, #00b7f2);
  color: var(--session-color, #00b7f2);
  background: color-mix(in srgb, var(--session-color, #00b7f2) 6%, transparent);
}

.ex-accuracy-info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: help;
  padding: 0;
  transition: color 0.15s;
}

.ex-accuracy-info-trigger:hover {
  color: var(--text-tertiary);
}

/* ── Help Tray ── */
.ex-help-tray {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.ex-help-tray.visible {
  max-height: 300px;
  opacity: 1;
  margin-top: 12px;
  margin-bottom: 16px;
}

.ex-help-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--session-color, #00b7f2) 4%, var(--surface-alt));
  border: 1px solid color-mix(in srgb, var(--session-color, #00b7f2) 15%, var(--border));
  border-radius: 6px;
  animation: ex-help-in 0.2s ease;
}

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

.ex-help-icon {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1.2;
  opacity: 0.6;
}

.ex-help-body {
  flex: 1;
  min-width: 0;
}

.ex-help-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.ex-help-what {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 2px;
}

.ex-help-why {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
  font-style: italic;
}

.ex-help-try {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  color: var(--session-color, #00b7f2);
  text-decoration: none;
  transition: opacity 0.15s;
}

.ex-help-try:hover {
  opacity: 0.8;
}

.ex-help-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}

.ex-help-dismiss:hover {
  color: var(--text);
}

.ex-help-card--wide .ex-help-what {
  line-height: 1.5;
}

/* ── Results area ── */
.ex-results-wrap {
  flex: 1;
  position: relative;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ex-results {
  padding: 24px 32px;
}

.ex-results:empty {
  display: none;
}

/* ── Welcome / Empty State ── */
.ex-welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 32px;
}

.ex-welcome.hidden {
  display: none;
}

.ex-welcome-inner {
  max-width: 480px;
  text-align: center;
}

.ex-welcome-heading {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 8px;
}

.ex-welcome-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.ex-welcome-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}

.ex-welcome-example-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ex-welcome-example-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding-left: 2px;
}

.ex-welcome-link {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.ex-welcome-link:hover {
  border-color: var(--session-color, #00b7f2);
  background: color-mix(in srgb, var(--session-color, #00b7f2) 6%, var(--surface-alt));
}

.ex-welcome-link-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  grid-column: 1;
  grid-row: 1;
}

.ex-welcome-link-desc {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-tertiary);
  grid-column: 1;
  grid-row: 2;
}

.ex-welcome-link-arrow {
  font-size: 14px;
  color: var(--text-muted);
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  transition: color 0.15s, transform 0.15s;
}

.ex-welcome-link:hover .ex-welcome-link-arrow {
  color: var(--session-color, #00b7f2);
  transform: translateX(2px);
}

/* ── Context menu (right-click / long-press) ── */
.ex-context-menu {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  min-width: 160px;
}

.ex-context-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
}

.ex-context-menu-item:hover {
  background: var(--surface-alt);
}

.ex-context-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Loading overlay ── */
.ex-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  z-index: 10;
}

.ex-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--session-color, #00b7f2);
  border-radius: 50%;
  animation: ex-spin 0.6s linear infinite;
}

@keyframes ex-spin {
  to { transform: rotate(360deg); }
}

/* ── Bridge result: journey with discrete waypoints ── */

/* Outer container: matches Axis visual language */
.ex-bridge-strip {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  overflow: hidden;
}

/* ── Pole labels: inline in the journey as Start/End waypoints ── */
.ex-bridge-pole-letter {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--session-color, #00b7f2);
  opacity: 0.7;
  margin-bottom: 1px;
}

.ex-bridge-pole-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* ── Journey area: vertical stepping path ── */
.ex-bridge-journey {
  padding: 20px 24px 24px;
}

/* Pole waypoints need less bottom padding (no cards) */
.ex-bridge-waypoint--pole .ex-bridge-waypoint-content {
  padding-bottom: 12px;
}

/* Each waypoint row: marker column + content */
.ex-bridge-waypoint {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0 12px;
  min-height: 0;
}

/* Left column: vertical track with dot */
.ex-bridge-track-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* The dot on the track */
.ex-bridge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--session-color, #00b7f2);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

/* Pole dots are slightly larger */
.ex-bridge-dot--pole {
  width: 12px;
  height: 12px;
  margin-top: 2px;
}

/* Connecting line between dots (inside the track cell) */
.ex-bridge-stem {
  width: 2px;
  flex: 1;
  background: color-mix(in srgb, var(--session-color, #00b7f2) 35%, transparent);
  min-height: 16px;
}

/* Right column: waypoint label + artwork cards */
.ex-bridge-waypoint-content {
  padding-bottom: 20px;
}

/* Last waypoint: no bottom padding (no stem follows) */
.ex-bridge-waypoint:last-child .ex-bridge-waypoint-content {
  padding-bottom: 4px;
}

/* Waypoint label row: step number + t-value */
.ex-bridge-step-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.ex-bridge-step-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.ex-bridge-step-t {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Artwork cards within a step: horizontal flow, wrapping */
.ex-bridge-step-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Bridge cards are larger than default ex-card (120px vs 100px)
   since they are primary content, not auxiliary to a track */
.ex-bridge-step-cards .ex-card {
  width: 120px;
}

/* ── Responsive: narrow viewports ── */
@media (max-width: 600px) {
  .ex-bridge-journey {
    padding: 16px 16px 20px;
  }

  .ex-bridge-waypoint {
    grid-template-columns: 36px 1fr;
    gap: 0 8px;
  }
}

/* ── Contrast result: grid with score bars ── */
.ex-contrast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.ex-contrast-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-alt);
  transition: border-color 0.15s;
}

.ex-contrast-card:hover {
  border-color: var(--border-strong);
}

.ex-contrast-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.ex-contrast-info {
  padding: 8px;
}

.ex-contrast-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-contrast-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ex-contrast-bar {
  height: 4px;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.ex-contrast-bar-label {
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ── Axis result: horizontal projection strip ── */

/* Outer container: stacked layout with generous internal space */
.ex-axis-strip {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  overflow: hidden;
}

/* ── Poles row: dedicated space at top ── */
.ex-axis-poles {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 24px 12px;
  gap: 24px;
}

.ex-axis-pole {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 45%;
}

.ex-axis-pole--b {
  flex-direction: row-reverse;
  text-align: right;
}

.ex-axis-pole-marker {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--session-color, #00b7f2);
  opacity: 0.8;
}

.ex-axis-pole-text {
  min-width: 0;
}

.ex-axis-pole-letter {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--session-color, #00b7f2);
  opacity: 0.7;
  margin-bottom: 1px;
}

.ex-axis-pole-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Divider between poles row and visualization */
.ex-axis-divider {
  height: 1px;
  background: var(--border);
  margin: 0 24px;
}

/* ── Visualization area: track + items + ticks ── */
.ex-axis-viz {
  position: relative;
  /* Top: space for thumbnails (56px img + 16px stem + ~14px title + 8px gap = 94px).
     Left/right: 44px to prevent edge items (72px/2 = 36px centered) from clipping.
     Bottom: space for tick marks (17px) + density labels (16px) + margin. */
  padding: 96px 44px 44px;
}

/* ── Track: the axis line ── */
.ex-axis-track {
  position: relative;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
}

/* Gradient overlay on track showing direction */
.ex-axis-track::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1px;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--session-color, #00b7f2) 40%, transparent),
    color-mix(in srgb, var(--session-color, #00b7f2) 8%, transparent) 50%,
    color-mix(in srgb, var(--session-color, #00b7f2) 40%, transparent)
  );
}

/* Endpoint dots on the track */
.ex-axis-endpoint {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--session-color, #00b7f2);
  transform: translate(-50%, -50%);
  z-index: 2;
}

.ex-axis-endpoint--a { left: 0; }
.ex-axis-endpoint--b { left: 100%; }

/* ── Tick marks: density indicators below the track ── */
.ex-axis-tick {
  position: absolute;
  top: 5px;
  width: 1px;
  height: 12px;
  background: var(--session-color, #00b7f2);
  opacity: 0.3;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ── Items: thumbnails above the track with stems ── */
.ex-axis-item {
  position: absolute;
  bottom: 100%;
  transform: translateX(-50%);
  text-align: center;
  width: 72px;
  cursor: pointer;
  /* Bottom of item sits at track top; stem bridges the gap */
  margin-bottom: 16px;
  text-decoration: none;
  color: inherit;
}

/* Stem connecting thumbnail to track position */
.ex-axis-item::after {
  content: "";
  position: absolute;
  bottom: -16px;
  left: 50%;
  width: 1px;
  height: 16px;
  background: color-mix(in srgb, var(--text-muted) 50%, transparent);
  transition: background 0.15s;
}

.ex-axis-item:hover::after {
  background: var(--session-color, #00b7f2);
}

.ex-axis-item-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
  margin: 0 auto;
}

.ex-axis-item:hover .ex-axis-item-img {
  border-color: var(--session-color, #00b7f2);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--session-color, #00b7f2) 20%, transparent);
}

.ex-axis-item-title {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  transition: color 0.15s;
}

.ex-axis-item:hover .ex-axis-item-title {
  color: var(--text-secondary);
}

/* ── Density summary below ticks ── */
.ex-axis-density-label {
  position: absolute;
  bottom: 8px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.5;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.ex-axis-density-label--left { left: 0; }
.ex-axis-density-label--right { right: 0; text-align: right; }
.ex-axis-density-label--center { left: 50%; transform: translateX(-50%); }

/* ── Responsive: narrow viewports ── */
@media (max-width: 600px) {
  .ex-axis-poles {
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 10px;
  }

  .ex-axis-pole--b {
    flex-direction: row;
    text-align: left;
  }

  .ex-axis-pole {
    max-width: 100%;
  }

  .ex-axis-divider {
    margin: 0 16px;
  }

  .ex-axis-viz {
    padding: 96px 24px 40px;
    overflow-x: auto;
    min-width: 0;
  }

  .ex-axis-track {
    min-width: 400px;
  }
}

/* ── Temporal result: timeline with density bars ── */

/* Outer container: matches Bridge/Axis visual language */
.ex-temporal-strip {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  overflow: hidden;
}

/* ── Header row: query label ── */
.ex-temporal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 12px;
}

.ex-temporal-query {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.ex-temporal-query-accent {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--session-color, #00b7f2);
  opacity: 0.7;
  margin-bottom: 1px;
}

.ex-temporal-total {
  font-size: 11px;
  color: var(--text-muted);
}

.ex-temporal-divider {
  height: 1px;
  background: var(--border);
  margin: 0 24px;
}

/* ── Timeline chart area ── */
.ex-temporal-chart {
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 24px 24px 0;
  height: 160px;
  position: relative;
}

/* Individual decade column in the chart */
.ex-temporal-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: pointer;
  position: relative;
  padding: 0 1px;
  transition: background 0.15s;
  border-radius: 4px 4px 0 0;
}

.ex-temporal-col:hover {
  background: color-mix(in srgb, var(--session-color, #00b7f2) 6%, transparent);
}

.ex-temporal-col.active {
  background: color-mix(in srgb, var(--session-color, #00b7f2) 10%, transparent);
}

/* Density bar: height is set via inline style as percentage of max */
.ex-temporal-bar {
  width: 60%;
  min-width: 8px;
  max-width: 40px;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--session-color, #00b7f2) 40%, transparent);
  transition: background 0.15s, height 0.3s ease;
  min-height: 4px;
}

.ex-temporal-col:hover .ex-temporal-bar,
.ex-temporal-col.active .ex-temporal-bar {
  background: var(--session-color, #00b7f2);
}

/* Count label above bar */
.ex-temporal-count {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s;
  line-height: 1;
}

.ex-temporal-col:hover .ex-temporal-count,
.ex-temporal-col.active .ex-temporal-count {
  color: var(--session-color, #00b7f2);
}

/* ── Decade labels row below chart ── */
.ex-temporal-labels {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-top: 2px solid var(--border);
}

.ex-temporal-label {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  cursor: pointer;
  transition: color 0.15s;
  letter-spacing: 0.01em;
  user-select: none;
  position: relative;
}

.ex-temporal-label:hover,
.ex-temporal-label.active {
  color: var(--text);
}

/* Active indicator tick mark */
.ex-temporal-label.active::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--session-color, #00b7f2);
}

/* ── Detail panel: expanded decade ── */
.ex-temporal-detail {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  animation: ex-temporal-detail-in 0.2s ease;
}

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

.ex-temporal-detail-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.ex-temporal-detail-decade {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.ex-temporal-detail-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* Artworks flow: wrapping horizontal row of cards */
.ex-temporal-detail-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Cards in the temporal detail are slightly larger than default */
.ex-temporal-detail-cards .ex-card {
  width: 110px;
}

/* ── Navigation arrows for stepping through decades ── */
.ex-temporal-detail-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 8px;
}

.ex-temporal-nav-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.ex-temporal-nav-btn:hover {
  border-color: var(--session-color, #00b7f2);
  color: var(--session-color, #00b7f2);
}

.ex-temporal-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ex-temporal-nav-btn:disabled:hover {
  border-color: var(--border);
  color: var(--text-secondary);
}

/* ── Responsive: narrow viewports ── */
@media (max-width: 600px) {
  .ex-temporal-chart {
    height: 120px;
    padding: 16px 16px 0;
  }

  .ex-temporal-labels {
    padding: 0 16px;
  }

  .ex-temporal-label {
    font-size: 8px;
    padding: 6px 0;
    /* On very narrow screens, rotate labels to prevent overlap */
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    min-height: 40px;
  }

  .ex-temporal-header {
    padding: 12px 16px 10px;
  }

  .ex-temporal-divider {
    margin: 0 16px;
  }

  .ex-temporal-detail {
    padding: 12px 16px 16px;
  }

  .ex-temporal-detail-cards .ex-card {
    width: 90px;
  }
}

/* ── Topology result: SVG scatter ── */
.ex-topology-container {
  position: relative;
}

.ex-topology-svg {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
}

.ex-topology-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ex-topology-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 3px;
  transition: background 0.15s;
}

.ex-topology-legend-item:hover {
  background: var(--hover-bg);
}

.ex-topology-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Shared artwork card (used across operations) ── */
.ex-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.15s;
  width: 100px;
  flex-shrink: 0;
}

.ex-card:hover {
  border-color: var(--border-strong);
}

.ex-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.ex-card-title {
  font-size: 10px;
  font-weight: 500;
  color: var(--text);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Empty state ── */
.ex-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
