:root {
  --bg: #f0f2f8;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-hover: rgba(255, 255, 255, 0.95);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --accent: #f59e0b;
  --accent-2: #eab308;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.35);
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.1);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.1);
  --warning-soft: rgba(245, 158, 11, 0.12);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: blobDrift 18s ease-in-out infinite alternate;
}

body::before {
  width: 520px;
  height: 520px;
  background: rgba(245, 158, 11, 0.18);
  top: -180px;
  left: -120px;
}

body::after {
  width: 480px;
  height: 480px;
  background: rgba(59, 130, 246, 0.12);
  bottom: -160px;
  right: -100px;
  animation-delay: -6s;
}

@keyframes blobDrift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(40px, 30px) scale(1.08);
  }
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

/* ── Bento grid ── */

.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-areas:
    "hero    hero    hero    hero    hero    hero    stats   stats   stats   stats   stats   stats"
    "modes   modes   modes   modes   modes   modes   modes   modes   modes   modes   modes   modes"
    "params  params  params  params  console console console console console console history history"
    "params  params  params  params  console console console console console console report  report"
    "plots   plots   plots   plots   plots   plots   plots   plots   plots   plots   plots   plots";
  gap: 1rem;
}

.bento-cell {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  min-width: 0;
  animation: cellEnter 0.7s var(--ease-out) both;
}

.bento-cell:nth-child(1) {
  animation-delay: 0.05s;
}
.bento-cell:nth-child(2) {
  animation-delay: 0.1s;
}
.bento-cell:nth-child(3) {
  animation-delay: 0.15s;
}
.bento-cell:nth-child(4) {
  animation-delay: 0.2s;
}
.bento-cell:nth-child(5) {
  animation-delay: 0.25s;
}
.bento-cell:nth-child(6) {
  animation-delay: 0.3s;
}
.bento-cell:nth-child(7) {
  animation-delay: 0.35s;
}

@keyframes cellEnter {
  from {
    transform: translateY(12px);
  }
  to {
    transform: translateY(0);
  }
}

.bento-hero {
  grid-area: hero;
}
.bento-stats {
  grid-area: stats;
}
.bento-modes {
  grid-area: modes;
}
.bento-params {
  grid-area: params;
  max-height: 620px;
  overflow-y: auto;
}
.bento-console {
  grid-area: console;
  display: flex;
  flex-direction: column;
}
.bento-history {
  grid-area: history;
}
.bento-report {
  grid-area: report;
}
.bento-plots {
  grid-area: plots;
}

@media (max-width: 1024px) {
  .bento {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "stats"
      "modes"
      "params"
      "console"
      "history"
      "report"
      "plots";
  }
}

/* ── Hero ── */

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

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  border-radius: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px var(--accent-glow);
  animation: iconFloat 4s ease-in-out infinite;
}

@keyframes iconFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.brand-icon svg {
  width: 26px;
  height: 26px;
  color: #422006;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand h1 span {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand p {
  margin: 0.15rem 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* ── Workflow steps ── */

.workflow {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.workflow-step {
  padding: 0.45rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  position: relative;
  transition:
    color 0.2s,
    background 0.2s;
}

.workflow-step:not(:last-child)::after {
  content: "›";
  position: absolute;
  right: -0.35rem;
  color: var(--border-strong);
  font-weight: 400;
}

.workflow-step.active {
  background: var(--accent-soft);
  color: #92400e;
}

.workflow-step.done {
  color: var(--success);
}

@media (max-width: 640px) {
  .workflow {
    flex-wrap: wrap;
    border-radius: var(--radius-sm);
  }
  .workflow-step {
    flex: 1 1 45%;
    text-align: center;
    font-size: 0.65rem;
  }
  .workflow-step:not(:last-child)::after {
    display: none;
  }
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
}

.live-pill .dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

/* ── Stats bento ── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  height: 100%;
}

.stat-card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition:
    transform 0.25s var(--ease-out),
    box-shadow 0.25s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-link {
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
}

.stat-link:hover {
  border-color: var(--border-strong);
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
}

.stat-value.accent {
  color: var(--accent);
}
.stat-value.primary {
  color: var(--primary);
}
.stat-value.success {
  color: var(--success);
}

@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Mode pills (bento row) ── */

.mode-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  position: relative;
}

@media (max-width: 900px) {
  .mode-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .mode-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mode-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.5rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.25s var(--ease-out);
  overflow: hidden;
}

.mode-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.mode-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s var(--ease-spring);
}

.mode-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: var(--text);
}

.mode-btn:hover svg {
  transform: scale(1.12);
}

.mode-btn.active {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(145deg, #fffbeb, #ffffff);
  color: #92400e;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.mode-btn.active svg {
  color: var(--accent);
}

.mode-btn.active::before {
  opacity: 1;
}

.mode-hint {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.85rem;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.field-hint {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}

.form-advanced {
  margin: 0.5rem 0 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-xs);
  padding: 0.5rem 0.65rem;
  background: var(--surface-solid);
}

.form-advanced summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
}

.form-advanced summary::-webkit-details-marker {
  display: none;
}

.form-advanced[open] summary {
  margin-bottom: 0.65rem;
  color: var(--accent-hover);
}

/* ── Cell headers ── */

.cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.cell-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.cell-title svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

/* ── Form ── */

.form-wrap {
  position: relative;
  min-height: 200px;
}

.form-section {
  display: none;
}

.form-section.active {
  display: block;
  animation: formIn 0.35s var(--ease-out);
}

@keyframes formIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.field {
  margin-bottom: 0.75rem;
}

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  width: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.58rem 0.75rem;
  border-radius: var(--radius-xs);
  font-size: 0.88rem;
  font-family: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-1px);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  user-select: none;
}

.toggle-chip:has(input:checked) {
  background: var(--accent-soft);
  border-color: rgba(245, 158, 11, 0.4);
  color: #92400e;
  font-weight: 600;
}

.toggle-chip input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.info-box {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--primary-soft);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  animation: formIn 0.35s var(--ease-out);
}

.info-box code {
  background: rgba(255, 255, 255, 0.8);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--primary);
}

/* ── Buttons ── */

.btn-run {
  width: 100%;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #422006;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition:
    transform 0.2s var(--ease-spring),
    box-shadow 0.2s;
}

.btn-run::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.btn-run:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-run:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.btn-run:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-run .btn-icon,
.btn-run .btn-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-run.running .btn-icon,
.btn-run.running .btn-icon svg {
  animation: spin 1s linear infinite;
}

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

.btn-ghost {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.meta-line {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--muted);
  word-break: break-all;
}

/* ── Console ── */

.console-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.console-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  transition: all 0.3s var(--ease-out);
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-idle {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
}
.status-pending {
  background: var(--warning-soft);
  color: #b45309;
}
.status-running {
  background: var(--primary-soft);
  color: var(--primary);
}
.status-running::before {
  animation: pulse 1s ease infinite;
}
.status-done {
  background: var(--success-soft);
  color: var(--success);
}
.status-error {
  background: var(--error-soft);
  color: var(--error);
}

.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.progress-bar.visible {
  opacity: 1;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 999px;
  animation: progressSlide 1.4s ease-in-out infinite;
}

@keyframes progressSlide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

#output {
  flex: 1;
  min-height: 280px;
  max-height: 420px;
  margin: 0;
  padding: 1rem 1.1rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.3s;
}

#output.running {
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.3),
    0 0 0 2px rgba(59, 130, 246, 0.25);
}

.command-line {
  display: none;
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface-solid);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  word-break: break-all;
}

.command-line.visible {
  display: block;
  animation: formIn 0.3s var(--ease-out);
}

.quick-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.quick-nav-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-preview.expanded {
  max-height: 480px;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 3000;
  padding: 0.75rem 1.1rem;
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition:
    transform 0.35s var(--ease-spring),
    opacity 0.35s;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 2rem));
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-left: 4px solid var(--success);
}
.toast.error {
  border-left: 4px solid var(--error);
}

/* ── History ── */

.job-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 200px;
  overflow-y: auto;
}

.job-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-out);
  animation: formIn 0.3s var(--ease-out) both;
}

.job-list li:hover {
  background: var(--surface-solid);
  border-color: var(--border);
  transform: translateX(3px);
}

.job-list li.selected {
  background: var(--accent-soft);
  border-color: rgba(245, 158, 11, 0.35);
  color: #92400e;
  font-weight: 600;
}

.job-status {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.job-status.done {
  background: var(--success-soft);
  color: var(--success);
}
.job-status.error {
  background: var(--error-soft);
  color: var(--error);
}
.job-status.running {
  background: var(--primary-soft);
  color: var(--primary);
}
.job-status.pending {
  background: var(--warning-soft);
  color: #b45309;
}

.job-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1rem 0;
  cursor: default;
  justify-content: center;
}

/* ── Report ── */

.report-preview {
  font-size: 0.72rem;
  max-height: 180px;
  overflow: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.75rem;
  font-family: var(--mono);
  white-space: pre-wrap;
  color: var(--text-secondary);
  line-height: 1.5;
}

.empty-state {
  text-align: center;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ── Plots gallery ── */

.plot-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.plot-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  cursor: zoom-in;
  transition:
    transform 0.3s var(--ease-spring),
    box-shadow 0.3s,
    border-color 0.2s;
  animation: plotIn 0.45s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 0.04s);
}

@keyframes plotIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plot-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(245, 158, 11, 0.35);
}

.plot-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(160deg, #fafbfc 0%, #f1f5f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  overflow: hidden;
}

.plot-frame::after {
  content: "Agrandir";
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.plot-card:hover .plot-frame::after {
  opacity: 1;
  transform: translateY(0);
}

.plot-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.plot-card figcaption {
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface-solid);
}

.plot-card figcaption strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plot-card figcaption span {
  display: block;
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plot-empty {
  grid-column: 1 / -1;
}

.plot-count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: var(--accent-soft);
  color: #92400e;
  border-radius: 999px;
}

@media (max-width: 1200px) {
  .plot-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .plot-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .plot-gallery {
    grid-template-columns: 1fr;
  }
}

/* ── Lightbox ── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s,
    visibility 0.35s;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transform: scale(0.92);
  transition: transform 0.4s var(--ease-spring);
}

.lightbox.open img {
  transform: scale(1);
}

.lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Scrollbar & a11y ── */

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

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