/* Traveller behaviour survey v1.2. Look ported from the Claude Design export
   (the "guest book" spread on desktop, a single sheet on phones), tokens from
   the AuraScope design system. Instrument Sans is the only typeface. */

@font-face { font-family: "Instrument Sans"; src: url("fonts/InstrumentSans-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/InstrumentSans-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/InstrumentSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/InstrumentSans-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans SemiCondensed"; src: url("fonts/InstrumentSans_SemiCondensed-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --color-primary: #76cfbf;
  --color-primary-hover: #6db1ab;
  --color-heading: #2f3b68;
  --color-secondary: #43627b;
  --color-surface: #c9e9e1;
  --color-text: #151c28;
  --color-text-soft: #2b364a;
  --color-muted: #5b8d95;
  --color-muted-soft: #97b6bb;
  --color-bg: #f7fbfa;
  --color-bg-elevated: #ffffff;
  --color-border: #d8e6e3;
  --color-danger: #d44545;
  --color-warning: #d97a2d;
  --font-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-semicond: "Instrument Sans SemiCondensed", "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --shadow-lg: 0 14px 36px rgba(47, 59, 104, 0.10), 0 3px 6px rgba(47, 59, 104, 0.04);
  --ease-standard: cubic-bezier(0.2, 0.7, 0.2, 1);
  --focus: 0 0 0 3px rgba(118, 207, 191, 0.45);
  --focus-inset: inset 0 0 0 2px rgba(118, 207, 191, 0.65);
  --q-size: 27px;
  --h-size: 17px;
}

html, body { margin: 0; background: var(--color-bg); }
body {
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--color-surface); color: var(--color-heading); }
button, textarea, input { font-family: inherit; font-size: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
h1, p { margin: 0; }
h1 { text-wrap: balance; }
p { text-wrap: pretty; }
*:focus { outline: none; }
[hidden] { display: none !important; }
.noscript { padding: 24px; }

/* Layout: the spread ------------------------------------------------------ */
.desk {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 32px;
  box-sizing: border-box;
}
.book {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 1060px;
  height: min(760px, calc(100vh - 72px));
  perspective: 2600px;
  transform-style: preserve-3d;
  box-shadow: var(--shadow-lg);
  border-radius: 2px;
}
/* On a large screen (a projector, a shared display) the spread scales up to
   fill the viewport, keeping its proportions. app.js sets the zoom factor. */
.book.zoomed { height: 760px; }
.sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  box-sizing: border-box;
  background: var(--color-bg-elevated);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.verso { padding: 34px 34px 30px 48px; border-right: none; border-radius: 2px 0 0 2px; }
.recto { padding: 34px 48px 26px 34px; border-radius: 0 2px 2px 0; }
.edge {
  position: absolute; top: 5px; bottom: 5px; width: 5px; z-index: 0;
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 2px;
}
.edge.left { left: -5px; border-right: none; }
.edge.right { right: -5px; border-left: none; }
.gutter {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 56px; margin-left: -28px;
  pointer-events: none; z-index: 4;
  background: linear-gradient(to right, rgba(21,28,40,0) 0%, rgba(21,28,40,0.05) 38%, rgba(21,28,40,0.13) 50%, rgba(21,28,40,0.05) 62%, rgba(21,28,40,0) 100%);
}
.leaf { position: absolute; inset: 0; pointer-events: none; z-index: 8; }

/* Small caps labels ------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-semicond);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-secondary);
}
.recto-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--color-border);
}
.recto-head .eyebrow { white-space: nowrap; }
.head-back { display: none; }
.head-back:not([hidden]) + .eyebrow { margin-left: auto; }
.tag { color: var(--color-warning); }

/* Verso: title page and the trail ----------------------------------------- */
.verso-inner { display: flex; flex-direction: column; height: 100%; }
.verso-head { padding-bottom: 10px; border-bottom: 1px solid var(--color-border); }
.verso-title { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.verso-title h1 { font-size: 30px; line-height: 1.2; color: var(--color-heading); margin-bottom: 18px; letter-spacing: -.02em; font-weight: 700; }
.verso-title p { font-size: 16px; line-height: 1.6; color: var(--color-text-soft); }
.trail { flex: 1; display: flex; flex-direction: column; padding-top: 4px; overflow-y: auto; overflow-x: hidden; min-width: 0; scrollbar-width: thin; }
.trail-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 0 11px; border-bottom: 1px solid var(--color-border); }
.trail-item .q { font-size: 13px; line-height: 1.4; color: var(--color-muted); }
.trail-item .a { font-size: 15px; line-height: 1.45; color: var(--color-heading); overflow-wrap: anywhere; }
.trail-empty { flex: 1; display: flex; align-items: center; font-size: 15px; line-height: 1.5; color: var(--color-muted-soft); }

/* Recto: the stage -------------------------------------------------------- */
.stage {
  flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; scrollbar-width: thin;
  padding-right: 16px;
  transition: opacity 120ms linear;
}
.stage::-webkit-scrollbar { width: 6px; }
.stage::-webkit-scrollbar-thumb { background: rgba(47,59,104,0.14); border-radius: 999px; }
.stage.fade { opacity: 0; }
.qblock { display: flex; flex-direction: column; padding: 18px 0; }
.qblock.centered { justify-content: center; flex: 1; }
h1.q {
  font-size: var(--q-size); line-height: 1.25; color: var(--color-heading);
  margin-bottom: 16px; font-weight: 700; letter-spacing: -.02em;
}
h1.q.sticky { position: sticky; top: 0; z-index: 2; background: var(--color-bg-elevated); padding-bottom: 6px; margin-bottom: 10px; }
.helper-panel { border-top: 1px solid var(--color-heading); padding: 14px 0 2px; margin-bottom: 10px; }
.helper-panel p { font-size: var(--h-size); line-height: 1.5; color: var(--color-heading); }
.counter { margin: -6px 0 14px; }
.opts { display: flex; flex-direction: column; border-bottom: 1px solid var(--color-border); }
.opt-group { display: block; }
.opt-group.pinned { margin-top: 28px; }
.opt {
  display: flex; align-items: center; gap: 13px; width: 100%; min-height: 48px;
  padding: 13px 12px; border: none; border-top: 1px solid var(--color-border); border-radius: 0;
  background: transparent; font-size: 16px; line-height: 1.4; color: var(--color-text);
  text-align: left; cursor: pointer; box-sizing: border-box;
  transition: background 120ms var(--ease-standard);
}
@media (hover: hover) { .opt:hover:not(.selected) { background: rgba(47,59,104,0.035); } .opt:hover .mark { border-color: var(--color-secondary); } }
.opt:focus-visible { box-shadow: var(--focus-inset); }
.opt.selected { background: var(--color-surface); }
.opt .mark {
  flex: none; width: 19px; height: 19px; border-radius: 999px;
  border: 1.5px solid var(--color-muted-soft); background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms, border-color 120ms;
}
.opt.multi .mark { border-radius: 3px; }
.opt.selected .mark { border-color: var(--color-heading); }
.opt.multi.selected .mark { background: var(--color-heading); }
.opt .dot { width: 9px; height: 9px; border-radius: 999px; background: var(--color-primary); }
.opt .tick { display: none; }
.opt.multi.selected .tick { display: block; }
.opt.single.selected .dot { display: block; }
.opt.single .dot { display: none; }
.opt .label { font-size: 16px; color: var(--color-text); font-weight: 400; }
.opt.selected .label { color: var(--color-heading); font-weight: 500; }
.opt.escape { margin-top: 18px; border-bottom: 1px solid var(--color-border); }
.opt.consent { margin-top: 26px; min-height: 52px; padding: 14px 12px; border-bottom: 1px solid var(--color-border); }
.opt.check-first { margin-top: 18px; }
.opt.check-last { border-bottom: 1px solid var(--color-border); }

.reveal { display: flex; flex-direction: column; gap: 6px; padding: 16px 0 0 32px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.fields { display: flex; flex-direction: column; gap: 16px; }
.reveal input, .field input {
  height: 44px; width: 100%; padding: 0 2px; border: none; border-radius: 0;
  border-bottom: 1px solid var(--color-muted-soft); background: transparent;
  font-size: 16px; color: var(--color-text); box-sizing: border-box;
}
.reveal input:focus, .field input:focus { border-bottom: 1.5px solid var(--color-heading); box-shadow: 0 3px 0 -1px rgba(118,207,191,0.55); }
textarea.open {
  display: block; width: 100%; min-height: 128px; margin-top: 8px; padding: 0 2px;
  border: none; border-radius: 0; background-color: transparent;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--color-border) 31px, var(--color-border) 32px);
  font-size: 16px; line-height: 32px; color: var(--color-text); resize: none; box-sizing: border-box;
  overflow: hidden;
}
textarea.open.one-line { min-height: 64px; }
textarea.open:focus { box-shadow: var(--focus); }
textarea.open.dim { opacity: .45; }
.error { margin-top: 12px; font-size: 14px; color: var(--color-danger); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Consent, draw and completion -------------------------------------------- */
.consent-block { display: flex; flex-direction: column; justify-content: center; flex: 1; padding: 22px 0 6px; }
.consent-prose { display: flex; flex-direction: column; gap: 14px; font-size: 16px; line-height: 1.6; color: var(--color-text-soft); }
.consent-title { display: none; }
.consent-title h1 { font-size: 30px; line-height: 1.2; color: var(--color-heading); margin-bottom: 18px; letter-spacing: -.02em; font-weight: 700; }
.draw { display: flex; flex-direction: column; justify-content: center; flex: 1; padding: 20px 0; }
.draw h1 { font-size: var(--q-size); line-height: 1.25; color: var(--color-heading); margin-bottom: 14px; letter-spacing: -.02em; font-weight: 700; }
.draw .lead { font-size: var(--h-size); line-height: 1.5; color: var(--color-secondary); margin-bottom: 22px; }
.draw .sentence { margin-top: 14px; font-size: 14px; line-height: 1.5; color: var(--color-muted); }
.terminal { display: flex; flex-direction: column; justify-content: center; flex: 1; padding: 24px 0; }
.terminal .rule { width: 52px; height: 2px; margin-bottom: 24px; background: var(--color-primary); }
.terminal h1 { font-size: 33px; line-height: 1.2; color: var(--color-heading); margin-bottom: 18px; letter-spacing: -.02em; font-weight: 700; }
.terminal p { font-size: 17px; line-height: 1.6; color: var(--color-text-soft); }
.sync { margin-top: 28px; font-size: 14px; line-height: 1.5; color: var(--color-muted); }
.sync.warn { color: var(--color-warning); }
.sync.bad { color: var(--color-danger); }
.again { margin-top: 18px; }

/* Nav ----------------------------------------------------------------------- */
.nav {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--color-border); padding: 16px 0 0; margin-top: 14px;
}
.nav .right { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: flex-end; }
.nav.consent { justify-content: flex-end; }
.btn-text {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  border: none; background: transparent; color: var(--color-secondary); font-size: 16px; cursor: pointer;
  transition: color 120ms var(--ease-standard);
}
.btn-text:hover { color: var(--color-heading); }
.btn-text:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 26px;
  border-radius: 6px; font-size: 16px; font-weight: 600; cursor: pointer; box-sizing: border-box;
  transition: background 180ms var(--ease-standard), color 180ms var(--ease-standard);
}
.btn-primary { border: none; background: var(--color-primary); color: var(--color-heading); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.btn-primary:disabled { background: #e3ebe9; color: var(--color-muted-soft); cursor: not-allowed; }
.btn-secondary { border: 1.5px solid var(--color-heading); background: transparent; color: var(--color-heading); }
.btn-secondary:hover { background: var(--color-heading); color: #ffffff; }
.btn-primary:focus-visible, .btn-secondary:focus-visible { box-shadow: var(--focus); }

/* Sync panel (?sync=1) -------------------------------------------------------- */
.sync-panel {
  position: fixed; right: 16px; bottom: 16px; width: min(360px, calc(100vw - 32px)); max-height: 72vh; overflow: auto;
  background: #1c2240; color: #f7fbfa; border-radius: 8px; padding: 18px; box-shadow: var(--shadow-lg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6; z-index: 50;
}
.sync-panel .eyebrow { color: var(--color-primary); }
.sync-panel .row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px solid rgba(247,251,250,0.08); }
.sync-panel .row span:first-child { color: #97b6bb; }
.sync-panel .row span:last-child { text-align: right; word-break: break-word; }
.sync-panel button {
  margin-top: 10px; width: 100%; min-height: 40px; border: 1px solid var(--color-primary); border-radius: 6px;
  background: transparent; color: var(--color-primary); font-family: var(--font-body); font-size: 14px; font-weight: 600; cursor: pointer;
}
.sync-panel button.plain { border-color: #97b6bb; color: #97b6bb; }

/* Phones: one sheet, app chrome, question in the middle, actions pinned -- */
@media (max-width: 899px) {
  html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }
  .desk {
    position: fixed;
    top: var(--app-top, 0px);
    left: 0;
    right: 0;
    padding: 0;
    align-items: stretch;
    height: var(--app-height, 100dvh);
    min-height: 0;
  }
  .book {
    height: 100%;
    min-height: 100%;
    max-width: none;
    box-shadow: none;
    perspective: none;
    border-radius: 0;
  }
  .verso, .edge, .gutter { display: none; }
  .recto {
    border: none;
    border-radius: 0;
    height: 100%;
    min-height: 100%;
    padding: calc(8px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  }
  .recto:has(.nav[hidden]) {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .recto-head { min-height: 44px; padding-bottom: 8px; }
  .head-back:not([hidden]) {
    display: inline-flex;
    min-height: 44px;
    padding: 0 8px 0 0;
    margin: 0;
  }
  .stage {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .qblock,
  .consent-block,
  .draw,
  .terminal {
    width: 100%;
    margin-block: auto;
    flex: none;
  }
  .qblock { padding: 8px 0 12px; }
  .qblock.centered { justify-content: flex-start; flex: none; }
  .nav {
    position: relative;
    flex: none;
    background: var(--color-bg-elevated);
    padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    margin-top: 0;
    border-top: 1px solid var(--color-border);
  }
  .nav.consent { display: block; }
  .nav.consent .btn-primary,
  .nav.bonus .btn-primary {
    width: 100%;
    min-height: 52px;
  }
  .nav .right { flex: 1; }
  .nav .right .btn-primary { width: 100%; min-height: 52px; }
  .nav.draw .right { width: 100%; }
  .nav.draw .right .btn-primary,
  .nav.draw .right .btn-secondary { width: auto; min-height: 52px; flex: 1; }
  .consent-title { display: block; }
  .consent-title h1 { font-size: 26px; margin-bottom: 10px; }
  .consent-block { justify-content: flex-start; padding: 8px 0 0; }
  .opt { min-height: 52px; padding: 14px 8px; }
  .opt .label { font-size: 17px; }
  .draw { justify-content: flex-start; padding: 4px 0 8px; }
  .draw h1 { font-size: 22px; margin-bottom: 6px; }
  .kit { margin: 0 0 6px; font-size: 13px; line-height: 1.4; }
  .draw .lead { font-size: 15px; margin-bottom: 10px; }
  .draw .sentence { margin-top: 8px; font-size: 13px; }
  .fields { gap: 8px; }
  .legal { margin-top: 8px; font-size: 11px; line-height: 1.4; }
  .opt.check-first { margin-top: 8px; }
  .cover { padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cover-title { font-size: clamp(28px, 8vw, 36px); margin-bottom: 28px; }
  .cover-button { width: 100%; min-height: 52px; }
}
@media (max-width: 899px) and (max-height: 500px) {
  .cover { padding-top: 20px; }
  .cover-title { font-size: 26px; margin-bottom: 16px; }
  .cover-brand { margin-bottom: 14px; }
  .opt { min-height: 44px; padding: 10px 8px; }
  h1.q { font-size: 20px; margin-bottom: 8px; }
  .draw h1 { font-size: 20px; }
}
@media (max-height: 719px) { :root { --q-size: 23px; --h-size: 16px; } h1.q { margin-bottom: 12px; } .qblock { padding: 12px 0; } }
@media (max-height: 619px) { :root { --q-size: 20px; --h-size: 15px; } h1.q { margin-bottom: 8px; } .qblock { padding: 2px 0; } textarea.open { min-height: 64px; } }
@media (prefers-reduced-motion: reduce) {
  .opt, .btn-text, .btn-primary, .btn-secondary, .opt .mark, .book { transition: none; }
}

/* T26: two equal buttons, neither smaller than the other; Back keeps its own row. */
.nav.draw { flex-direction: column; align-items: stretch; gap: 10px; }
.nav.draw .right { display: flex; flex-wrap: nowrap; gap: 12px; }
.nav.draw .right button { flex: 1; padding: 0 12px; white-space: nowrap; }
.nav.draw > span:first-child { display: none; }

/* Thank-you and the bonus after it ------------------------------------------ */
.bonus-offer { margin-top: 28px; }
.finish { margin-top: 12px; }
.bonus-offer + .finish { margin-top: 12px; }
.sync + .finish { margin-top: 28px; }
.btn-secondary.wide, .btn-primary.wide { width: 100%; }
.nav.bonus > span:first-child { display: none; }
.nav.bonus .right { flex: 1; }
.lead-line { font-size: var(--h-size); line-height: 1.5; color: var(--color-secondary); margin-bottom: 12px; }

/* The closed book: only the front cover shows, hinged at the spine ----------- */
.book { transition: transform 700ms cubic-bezier(0.4, 0.02, 0.25, 1); }
.book.closed { box-shadow: none; transform: translateX(-25%); }
.book.closed .verso, .book.closed .edge, .book.closed .gutter { visibility: hidden; }
.book.closed .recto {
  background-color: #1a2748;
  background-image:
    linear-gradient(165deg, rgba(18, 28, 48, 0.38) 0%, rgba(18, 28, 48, 0.08) 46%, rgba(18, 28, 48, 0.22) 100%),
    url("cover.jpg");
  background-size: cover;
  background-position: 100% 100%;
  background-repeat: no-repeat;
  border-color: #1a2748;
  border-radius: 3px 10px 10px 3px; box-shadow: var(--shadow-lg);
}
.book.closed .recto-head, .book.closed .nav { display: none; }
.cover { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; color: #ffffff; padding: 24px 0; position: relative; z-index: 1; }
.cover-brand { font-family: var(--font-semicond); font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--color-primary); margin-bottom: 26px; }
.cover-title { font-size: 33px; line-height: 1.15; color: #ffffff; letter-spacing: -.02em; font-weight: 700; margin-bottom: 36px; max-width: 11em; }
.cover-button { padding: 0 30px; }
.cover-prize { margin-top: 22px; font-size: 16px; line-height: 1.45; color: rgba(247, 251, 250, 0.86); max-width: 22em; }
.kit { font-size: 15px; line-height: 1.5; color: var(--color-heading); margin: -6px 0 16px; }
.legal { margin-top: 18px; font-size: 12px; line-height: 1.45; color: var(--color-secondary); }
@media (max-width: 899px) {
  .book.closed { transform: none; }
  .book.closed .recto {
    border-radius: 0; box-shadow: none;
    background-position: 88% 100%;
  }
  .cover { justify-content: flex-start; padding-top: min(18vh, 140px); }
}
