/* =========================================================================
   Whatson Feedback – Stylesheet
   Accessible, voice-first, multi-theme
   ========================================================================= */

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

:root {
  --font-body: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --text-scale: 1;
  --line-height: 1.6;
  --spacing-extra: 0;
  --radius: 12px;
  --focus-ring: 3px solid #ffcc00;
  --transition: 0.2s ease;
}

html { font-size: calc(100% * var(--text-scale)); scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  line-height: calc(var(--line-height) + var(--spacing-extra) * 0.3);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

/* ----- Skip link ----- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 16px;
  z-index: 9999;
  border-radius: var(--radius);
  font-weight: 700;
}
.skip-link:focus { top: 8px; }

/* =========================================================================
   Themes
   ========================================================================= */
.theme-dark {
  --bg: #0f0f1a;
  --bg-surface: #1a1a2e;
  --text: #e8e8f0;
  --text-muted: #a0a0b8;
  --accent: #5ce1e6;
  --accent-hover: #8af0f4;
  --btn-bg: #5ce1e6;
  --btn-text: #0f0f1a;
  --danger: #ff6b6b;
  --border: #2a2a44;
}

.theme-yellow-black {
  --bg: #000000;
  --bg-surface: #111100;
  --text: #ffff00;
  --text-muted: #cccc00;
  --accent: #ffff00;
  --accent-hover: #ffffaa;
  --btn-bg: #ffff00;
  --btn-text: #000000;
  --danger: #ff4444;
  --border: #444400;
}

.theme-white-navy {
  --bg: #0a1628;
  --bg-surface: #0e1e3a;
  --text: #ffffff;
  --text-muted: #c0c8d8;
  --accent: #ffcc00;
  --accent-hover: #ffe066;
  --btn-bg: #ffcc00;
  --btn-text: #0a1628;
  --danger: #ff6b6b;
  --border: #1a3050;
}

.theme-light {
  --bg: #ffffff;
  --bg-surface: #f2f2f2;
  --text: #111111;
  --text-muted: #555555;
  --accent: #0055aa;
  --accent-hover: #0077dd;
  --btn-bg: #0055aa;
  --btn-text: #ffffff;
  --danger: #cc0000;
  --border: #cccccc;
}

.theme-blue-yellow {
  --bg: #ffff00;
  --bg-surface: #eeee00;
  --text: #0000cc;
  --text-muted: #0000aa;
  --accent: #0000cc;
  --accent-hover: #0000ff;
  --btn-bg: #0000cc;
  --btn-text: #ffff00;
  --danger: #cc0000;
  --border: #0000aa;
}

.theme-sepia {
  --bg: #f4ecd8;
  --bg-surface: #ebe3cf;
  --text: #3e3029;
  --text-muted: #6b5d50;
  --accent: #8b5e3c;
  --accent-hover: #a87050;
  --btn-bg: #8b5e3c;
  --btn-text: #f4ecd8;
  --danger: #aa3333;
  --border: #c4b8a0;
}

/* ----- Extra spacing modifier ----- */
body.extra-spacing {
  --spacing-extra: 1;
  letter-spacing: 0.02em;
  word-spacing: 0.08em;
}

/* ----- Focus mode: dim everything except the question ----- */
body.focus-mode .a11y-bar,
body.focus-mode .whatson-header,
body.focus-mode .site-footer,
body.focus-mode .conversation {
  opacity: 0.3;
  pointer-events: none;
}

/* =========================================================================
   Focus styles – visible for keyboard users
   ========================================================================= */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

/* =========================================================================
   Accessibility toolbar
   ========================================================================= */
.a11y-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.a11y-bar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
}
.a11y-group { display: flex; align-items: center; gap: 6px; }
.a11y-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.a11y-select {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.a11y-btn {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.a11y-btn:hover, .a11y-btn:focus-visible { background: var(--accent); color: var(--btn-text); }
.a11y-btn[aria-pressed="true"] { background: var(--accent); color: var(--btn-text); }

/* =========================================================================
   Layout
   ========================================================================= */
.container {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
  flex: 1;
}

/* =========================================================================
   Whatson header
   ========================================================================= */
.whatson-header { text-align: center; margin-bottom: 32px; }
.whatson-mascot { margin: 0 auto 12px; width: 100px; height: 100px; }
.whatson-mascot svg { width: 100%; height: 100%; }
.whatson-title {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.whatson-subtitle { color: var(--text-muted); font-size: 1.05rem; margin-top: 4px; }

/* =========================================================================
   Conversation log
   ========================================================================= */
.conversation {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  max-height: 260px;
  overflow-y: auto;
}
.conv-msg {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  line-height: 1.5;
}
.conv-msg:last-child { border-bottom: none; }
.whatson-msg { color: var(--accent); }
.user-msg { color: var(--text); font-style: italic; }
.user-msg::before { content: 'You: '; font-weight: 700; font-style: normal; }

/* =========================================================================
   Question display
   ========================================================================= */
.question-display {
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}
.question-text { font-size: 1.3rem; font-weight: 600; line-height: 1.5; }

/* Option buttons for sighted / touch users */
.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.option-btn {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 120px;
}
.option-btn:hover, .option-btn:focus-visible {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
}
.option-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
}

/* =========================================================================
   Speech display
   ========================================================================= */
.speech-display {
  text-align: center;
  margin-bottom: 16px;
}
.speech-label { font-size: 0.85rem; color: var(--text-muted); }
.speech-text { font-size: 1.15rem; font-weight: 600; color: var(--text); margin-top: 4px; }

/* =========================================================================
   Mic indicator
   ========================================================================= */
.mic-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}
.mic-dot {
  width: 14px;
  height: 14px;
  background: #ff4444;
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

/* =========================================================================
   Buttons
   ========================================================================= */
.controls { text-align: center; margin-bottom: 24px; }

.btn-start {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: var(--radius);
  padding: 20px 56px;
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
  min-width: 200px;
  /* Make it a large touch target */
  min-height: 64px;
}
.btn-start:hover, .btn-start:focus-visible {
  background: var(--accent-hover);
  transform: scale(1.04);
}

.session-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.btn-ctrl {
  background: var(--bg-surface);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
  transition: all var(--transition);
}
.btn-ctrl:hover, .btn-ctrl:focus-visible { background: var(--accent); color: var(--btn-text); border-color: var(--accent); }
.btn-cancel { border-color: var(--danger); color: var(--danger); }
.btn-cancel:hover, .btn-cancel:focus-visible { background: var(--danger); color: #fff; border-color: var(--danger); }

/* =========================================================================
   Summary screen
   ========================================================================= */
.summary-screen {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.summary-screen h2 { font-size: 1.6rem; color: var(--accent); margin-bottom: 16px; }
.summary-content { margin-bottom: 20px; }
.summary-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.summary-item:last-child { border-bottom: none; }
.summary-q { font-weight: 700; font-size: 0.95rem; color: var(--text-muted); }
.summary-a { font-size: 1.1rem; margin-top: 4px; }
.summary-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* =========================================================================
   Done screen
   ========================================================================= */
.done-screen { text-align: center; padding: 40px 20px; }
.done-screen h2 { font-size: 2rem; color: var(--accent); margin-bottom: 12px; }
.done-screen p { font-size: 1.15rem; color: var(--text-muted); margin-bottom: 24px; }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* =========================================================================
   Mobile
   ========================================================================= */
@media (max-width: 500px) {
  .a11y-bar-inner { gap: 8px; }
  .a11y-select, .a11y-btn { font-size: 0.8rem; padding: 5px 8px; }
  .container { padding: 16px 12px 32px; }
  .whatson-title { font-size: 1.8rem; }
  .question-text { font-size: 1.1rem; }
  .btn-start { font-size: 1.3rem; padding: 18px 40px; }
  .option-btn { min-width: 100px; padding: 10px 14px; font-size: 0.95rem; }
}
