/* Light-only theme built on Epinio's design tokens, taken from
   epinio-web-astro/src/styles/epinio-styles.css. Token names are kept
   recognizable so they can be traced back to the source palette.

   Deliberately no prefers-color-scheme block: this page is light in every
   context. index.html sets color-scheme: light so browser-drawn controls
   follow suit on a dark-themed OS. */

:root {
  /* Epinio brand */
  --epinio-primary: #0086ff;
  --epinio-primary-dark: #005580;
  --epinio-accent: #1a4a76;
  --epinio-accent-light: #badeff;
  --epinio-tint: #ebf4ff;

  /* Epinio grayscale */
  --epinio-gray-900: #1a1a2e;
  --epinio-gray-700: #444466;
  --epinio-gray-600: #5a5a82;
  --epinio-gray-500: #7070a0;
  --epinio-gray-300: #c0c0d8;
  --epinio-gray-200: #e0e0f0;
  --epinio-gray-100: #f0f0f8;
  --epinio-gray-50: #f8f8fc;

  /* Epinio functional */
  --epinio-success: #0ac780;
  --epinio-error: #d0021b;

  /* Roles used by this page */
  --bg: var(--epinio-gray-50);
  --surface: #ffffff;
  --surface-alt: #f4f6f8;
  --border: var(--epinio-gray-200);
  --border-soft: var(--epinio-gray-100);
  --text: var(--epinio-gray-900);
  --text-muted: var(--epinio-gray-600);
  --text-subtle: var(--epinio-gray-500);

  /* Accent splits into a fill and a text tone on purpose: #0086FF is only
     3.6:1 on white, so it paints graphics while the darker tone carries
     any accented text. */
  --accent-fill: var(--epinio-primary);
  --accent-text: var(--epinio-primary-dark);

  --radius: 10px;
  --sidebar-width: 268px;
  --topbar-height: 76px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  margin: 0;
  line-height: 1.3;
  font-weight: 600;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
  z-index: 20;
  background: var(--surface);
  padding: 8px 12px;
  border: 1px solid var(--accent-fill);
  border-radius: var(--radius);
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(26, 26, 46, 0.03);
}

.eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  font-weight: 500;
}

.topbar-title h1 {
  font-size: 18px;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.topbar-progress {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 210px;
  flex: 1 1 210px;
}

.progress-track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--epinio-gray-100);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent-fill);
  transition: width 160ms ease-out;
}

.progress-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.topbar-actions button,
.file-button {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms, border-color 120ms, background 120ms;
}

.topbar-actions button:hover,
.file-button:hover {
  border-color: var(--accent-fill);
  background: var(--epinio-tint);
  color: var(--accent-text);
}

.topbar-actions button.danger:hover {
  border-color: var(--epinio-error);
  background: transparent;
  color: var(--epinio-error);
}

.file-button input {
  display: none;
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: start;
  gap: 30px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}

.sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 28px);
  max-height: calc(100vh - var(--topbar-height) - 56px);
  overflow-y: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.respondent label {
  display: block;
  margin: 12px 0 5px;
  font-size: 13px;
  color: var(--text-muted);
}

.respondent label:first-child {
  margin-top: 0;
}

.respondent input {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.section-nav {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
}

.section-nav a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}

.section-nav a:hover {
  color: var(--accent-text);
}

.section-nav .count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
}

.section-nav .count.complete {
  color: var(--accent-text);
  font-weight: 500;
}

.storage-note {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ---------- content ---------- */

main {
  min-width: 0;
}

.intro,
.qsection,
.footer {
  margin-bottom: 22px;
  padding: 24px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* The intro is the one Epinio-branded panel: a tinted card with a brand
   rule down the leading edge. */
.intro {
  background: var(--epinio-tint);
  border-color: var(--epinio-accent-light);
  border-left: 3px solid var(--accent-fill);
}

.intro h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--epinio-accent);
}

.intro p {
  margin: 0 0 10px;
  max-width: 74ch;
  color: var(--text-muted);
}

.intro p:last-child {
  margin-bottom: 0;
}

.qsection-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.qsection-head h2 {
  font-size: 16px;
  color: var(--epinio-accent);
}

.qsection-head .count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
  white-space: nowrap;
}

.qsection-head .count.complete {
  color: var(--accent-text);
  font-weight: 500;
}

.question {
  padding: 22px 0;
  border-bottom: 1px solid var(--border-soft);
}

.question:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.question-text {
  margin: 0;
  font-weight: 500;
  max-width: 74ch;
}

.question-note {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 74ch;
}

.question textarea {
  display: block;
  width: 100%;
  min-height: 60px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 7px;
  resize: vertical;
  transition: background 120ms, border-color 120ms;
}

.question textarea:hover {
  border-color: var(--epinio-gray-300);
}

.question textarea::placeholder {
  color: var(--text-subtle);
}

.question textarea:focus-visible,
.respondent input:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 1px;
  border-color: var(--accent-fill);
  background: var(--surface);
}

.question.answered textarea {
  border-left: 2px solid var(--epinio-success);
  background: var(--surface);
}

.footer {
  font-size: 13px;
  color: var(--text-muted);
}

.footer p {
  margin: 0;
}

.footer strong {
  font-weight: 550;
  color: var(--text);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 10px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--epinio-gray-900);
  color: #ffffff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease-out, transform 140ms ease-out;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 20px 18px 40px;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .intro,
  .qsection,
  .footer {
    padding: 20px;
  }
}

/* ---------- print ---------- */

@media print {
  .topbar-actions,
  .sidebar,
  .toast,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .intro,
  .qsection,
  .footer {
    background: #fff;
    border: none;
    padding: 0;
    margin-bottom: 18px;
    break-inside: avoid;
  }

  .question {
    break-inside: avoid;
  }
}
