/* ═══════════════════════════════════════════════════════════════════
   FTS Personality Test — Design System ("Energy Quadrant")
   One shared stylesheet for the public flow and the admin panel.
   Brand + energy colors are injected as CSS variables from
   config/brand.js (see views/partials/_head.ejs & admin/_admin_styles.ejs).
   ═══════════════════════════════════════════════════════════════════ */

/* ─── 1. Design tokens ────────────────────────────────────────────── */
:root {
  /* Neutrals — calm enterprise base */
  --ink:        #14202E;   /* deep navy-slate: headings, dark surfaces */
  --ink-2:      #45566E;   /* secondary text */
  --ink-3:      #6E7E94;   /* muted text, captions */
  --canvas:     #F4F6F9;   /* app background */
  --paper:      #FFFFFF;   /* cards, surfaces */
  --paper-2:    #EDF0F5;   /* subtle fills, hover rows */
  --line:       #E3E8EF;   /* hairline borders */
  --line-2:     #CBD5E1;   /* stronger borders (inputs) */

  /* Action color — injected from brand.js, with static fallbacks */
  --accent:        #0056B3;
  --accent-strong: #003D82;
  --accent-soft:   #E8F0FA;
  --on-accent:     #FFFFFF;

  /* The four energies — injected from brand.js */
  --energy-r: #E63946;
  --energy-y: #F4A460;
  --energy-g: #12966B;
  --energy-b: #2E8BC0;
  /* Text-safe deep variants (WCAG AA on white) */
  --energy-r-deep: color-mix(in srgb, var(--energy-r), #14202E 32%);
  --energy-y-deep: color-mix(in srgb, var(--energy-y), #14202E 52%);
  --energy-g-deep: color-mix(in srgb, var(--energy-g), #14202E 22%);
  --energy-b-deep: color-mix(in srgb, var(--energy-b), #14202E 30%);
  /* Whisper-tints for backgrounds */
  --energy-r-soft: color-mix(in srgb, var(--energy-r), #FFFFFF 92%);
  --energy-y-soft: color-mix(in srgb, var(--energy-y), #FFFFFF 90%);
  --energy-g-soft: color-mix(in srgb, var(--energy-g), #FFFFFF 92%);
  --energy-b-soft: color-mix(in srgb, var(--energy-b), #FFFFFF 92%);

  /* Semantic */
  --success:      #12805C;
  --success-soft: #E7F6EF;
  --danger:       #C6303E;
  --danger-soft:  #FCEDEE;
  --warn:         #9A5B14;
  --warn-soft:    #FCF3E6;

  /* Type scale — tuned for Arabic (generous line-heights) */
  --font: 'IBM Plex Sans Arabic', 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --fs-display: clamp(2rem, 4.5vw, 2.75rem);  --lh-display: 1.35;
  --fs-h1: 1.625rem;  --lh-h1: 1.5;
  --fs-h2: 1.25rem;   --lh-h2: 1.55;
  --fs-h3: 1.0625rem; --lh-h3: 1.6;
  --fs-body: 0.9375rem; --lh-body: 1.9;
  --fs-sm: 0.8125rem; --lh-sm: 1.7;
  --fs-xs: 0.75rem;   --lh-xs: 1.6;

  /* Spacing scale */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 48px; --sp-10: 64px;

  /* Radii */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;

  /* Shadows — soft, layered */
  --shadow-xs: 0 1px 2px rgba(20, 32, 46, 0.05);
  --shadow-sm: 0 1px 3px rgba(20, 32, 46, 0.07), 0 1px 2px rgba(20, 32, 46, 0.04);
  --shadow-md: 0 8px 24px -6px rgba(20, 32, 46, 0.12), 0 2px 6px -2px rgba(20, 32, 46, 0.06);
  --shadow-lg: 0 24px 48px -12px rgba(20, 32, 46, 0.22);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --t-fast: 160ms var(--ease);
  --t-med: 220ms var(--ease);

  /* Signature: the four-energy strip */
  --energy-stops: var(--energy-r) 0 25%, var(--energy-y) 25% 50%,
                  var(--energy-g) 50% 75%, var(--energy-b) 75% 100%;
}

/* ─── 2. Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--canvas);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

::selection { background: color-mix(in srgb, var(--accent), transparent 78%); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 { font-weight: 700; color: var(--ink); }
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }

.text-display { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: 700; letter-spacing: -0.01em; }
.text-sm { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.text-xs { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.muted   { color: var(--ink-3); }
.muted-2 { color: var(--ink-2); }

.eyebrow {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-block-end: var(--sp-2);
}

/* ─── 3. Signature: energy strip, disc, chips ─────────────────────── */
.energy-strip {
  height: 4px;
  border: none;
  background: linear-gradient(90deg, var(--energy-stops));
}
[dir="rtl"] .energy-strip { background: linear-gradient(-90deg, var(--energy-stops)); }
.energy-strip.thin { height: 3px; }

/* Conic quadrant disc — the product's wheel as an identity mark */
.energy-disc {
  --disc-size: 200px;
  width: var(--disc-size);
  height: var(--disc-size);
  border-radius: 50%;
  background: conic-gradient(from 45deg,
    var(--energy-b) 0 25%, var(--energy-g) 25% 50%,
    var(--energy-y) 50% 75%, var(--energy-r) 75% 100%);
  position: relative;
  flex-shrink: 0;
}
.energy-disc.ring::after {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: inherit;
  background: var(--paper);
}

.energy-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Energy chip: dot + name, text-safe color */
.energy-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}
.energy-chip .energy-dot { width: 11px; height: 11px; }
.energy-chip.r { color: var(--energy-r-deep); } .energy-chip.r .energy-dot { background: var(--energy-r); }
.energy-chip.y { color: var(--energy-y-deep); } .energy-chip.y .energy-dot { background: var(--energy-y); }
.energy-chip.g { color: var(--energy-g-deep); } .energy-chip.g .energy-dot { background: var(--energy-g); }
.energy-chip.b { color: var(--energy-b-deep); } .energy-chip.b .energy-dot { background: var(--energy-b); }

/* ─── 4. Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--accent-strong); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.ghost {
  background: var(--paper);
  color: var(--ink-2);
  border-color: var(--line-2);
}
.btn.ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-3); }

.btn.quiet {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  padding-inline: 10px;
}
.btn.quiet:hover { background: var(--accent-soft); }

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger), black 15%); }
.btn.danger-ghost {
  background: var(--paper); color: var(--danger); border-color: color-mix(in srgb, var(--danger), white 60%);
}
.btn.danger-ghost:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn.sm { padding: 6px 12px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn.lg { padding: 14px 28px; font-size: var(--fs-body); border-radius: var(--r-lg); }
.btn.block { width: 100%; }

/* ─── 5. Forms ────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-2);
}
.field input, .field select, .field textarea,
.input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--paper);
  font-size: var(--fs-sm);
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input::placeholder, .input::placeholder { color: var(--ink-3); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 82%);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236E7E94' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-inline-end: 14px;
  padding-inline-start: 30px;
}
[dir="ltr"] .field select { background-position: right 12px center; }

/* Dashed drop-zone for CSV import */
.file-zone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--canvas);
  padding: var(--sp-4) var(--sp-5);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.file-zone:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-zone input[type=file] { font-size: var(--fs-xs); max-width: 100%; }

/* ─── 6. Cards & sections ─────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--sp-6); }
.card > .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6) 0;
}
.card-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title .energy-dot { width: 8px; height: 8px; background: var(--accent); }

.divider { border: none; border-top: 1px solid var(--line); margin-block: var(--sp-5); }

/* ─── 7. Tables ───────────────────────────────────────────────────── */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: start;
  padding: 12px 18px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-3);
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 13px 18px;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--paper-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .cell-strong { font-weight: 600; color: var(--ink); }
.table .cell-dim { color: var(--ink-3); font-size: var(--fs-xs); }
.table-foot {
  padding: 12px 18px;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  background: var(--canvas);
}
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ─── 8. Pills & badges ───────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  background: var(--paper-2);
  color: var(--ink-2);
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}
.pill.success { background: var(--success-soft); color: var(--success); }
.pill.warn    { background: var(--warn-soft);    color: var(--warn); }
.pill.accent  { background: var(--accent-soft);  color: var(--accent); }
.pill.plain::before { display: none; }

/* ─── 9. Alerts & toasts ──────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-block-end: var(--sp-4);
}
.alert.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success), white 70%); }
.alert.error   { background: var(--danger-soft);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger), white 70%); }
.alert.warn    { background: var(--warn-soft);    color: var(--warn);    border-color: color-mix(in srgb, var(--warn), white 65%); }

/* Server-rendered toast: fixed, slides in, auto-dismissed by ui.js */
.toast-stack {
  position: fixed;
  top: var(--sp-4);
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  z-index: 120;
  pointer-events: none;
  padding-inline: var(--sp-4);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  width: fit-content;
  padding: 11px 16px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 320ms var(--ease) both;
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
}
.toast.success { background: color-mix(in srgb, var(--success), var(--ink) 35%); }
.toast.error   { background: color-mix(in srgb, var(--danger),  var(--ink) 25%); }
.toast.leaving { opacity: 0; transform: translateY(-8px); }
.toast .toast-x {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.7); font-size: 15px; line-height: 1; padding: 2px;
}
.toast .toast-x:hover { color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── 10. Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 32, 46, 0.5);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--sp-4);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in 240ms var(--ease) both;
}
.modal h4 { font-size: var(--fs-h3); margin-block-end: var(--sp-4); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ─── 11. Admin shell ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.sidebar-brand img { height: 34px; width: auto; align-self: flex-start; }
.sidebar-brand .energy-strip { border-radius: var(--r-full); }

.side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3) var(--sp-3);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
}

.side-foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--fs-xs);
}
.side-foot .admin-name { color: rgba(255,255,255,0.85); font-weight: 600; }
.side-foot a { color: rgba(255, 255, 255, 0.55); text-decoration: none; transition: color var(--t-fast); }
.side-foot a:hover { color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  padding: var(--sp-7) var(--sp-7) var(--sp-9);
  max-width: 1240px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-block-end: var(--sp-6);
}
.page-head h1 { font-size: var(--fs-h1); }
.page-head .page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: var(--sp-2) var(--sp-3);
    gap: var(--sp-2);
  }
  .sidebar-brand { padding: var(--sp-2); }
  .sidebar-brand img { height: 26px; }
  .sidebar-brand .energy-strip { display: none; }
  .side-nav { flex-direction: row; padding: 0; flex: 1; justify-content: flex-end; }
  .nav-item { padding: 8px 10px; }
  .nav-item span { display: none; }
  .side-foot { border: none; padding: var(--sp-2); }
  .side-foot .foot-extra, .side-foot .admin-name { display: none; }
  .side-foot a { white-space: nowrap; }
  .main { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
}

/* ─── 12. Stat cards ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: var(--sp-4);
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t-med), transform var(--t-med);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--stat-accent, var(--line));
}
.stat-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--stat-num-color, var(--ink));
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; }

/* ─── 13. Empty states ────────────────────────────────────────────── */
.empty-state {
  padding: var(--sp-9) var(--sp-5);
  text-align: center;
  color: var(--ink-3);
  font-size: var(--fs-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}
.empty-state .empty-mark {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: conic-gradient(from 45deg,
    var(--energy-b) 0 25%, var(--energy-g) 25% 50%,
    var(--energy-y) 50% 75%, var(--energy-r) 75% 100%);
  opacity: 0.25;
}
.empty-state strong { color: var(--ink-2); font-weight: 600; }

/* ─── 14. Score bars ──────────────────────────────────────────────── */
.bar-row { display: flex; align-items: center; gap: var(--sp-3); }
.bar-row + .bar-row { margin-block-start: var(--sp-3); }
.bar-label {
  width: 128px;
  flex-shrink: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.bar-track {
  flex: 1;
  height: 10px;
  background: var(--paper-2);
  border-radius: var(--r-full);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  transform-origin: 0 50%;
  animation: bar-grow 700ms var(--ease) both;
  animation-delay: var(--bar-delay, 150ms);
}
[dir="rtl"] .bar-fill { transform-origin: 100% 50%; }
.bar-val {
  width: 52px;
  flex-shrink: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-align: end;
  font-variant-numeric: tabular-nums;
}
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ─── 15. Public pages: top bar & footer ──────────────────────────── */
.public-topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.public-topbar .topbar-inner {
  max-width: 880px;
  margin-inline: auto;
  padding: 12px var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.public-topbar .topbar-logo { height: 32px; width: auto; display: block; }
.public-topbar .topbar-title { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }

.public-footer {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

/* ─── 16. Entrance animation ──────────────────────────────────────── */
.reveal { animation: fade-up 480ms var(--ease) both; }
.reveal-1 { animation-delay: 60ms; }
.reveal-2 { animation-delay: 140ms; }
.reveal-3 { animation-delay: 220ms; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Selection pop — satisfying press feedback */
@keyframes pop {
  0% { transform: scale(0.9); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ─── 17. Utilities ───────────────────────────────────────────────── */
.flex { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.stack-4 > * + * { margin-block-start: var(--sp-4); }
.stack-5 > * + * { margin-block-start: var(--sp-5); }
.mb-4 { margin-block-end: var(--sp-4); }
.mb-5 { margin-block-end: var(--sp-5); }
.mb-6 { margin-block-end: var(--sp-6); }
.mt-4 { margin-block-start: var(--sp-4); }
.link {
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
code {
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.85em;
  direction: ltr;
  unicode-bidi: embed;
}

/* ─── 18. Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
