.card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--gradient-card), var(--surface-card);
  box-shadow: var(--shadow-card);
  transition: border-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
}

.card:focus-within { border-color: var(--border-highlight); }

@media (hover: hover) and (pointer: fine) {
  .card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(350px circle at var(--spotlight-x, -999px) var(--spotlight-y, -999px), rgba(79, 182, 240, .14), transparent 65%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-fast) var(--motion-ease);
    z-index: 1;
  }
  .card:hover::before { opacity: 1; }
  .card:hover {
    border-color: rgba(79, 182, 240, .35);
    box-shadow: 0 20px 48px rgba(0, 0, 0, .32), 0 0 24px rgba(79, 182, 240, .08);
  }
}

.card > * { position: relative; z-index: 2; }

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-4);
}

.card-header .card-icon { margin-bottom: 0; }
.card-header .card-index { margin-bottom: 0; }
.card-icon + .status-badge { margin-left: 12px; vertical-align: middle; }

.card-icon, .step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(79, 182, 240, .12), rgba(28, 33, 40, .6));
  border: 1px solid rgba(79, 182, 240, .24);
  color: var(--accent-blue);
  margin-bottom: var(--space-4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: all var(--motion-fast) var(--motion-ease);
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover .card-icon,
  .card:hover .step-icon {
    border-color: var(--accent-blue);
    color: #88d6f7;
    box-shadow: 0 0 20px rgba(79, 182, 240, .28);
    transform: translateY(-1px);
  }
}

/* Use on small floating cards; opaque .card remains the fallback. */
.card--glass {
  background: var(--gradient-card), var(--surface-glass);
  box-shadow: var(--shadow-float);
  border-color: rgba(79, 182, 240, .22);
}

@supports (backdrop-filter: blur(12px)) {
  .card--glass { backdrop-filter: blur(var(--glass-blur)); }
}

/* Labels belong in HTML as real text, never generated CSS content:
   implemented = Built; prototype = In progress;
   planned = Planned; proposed = Proposed. */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  padding: var(--space-1) var(--space-3);
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  background: var(--bg-app);
  color: var(--text-muted);
  font-size: var(--font-size-label);
  font-weight: 600;
  line-height: 1.6;
  vertical-align: middle;
}

.status-badge[data-status="implemented"] { color: var(--accent-green); }
.status-badge[data-status="prototype"] { color: var(--accent-blue); }
.status-badge[data-status="planned"] { color: var(--accent-yellow); }
.status-badge[data-status="proposed"] { color: var(--accent-orange); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: var(--control-min);
  min-height: var(--control-min);
  max-width: 100%;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: var(--font-size-body);
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease);
}

.button--primary {
  border-color: var(--accent-blue);
  background: var(--accent-blue);
  color: var(--bg-page);
  box-shadow: var(--shadow-button);
}

.button--secondary {
  background: var(--bg-app);
  color: var(--text-primary);
}

.button:focus-visible { border-color: var(--accent-blue); }

.button--primary:focus-visible { background: #88d6f7; }

@media (hover: hover) {
  .card:hover { border-color: var(--border-highlight); }
  .button:not(:disabled):not([aria-disabled="true"]):hover {
    border-color: var(--accent-blue);
    background: var(--surface-card-raised);
  }
  .button--primary:not(:disabled):not([aria-disabled="true"]):hover {
    background: #88d6f7;
  }
}

/* Use native disabled buttons for unresolved destinations. Keep text readable. */
.button:disabled,
.button[aria-disabled="true"] {
  border-color: var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.simulation-caption {
  margin-block-start: var(--space-3);
  color: var(--text-muted);
  font-size: var(--font-size-label);
  line-height: var(--line-height-body);
}

.placeholder {
  color: var(--text-muted);
  font-size: var(--font-size-body);
  overflow-wrap: anywhere;
}

/* Motion handoff: add .js-motion to <html> only after successful setup.
   The coordinator adds .is-revealed to finished/visible elements and must
   remove .js-motion on initialization failure. No JS means visible content.
   Never use visibility:hidden here: keyboard focus must reveal controls. */
[data-reveal] {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .js-motion [data-reveal]:not(.is-revealed):not(:focus-within) {
    opacity: 0;
    transform: translateY(var(--reveal-distance));
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  .card::before {
    display: none !important;
  }
}
