:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-alt: #eef2ff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #4b5563;
  --border: #d1d5db;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #dbeafe;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg), var(--surface-soft));
  color: var(--text);
}
a { color: var(--accent-strong); }
a:hover { color: var(--accent); }
button, textarea, input, select { font: inherit; }
button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
  background: var(--surface-alt);
  font-weight: 700;
  cursor: pointer;
}
button:hover { transform: translateY(-1px); border-color: var(--accent-strong); }
.primary { background: var(--accent); border-color: var(--accent-strong); color: #fff; }
.primary:hover { background: var(--accent-strong); }
.container { max-width: 1240px; margin: 0 auto; padding: 32px 20px 56px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.inset-card { background: var(--surface-soft); }
h1, h2, h3, p, dl { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 2.7rem); }
h2 { margin-bottom: 12px; }
h3 { margin-bottom: 10px; }
p { line-height: 1.55; }
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  margin-bottom: 10px;
}
.screen-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.empty-state { color: var(--muted); }

/* ── Media frame & trigger (clickable artifact preview) ── */
.media-frame {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}
.media-trigger {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  text-align: left;
  cursor: zoom-in;
}
.media-trigger:hover,
.media-trigger:focus-visible { transform: none; border-color: transparent; }
.media-frame:hover,
.media-frame:focus-within {
  border-color: var(--accent-strong);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}
.figure-title { font-weight: 800; color: var(--text); }
.media-preview { display: grid; place-items: center; min-height: 188px; }
.media-preview img, .media-preview svg, .modal-svg-wrapper svg, .media-image, .modal-image { display: block; width: 100%; max-width: 100%; height: auto; }
.media-hint { font-size: 12px; }

/* ── Media modal (enlarged view overlay) ── */
.media-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
}
.media-modal[hidden] { display: none !important; }
.media-modal-scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.66); }
.media-modal-dialog {
  position: relative;
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.36);
  padding: 16px;
}
.media-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.media-modal-close { width: 44px; height: 44px; padding: 0; }
.media-modal-body { min-height: 200px; }
.modal-image, .modal-svg-wrapper svg { width: 100%; height: auto; }
.modal-text { margin: 0; white-space: pre-wrap; }
