/* Shared calm, app-first styles for all 5 GeoCLIP ViT-L/14 routes.
 * Rules enforced:
 *   - Uses public/styles.css CSS custom properties ONLY (zero raw hex colors)
 *   - Zero dashed .file-btn borders; clean architectural hairlines
 *   - Primary interactive world radar + scene studio FIRST above the fold
 *   - >= 44x44px hit targets on every interactive element
 *   - [hidden] { display: none !important; }
 *   - 0px horizontal overflow at 1280px desktop, 390px mobile, and 360px narrow mobile
 */

[hidden] {
  display: none !important;
}

/* Enforce >= 44x44px accessible hit targets across all interactive controls */
button,
.model-loader button,
select,
input:not([type="hidden"]),
summary,
.geo-upload-btn,
.geo-check-label {
  min-block-size: 44px;
  min-inline-size: 44px;
}

.crumbs a,
.ladder-nav a,
.byline a,
.geo-meta-line a,
.img-credit a,
.model-loader a,
details.show-code .sc-meta a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
}

.img-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
  line-height: 1.35;
}

.img-credit a {
  min-inline-size: 44px;
  justify-content: center;
  padding: 0 0.25rem;
}

/* Compact architectural header so interactive radar starts above the fold */
.geo-header {
  margin-block-end: 0.85rem;
}

.geo-header h1 {
  margin: 0.25rem 0 0.35rem;
}

.geo-header .lede {
  margin: 0;
  max-inline-size: 74ch;
}

.geo-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0.55rem 0 0;
}

.geo-meta-line span + span::before {
  content: "·";
  margin-inline-end: 0.65rem;
  color: var(--border-strong);
}

.geo-loader-bar {
  margin-block-end: 0.85rem;
}

/* Primary app-first 2-column workbench with container query + responsive fallback */
.geo-studio-wrap {
  container-type: inline-size;
  container-name: geostudio;
}

.geo-studio {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.95fr);
  gap: 1rem;
  align-items: start;
}

@container geostudio (max-width: 820px) {
  .geo-studio {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .geo-studio {
    grid-template-columns: minmax(0, 1fr);
  }
}

.geo-stage-col,
.geo-side-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-inline-size: 0;
}

/* Calm hairline card */
.geo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 0.9rem 1rem;
  min-inline-size: 0;
}

.geo-card h2,
.geo-card h3 {
  margin: 0 0 0.55rem;
  padding: 0;
  border: 0;
  font-size: 0.98rem;
}

/* Zero-network Vector World Radar SVG */
.geo-map-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  overflow: hidden;
  min-inline-size: 0;
}

.geo-map-frame.is-dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.geo-map-svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 2 / 1;
}

.geo-map-svg.is-clickable {
  cursor: crosshair;
}

.geo-map-ocean {
  fill: var(--bg-secondary);
}

.geo-map-grid line {
  stroke: var(--border);
  stroke-width: 0.8;
  stroke-dasharray: 4 4;
}

.geo-map-land path {
  fill: color-mix(in srgb, var(--color) 10%, var(--bg-raised));
  stroke: var(--border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.geo-heat-warm {
  fill: var(--warn);
}

.geo-heat-hot {
  fill: var(--accent);
}

.geo-map-arc {
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  opacity: 0.75;
}

.geo-radar-ring-inner {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.75;
}

.geo-radar-ring-outer {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  opacity: 0.35;
}

.geo-pin {
  cursor: pointer;
}

.geo-pin circle {
  fill: var(--warn);
  stroke: var(--bg-raised);
  stroke-width: 1.4;
}

.geo-pin.is-top1 circle {
  fill: var(--accent);
  stroke: var(--bg-raised);
  stroke-width: 2;
}

.geo-pin.is-selected circle {
  stroke: var(--color);
  stroke-width: 2.2;
}

.geo-pin:focus-visible circle {
  stroke: var(--color);
  stroke-width: 3;
}

.geo-pin-truth {
  fill: var(--good);
  stroke: var(--bg-raised);
  stroke-width: 1.6;
}

.geo-pin-probe circle {
  fill: var(--good);
  stroke: var(--bg-raised);
  stroke-width: 1.6;
}

.geo-pin-probe line {
  stroke: var(--good);
  stroke-width: 1.6;
}

.geo-pin-compare {
  fill: none;
  stroke: var(--bad);
  stroke-width: 2.2;
}

/* Scene canvas stage */
.geo-canvas-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-block-size: 180px;
}

.geo-canvas-frame.is-dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.geo-canvas-frame canvas {
  display: block;
  max-inline-size: 100%;
  max-block-size: 380px;
  inline-size: auto;
  block-size: auto;
}

/* Toolbars & segmented controls */
.geo-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.geo-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.geo-seg button {
  background: var(--bg-raised);
  color: var(--color);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
}

.geo-seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* Clean hairline upload control (ZERO dashed borders) */
.geo-upload-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
}

.geo-upload-btn:hover {
  border-color: var(--accent);
}

.geo-upload-btn:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.geo-upload-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.geo-upload-btn input[type="file"] {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Sample photograph strip */
.sample-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 92px), 1fr));
  gap: 0.45rem;
}

.sample-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  cursor: pointer;
  text-align: left;
  min-block-size: 44px;
}

.sample-btn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.sample-btn img {
  inline-size: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.sample-lbl {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Form fields */
.geo-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.geo-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-inline-size: 0;
}

.geo-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.84rem;
}

.geo-field-head output {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.geo-field input[type="range"] {
  inline-size: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.geo-field input[type="number"],
.geo-field input[type="text"],
.geo-field select {
  inline-size: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--color);
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
}

/* Metrics strip */
.geo-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr));
  gap: 0.45rem;
}

.geo-metric {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.5rem 0.6rem;
  min-inline-size: 0;
}

.geo-metric span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.25;
}

.geo-metric strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  margin-top: 0.15rem;
  overflow-wrap: anywhere;
}

/* Ranked cosine & probability bars */
.geo-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.geo-rank-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.5rem 0.65rem;
  text-align: left;
  color: var(--color);
  cursor: pointer;
  inline-size: 100%;
}

.geo-rank-row[aria-pressed="true"],
.geo-rank-row.is-probe {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.geo-rank-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.86rem;
}

.geo-rank-sub {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.geo-bar-track {
  inline-size: 100%;
  block-size: 7px;
  border-radius: 4px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.geo-bar-fill {
  block-size: 100%;
  border-radius: 4px;
  background: var(--accent);
}

.geo-bar-fill-alt {
  background: var(--warn);
}

.geo-bar-fill-good {
  background: var(--good);
}

/* Risk badge text (calm hairline, no pastel spam) */
.geo-tier-high {
  color: var(--bad);
  font-weight: 600;
}

.geo-tier-moderate {
  color: var(--warn);
  font-weight: 600;
}

.geo-tier-low {
  color: var(--good);
  font-weight: 600;
}

/* Legend & inline status */
.geo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.45rem;
}

.geo-dot {
  display: inline-block;
  inline-size: 0.58rem;
  block-size: 0.58rem;
  border-radius: 50%;
  vertical-align: middle;
  margin-inline-end: 0.3rem;
}

.geo-dot-accent {
  background: var(--accent);
}

.geo-dot-warn {
  background: var(--warn);
}

.geo-dot-good {
  background: var(--good);
}

.geo-dot-bad {
  background: var(--bad);
}

.status {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

.status.err {
  color: var(--bad);
  font-weight: 500;
}

.geo-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Embedding canvas strip */
.geo-embed-canvas {
  display: block;
  inline-size: 100%;
  block-size: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Inside panel & KV grid */
.geo-inside-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 0.75rem;
}

.geo-kv {
  display: grid;
  grid-template-columns: minmax(0, 126px) minmax(0, 1fr);
  gap: 0.3rem 0.65rem;
  margin: 0;
  font-size: 0.82rem;
}

.geo-kv dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.geo-kv dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

/* Batch queue cards (practical/) */
.geo-queue-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.65rem;
}

.geo-queue-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-inline-size: 0;
}

.geo-queue-item.is-selected {
  border-color: var(--accent);
}

.geo-queue-thumb {
  inline-size: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.geo-queue-thumb img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  display: block;
}

.geo-queue-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
}

.geo-queue-name {
  font-weight: 600;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Wild side-by-side compare & Multi-model stage cards */
.geo-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 224px), 1fr));
  gap: 0.75rem;
}

.geo-compare-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.65rem;
  min-inline-size: 0;
}

.geo-compare-pane h3 {
  margin: 0 0 0.45rem;
  font-size: 0.84rem;
  font-family: var(--font-mono);
  color: var(--muted);
}

.geo-compare-pane canvas {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
  margin-inline: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.geo-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.geo-stage-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.75rem 0.85rem;
  min-inline-size: 0;
}

.geo-stage-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.94rem;
}

/* Data tables */
.geo-table-wrap {
  overflow-x: auto;
  max-inline-size: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.geo-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.geo-table caption {
  text-align: left;
  padding: 0.55rem 0.7rem;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--color);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.geo-table th,
.geo-table td {
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.geo-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg);
}

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

/* Ladder matrix cards */
.geo-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.geo-ladder-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  text-decoration: none;
  color: inherit;
  min-block-size: 44px;
}

.geo-ladder-card:hover {
  border-color: var(--accent);
}

.geo-ladder-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

.geo-ladder-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 520px) {
  .geo-card {
    padding: 0.75rem;
  }
  .geo-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .geo-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
