/* ==========================================================================
   AI Opportunity Survey: shared design tokens and base components.
   Page-specific styles live in quiz.css, results.css and admin.css.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces & text */
  --bg:             #f6f7fb;
  --surface:        #ffffff;
  --surface-2:      #f0f2f7;
  --border:         #e2e5ee;
  --border-strong:  #c9cedb;
  --text:           #191b23;
  --text-2:         #5b6072;
  --text-3:         #8a90a3;

  /* Brand accent (buttons, focus, links) */
  --accent:         #4f46e5;
  --accent-hover:   #4338ca;
  --accent-soft:    #eef0ff;
  --accent-text:    #ffffff;

  /* Category colors: validated as a set (CVD-safe adjacent order pm, dev, design, comms).
     Always pair with a text label; never use as text color. */
  --cat-pm:         #257de0;
  --cat-dev:        #f47230;
  --cat-design:     #00b894;
  --cat-comms:      #6a4ce2;

  /* Status */
  --good:           #0a7a2a;
  --good-soft:      #e6f6ea;
  --warn:           #9a5b00;
  --warn-soft:      #fff4e0;
  --danger:         #c62828;
  --danger-soft:    #fdecec;

  /* Shape & rhythm */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, .06);
  --shadow:    0 1px 3px rgba(20, 24, 40, .06), 0 8px 24px rgba(20, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(20, 24, 40, .12);
  --ease: cubic-bezier(.2, .7, .2, 1);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg:            #111218;
    --surface:       #191b23;
    --surface-2:     #22252f;
    --border:        #2c303c;
    --border-strong: #3d4252;
    --text:          #eef0f5;
    --text-2:        #a4a9b8;
    --text-3:        #767c8e;

    --accent:        #8b85ff;
    --accent-hover:  #a29dff;
    --accent-soft:   #262546;
    --accent-text:   #12121a;

    --cat-pm:        #338ced;
    --cat-dev:       #e76624;
    --cat-design:    #00a888;
    --cat-comms:     #9887ef;

    --good:          #5fd07a;
    --good-soft:     #17301e;
    --warn:          #f0b65a;
    --warn-soft:     #33270f;
    --danger:        #ff7b7b;
    --danger-soft:   #3a1a1a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow:    0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
  }
}

/* Category helper: sets --cat for any element with data-cat */
[data-cat="pm"]     { --cat: var(--cat-pm); }
[data-cat="dev"]    { --cat: var(--cat-dev); }
[data-cat="design"] { --cat: var(--cat-design); }
[data-cat="comms"]  { --cat: var(--cat-comms); }

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 750; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.0625rem; font-weight: 650; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted  { color: var(--text-2); }
.small  { font-size: .875rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Layout -------------------------------------------------------------- */
.container        { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }
.container--wide  { max-width: 1200px; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -.01em;
}
.brand__mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: conic-gradient(from 210deg, var(--cat-pm), var(--cat-dev), var(--cat-design), var(--cat-comms), var(--cat-pm));
}
.brand:hover { color: var(--text); }
main { padding-bottom: 64px; }

/* --- Cards --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
}
.card + .card { margin-top: 20px; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  font: inherit; font-weight: 600; font-size: .9375rem;
  border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-text);
  cursor: pointer; text-decoration: none;
  transition: background .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover   { background: var(--accent-hover); color: var(--accent-text); }
.btn:active  { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn--ghost  { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--quiet  { background: transparent; color: var(--text-2); padding-inline: 12px; }
.btn--quiet:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger); filter: brightness(1.08); color: #fff; }
.btn--sm     { min-height: 34px; padding: 6px 14px; font-size: .875rem; }
.btn--lg     { min-height: 52px; padding: 14px 28px; font-size: 1.0625rem; }

/* --- Forms --------------------------------------------------------------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: .9375rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 120px; resize: vertical; }

/* --- Badges & chips ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .8125rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
/* Category badge: colored dot + text label (identity never by color alone) */
.cat-badge { background: var(--surface); color: var(--text); }
.cat-badge::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--cat, var(--text-3));
}

/* --- Notices ------------------------------------------------------------- */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text); font-size: .9375rem;
}
.notice--good   { background: var(--good-soft); }
.notice--warn   { background: var(--warn-soft); }
.notice--danger { background: var(--danger-soft); }

/* --- Motion -------------------------------------------------------------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fade-up .45s var(--ease) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Print --------------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .no-print, .site-header nav { display: none !important; }
}
