/* SleepDoc questionnaire — faithful clone of the Typeform theme:
   system font, white background, #0142AC answers/buttons, small rounded corners. */

:root {
  --q: #000000;            /* question text */
  --a: #0142AC;            /* answer/accent */
  --btn: #0142AC;          /* buttons */
  --bg: #FFFFFF;
  --radius: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--q);
  height: 100%;
  overflow: hidden;
}

/* ---------- chrome ---------- */
#progress {
  position: fixed; top: 0; left: 0; right: 0; height: 4px;
  background: color-mix(in srgb, var(--btn) 25%, transparent);
  z-index: 30;
}
#progress-fill {
  height: 100%; width: 0%;
  background: var(--btn);
  transition: width .4s ease;
}
#brand-logo {
  position: fixed; top: 16px; right: 20px; z-index: 25;
  height: 44px; width: auto; pointer-events: none;
}
#nav-controls {
  position: fixed; right: 16px; bottom: 16px; z-index: 25;
  display: flex; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
#nav-controls button {
  width: 36px; height: 32px; border: 0; cursor: pointer;
  background: var(--btn); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
#nav-controls button:disabled { opacity: .4; cursor: default; }
#nav-controls button + button { border-left: 1px solid rgba(255,255,255,.35); }
#nav-controls button:not(:disabled):hover { filter: brightness(1.15); }

/* ---------- scroll container ---------- */
#form-root {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
}

.screen {
  min-height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  display: flex;
  align-items: center;
  transition: opacity .35s ease;
}
.screen.dimmed { opacity: .3; }
.screen.hidden-branch { display: none; }

.screen-inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 5vw;
  position: relative;
  z-index: 2;
}

/* ---------- image layouts ---------- */
.screen.layout-split { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
.screen.layout-split .screen-media { order: 2; height: 100vh; position: relative; overflow: hidden; }
.screen.layout-split.place-left .screen-media { order: 0; }
.screen.layout-split .screen-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.screen.layout-split .screen-inner { max-width: 620px; padding: 40px 48px; }

.screen.layout-wallpaper .screen-media {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
}
.screen.layout-wallpaper .screen-media img {
  width: 100%; height: 100%; object-fit: cover;
}
.screen-media .brightness {
  position: absolute; inset: 0; background: #fff; pointer-events: none;
}

.screen.layout-float .screen-inner { display: flex; align-items: center; gap: 64px; max-width: 1100px; }
.screen.layout-float .float-media { flex: 0 0 42%; }
.screen.layout-float .float-media img { width: 100%; max-height: 62vh; object-fit: contain; display: block; }

.screen.layout-stack .stack-media img {
  max-width: 100%; max-height: 36vh; display: block; margin: 0 auto 24px;
}

/* ---------- question content ---------- */
.q-counter {
  color: var(--a);
  font-size: 14px;
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px;
}
.q-counter svg { flex: none; }

.q-title {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--q);
  white-space: pre-line;
}
.q-title strong { font-weight: 700; }
.q-required { color: var(--a); margin-left: 2px; }

.q-desc {
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--q) 70%, transparent);
  white-space: pre-line;
}
.q-desc a, .q-title a { color: var(--a); }

.q-body { margin-top: 28px; }

/* text / number inputs */
.q-input {
  width: 100%;
  font-family: var(--font);
  font-size: 28px;
  color: var(--a);
  background: transparent;
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--a) 40%, transparent);
  padding: 4px 0 8px;
  outline: none;
  border-radius: 0;
}
.q-input::placeholder { color: color-mix(in srgb, var(--a) 35%, transparent); }
.q-input:focus { border-bottom: 2px solid var(--a); padding-bottom: 7px; }
textarea.q-input { resize: none; overflow: hidden; line-height: 1.3; }

/* choices */
.choices { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.choice {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px;
  padding: 6px 10px 6px 6px;
  background: color-mix(in srgb, var(--a) 10%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--a) 60%, transparent);
  border-radius: var(--radius);
  color: var(--a);
  font-size: 20px;
  cursor: pointer;
  max-width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: background-color .15s;
  position: relative;
}
.choice:hover { background: color-mix(in srgb, var(--a) 20%, var(--bg)); }
.choice .key {
  flex: none;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--a) 60%, transparent);
  border-radius: 2px;
  font-size: 12px; font-weight: 700;
}
.choice .tick { flex: none; width: 18px; visibility: hidden; margin-left: auto; }
.choice.selected {
  background: color-mix(in srgb, var(--a) 25%, var(--bg));
  border-width: 2px; border-color: var(--a);
  padding: 5px 9px 5px 5px;
}
.choice.selected .tick { visibility: visible; }
.choice.flash { animation: flash .3s ease 2; }
@keyframes flash {
  0%, 100% { background: color-mix(in srgb, var(--a) 25%, var(--bg)); }
  50% { background: color-mix(in srgb, var(--a) 8%, var(--bg)); }
}
.choice input.other-input {
  border: none; background: transparent; outline: none;
  font-family: var(--font); font-size: 20px; color: var(--a);
  width: 180px;
}
.choice input.other-input::placeholder { color: color-mix(in srgb, var(--a) 50%, transparent); }
.choices-hint {
  font-size: 14px;
  color: color-mix(in srgb, var(--q) 60%, transparent);
  margin-bottom: 12px;
}

/* picture choice */
.pic-choices { display: flex; gap: 16px; flex-wrap: wrap; }
.pic-choice {
  width: 220px;
  background: color-mix(in srgb, var(--a) 10%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--a) 60%, transparent);
  border-radius: var(--radius);
  padding: 8px;
  cursor: pointer;
  color: var(--a);
  font-family: var(--font);
  font-size: 16px;
  text-align: left;
  transition: background-color .15s;
}
.pic-choice:hover { background: color-mix(in srgb, var(--a) 20%, var(--bg)); }
.pic-choice img {
  width: 100%; height: 130px; object-fit: cover;
  border-radius: 2px; display: block; margin-bottom: 8px;
}
.pic-choice .pc-label { display: flex; gap: 8px; align-items: flex-start; }
.pic-choice .key {
  flex: none; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--a) 60%, transparent);
  border-radius: 2px; font-size: 11px; font-weight: 700;
}
.pic-choice.selected {
  border-width: 2px; border-color: var(--a); padding: 7px;
  background: color-mix(in srgb, var(--a) 25%, var(--bg));
}
.pic-choice.flash { animation: flash .3s ease 2; }

/* opinion scale */
.scale { display: flex; gap: 4px; width: 100%; max-width: 560px; }
.scale button {
  flex: 1; height: 56px;
  background: color-mix(in srgb, var(--a) 10%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--a) 60%, transparent);
  border-radius: var(--radius);
  color: var(--a); font-size: 18px; font-family: var(--font);
  cursor: pointer;
  transition: background-color .15s;
}
.scale button:hover { background: color-mix(in srgb, var(--a) 20%, var(--bg)); }
.scale button.selected { background: var(--a); color: #fff; }
.scale-labels {
  display: flex; justify-content: space-between;
  max-width: 560px; margin-top: 8px;
  font-size: 14px; color: color-mix(in srgb, var(--q) 70%, transparent);
}

/* rating (hearts) */
.rating { display: flex; gap: 10px; }
.rating button {
  background: none; border: none; cursor: pointer;
  color: var(--a); text-align: center; font-family: var(--font);
}
.rating svg { width: 44px; height: 44px; display: block; }
.rating svg path { fill: transparent; stroke: var(--a); stroke-width: 1.6; transition: fill .12s; }
.rating button.lit svg path { fill: var(--a); }
.rating .num { font-size: 13px; color: var(--a); margin-top: 4px; }

/* yes/no uses .choices with Y/N keys */

/* OK row */
.ok-row { margin-top: 28px; display: flex; align-items: center; gap: 12px; }
.btn {
  font-family: var(--font);
  background: var(--btn); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 20px; font-weight: 700;
  padding: 8px 18px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 3px 12px rgba(0,0,0,.10);
}
.btn:hover { filter: brightness(1.12); }
.btn.big { font-size: 24px; padding: 10px 26px; }
.key-hint { font-size: 12px; color: color-mix(in srgb, var(--q) 65%, transparent); }
.time-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: color-mix(in srgb, var(--q) 65%, transparent);
}

/* error bubble */
.q-error {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px;
  background: #FBEDED; color: #AF0404;
  font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 3px;
}

/* welcome / thankyou */
.screen.welcome .q-title { font-size: 28px; }
.screen.thankyou .q-title { font-size: 24px; }
.screen.thankyou .screen-inner { text-align: left; }

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  #brand-logo { height: 32px; top: 12px; right: 12px; }
  .q-title { font-size: 20px; }
  .q-desc { font-size: 16px; }
  .q-input { font-size: 22px; }
  .choice { font-size: 17px; }
  .screen-inner { padding: 72px 24px 96px; }

  /* split becomes stacked banner on top */
  .screen.layout-split { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
  .screen.layout-split .screen-media { order: 0; height: 32vh; width: 100%; }
  .screen.layout-split .screen-inner { padding-top: 24px; }

  .screen.layout-float .screen-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .screen.layout-float .float-media { flex: none; }
  .screen.layout-float .float-media img { width: 200px; max-height: none; }

  .pic-choice { width: calc(50% - 8px); }
  .pic-choice img { height: 100px; }
  .scale button { height: 44px; font-size: 15px; }
  .rating svg { width: 34px; height: 34px; }
  #nav-controls { bottom: 12px; right: 12px; }
}
