/* ═══════════════════════════════════════════════════════════════
   Quiz-Gen — "Modern Academy" tokens, shared with omri-iram.co.il
   and Site-quiz: deep navy authority, ochre CTA, light blue surfaces.
   Rubik (display) + Assistant (UI). RTL throughout.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #f9f9ff;
  --bg-alt: #f0f3ff;
  --bg-card: #ffffff;
  --bg-chip: #dee8ff;

  --navy: #002045;
  --navy-container: #1a365d;
  --navy-soft: #d6e3ff;

  --ochre: #ffc250;
  --ochre-deep: #d69e2e;
  --ochre-text: #7d5700;
  --ochre-soft: #ffdeaa;

  --ink: #121c2c;
  --ink-soft: #43474e;
  --line: #c4c6cf;
  --error: #ba1a1a;
  --ok: #1a7f37;

  --shadow-soft: 0 4px 12px rgba(18, 28, 44, .05);
  --shadow-lift: 0 8px 16px rgba(18, 28, 44, .08);
  --radius: 8px;
  --radius-card: 16px;
  --font-display: "Rubik", sans-serif;
  --font-ui: "Assistant", sans-serif;

  /* The space between a headline and the line under it. One number, here,
     so it can be tuned without hunting for the rule. */
  --lede-gap: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(214, 227, 255, .55), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(255, 222, 170, .35), transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; }
.wrap-wide { max-width: 1040px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; color: var(--navy); }
h1 { font-size: clamp(24px, 5vw, 34px); font-weight: 700; }
h2 { font-size: clamp(19px, 3.5vw, 24px); font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
p { margin-bottom: 12px; }
a { color: var(--navy-container); }

/* ── progress ─────────────────────────────────────────── */
.progress {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 12px 0 10px;
  margin-bottom: 8px;
}
/* 10px and a visible edge on the track: at 6px on --navy-soft the bar vanished
   into the page on a phone, and Omri reported there was none. */
.progress-track {
  height: 10px; border-radius: 99px; background: var(--bg-chip); overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 32, 69, .12);
}
/* Full width, slid out of the track and back in, rather than a width that
   animates: width is a layout property and animating it re-lays-out the page
   on every frame. translateX only composites.

   It slides along X, not the inline axis — CSS transforms are physical, so
   positive X is right whatever the direction. This document is always RTL and
   the bar fills from the right, so 0% progress is translateX(100%) (parked off
   the right edge) and full is translateX(0). quiz.js writes that; the pill ends
   stay circular because nothing is being squashed. */
.progress-fill {
  height: 100%; width: 100%; background: var(--navy); border-radius: 99px;
  transform: translateX(100%); transition: transform .3s ease;
}
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
.progress-label {
  font-size: 15px; color: var(--ink-soft); margin-top: 8px; text-align: center;
}
.progress-label strong { color: var(--navy); font-weight: 700; }

/* ── cards ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: clamp(20px, 4vw, 32px);
  margin-bottom: 16px;
}

.lede { color: var(--ink-soft); font-size: 17px; }
/* Headings carry no margin of their own, so without this the lede sat flush
   under the headline. Only after a heading: a lede alone in a card (the empty
   stats page) must not be pushed down. */
h1 + .lede, h2 + .lede { margin-top: var(--lede-gap); }

/* The quiz's own headline, one step up from the shared h1 (24–34px), which
   the admin pages, the 404 and the result title keep. It is the first thing a
   respondent reads and the only h1 that has to sell anything. */
#screen-intro h1 { font-size: clamp(32px, 7vw, 44px); }

/* ── answers ──────────────────────────────────────────── */
.question-text {
  font-family: var(--font-display); font-size: clamp(19px, 4vw, 24px);
  font-weight: 600; color: var(--navy); margin-bottom: 20px;
}

/* **bold** inside copy that is ALREADY heavy. A <strong> renders at 700, which
   is one step from a 600 question and no step at all from a 700 heading — the
   emphasis Omri typed would simply not be visible, and the feature would look
   broken. 800 is a step the eye registers at a glance.

   Body copy (options at 400, outcome text at 400) needs nothing: the default
   700 already stands out there. */
h1 strong, h2 strong, h3 strong,
.question-text strong,
.outcome-title strong { font-weight: 800; }

/* [text](url) inside that same copy. Underlined, not just coloured: this sits
   in the middle of a sentence a respondent is reading, and colour alone is not
   something everyone can see. The offset keeps the line off the Hebrew
   descenders. */
.lede a, .question-text a, .outcome-body a, .why-text a, .next-text a,
h1 a, .outcome-title a {
  color: inherit; font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 3px; text-decoration-color: var(--ochre);
}
.lede a:hover, .question-text a:hover, .outcome-body a:hover,
.why-text a:hover, .next-text a:hover, h1 a:hover, .outcome-title a:hover {
  text-decoration-color: var(--navy);
}
/* The next-step panel is navy, so an ochre underline there is the one that
   reads and a navy hover would vanish into the background. */
.next .next-text a { text-decoration-color: var(--ochre); }
.next .next-text a:hover { text-decoration-color: #fff; }

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: block; width: 100%; text-align: right;
  background: var(--bg-alt);
  border: 2px solid transparent;
  border-radius: var(--radius-card);
  padding: 15px 18px;
  font: inherit; font-size: 16px; color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.option:hover { background: var(--bg-chip); }
.option:active { transform: scale(.995); }
.option:focus-visible { outline: 3px solid var(--ochre-deep); outline-offset: 2px; }
/* Selection is shown only after a click. Nothing is ever pre-selected — a
   default answer is an answer the respondent did not give. */
.option.is-picked { background: var(--navy-soft); border-color: var(--navy); }

/* A multi-select option carries a checkbox glyph so the respondent can tell
   "pick several" from "pick one" without reading the hint. */
.multi-hint { color: var(--muted, #667); font-size: 14px; margin: -10px 0 14px; }
.option-multi { display: flex; align-items: center; gap: 12px; }
.option-multi::before {
  content: ""; flex: 0 0 auto; width: 20px; height: 20px;
  border: 2px solid var(--navy); border-radius: 5px; background: #fff;
  transition: background .15s;
}
.option-multi.is-picked::before {
  background: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 16px; background-position: center; background-repeat: no-repeat;
}
.option-multi.is-maxed:not(.is-picked) { opacity: .45; cursor: default; }

/* ── buttons ──────────────────────────────────────────── */
.btn {
  display: inline-block; border: none; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 16px;
  padding: 13px 26px; border-radius: var(--radius);
  background: var(--ochre); color: var(--navy);
  transition: background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--ochre-deep); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line); font-weight: 600;
}
.btn-ghost:hover { background: var(--bg-alt); }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--ink-soft); font-size: 14px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; box-sizing: border-box; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-between { justify-content: space-between; }
.spacer { flex: 1; }

/* ── gender picker ────────────────────────────────────── */
.gender {
  display: flex; gap: 10px; margin: 18px 0 4px;
}
.gender button {
  flex: 1; font: inherit; font-weight: 600; cursor: pointer;
  padding: 12px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--bg-card); color: var(--ink);
}
.gender button.is-picked { border-color: var(--navy); background: var(--navy-soft); }
.gender-hint { font-size: 14px; color: var(--ink-soft); }

/* ── forms ────────────────────────────────────────────── */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 16px;
  padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-card); color: var(--ink);
  /* Explicit, not inherited: an RTL page with an LTR input (an email field,
     a URL field) still has to place the caret and the text correctly. */
  direction: rtl;
}
input[type=email], input[type=url], input.ltr { direction: ltr; text-align: left; }
textarea { min-height: 120px; resize: vertical; font-family: var(--font-ui); }
textarea.code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  direction: ltr; text-align: left; font-size: 13px; min-height: 420px;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--navy-container); outline-offset: 1px;
}
.is-invalid { border-color: var(--error); }
.field { margin-bottom: 14px; }
/* An input with its bold button. The button is square-ish and the same height
   as the field, so a column of them reads as part of the form rather than as
   a toolbar bolted on top of it. */
/* The marker buttons sit at the TOP of the field, not stretched down it: the
   copy fields are textareas that grow to their content, and a B two hundred
   pixels tall next to a long outcome body reads as a panel rather than as a
   control. */
.bold-wrap { display: flex; gap: 6px; align-items: flex-start; }
.bold-wrap input, .bold-wrap textarea { flex: 1; min-width: 0; }
.bold-btn, .link-btn {
  flex: none; height: 48px; padding: 0 15px; font-weight: 800; font-size: 17px;
  line-height: 1; color: var(--ink);
}
.link-btn { font-size: 15px; }
.field-hint { font-size: 13px; color: var(--ink-soft); font-weight: 400; margin-top: 4px; }

/* ── messages ─────────────────────────────────────────── */
.error, .notice {
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
  font-size: 15px;
}
.error { background: #ffdad6; color: #410002; }
.notice { background: var(--ochre-soft); color: var(--ochre-text); }
.notice a { color: inherit; font-weight: 600; white-space: nowrap; }
/* The admin's "this one counts" notice. Red on purpose: it is the mode in
   which a test walk-through lands in the stats and fires the integrations. */
.notice-real { background: #ffdad6; color: #410002; }
.error ul { margin: 6px 18px 0 0; }

/* ── result: the persona reveal ───────────────────────────
   The screen is a reveal, not a report card. Everything below is shaped by
   one rule: on a 390px phone the emoji, the type name, the body and the CTA
   fit without scrolling, and the last thing above the fold is the button.

   Painted twice on purpose -- Jinja for the share page, quiz.js for the live
   result, same classes and structure. Change both or neither. */
.reveal { text-align: center; margin-bottom: 20px; }
/* Big, because it is the thing the eye lands on and the thing a screenshot
   is recognised by. line-height 1 so it does not carry a band of dead space
   above the name. */
.reveal-emoji { font-size: 72px; line-height: 1; margin-bottom: 6px; }
.reveal-kicker {
  margin: 0 0 2px; font-size: 14px; font-weight: 600; letter-spacing: .04em;
  color: var(--ink-soft);
}
.reveal .outcome-title { margin-bottom: 0; }

/* ── the journey gauge ────────────────────────────────────
   A row of named stages, filled up to the one the respondent reached. It is
   a road, not a ruler: no ticks, no numbers, no percentage. `done` and
   `here` are navy, `here` carries the ochre marker, `ahead` is the pale
   track. Equal columns via grid, so the cells need no inline widths. */
.journey { margin: 4px 0 22px; }
.journey-kicker {
  margin: 0 0 8px; text-align: center; font-size: 13px; font-weight: 600;
  letter-spacing: .04em; color: var(--ink-soft);
}
.journey-track, .journey-labels {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
}
.journey-cell {
  height: 12px; border-radius: 99px; background: var(--navy-soft);
  position: relative;
}
.journey-cell.is-done { background: var(--navy); }
.journey-cell.is-here {
  background: var(--navy);
  box-shadow: inset 0 0 0 3px var(--ochre);
}
.journey-labels { margin-top: 7px; }
.journey-label {
  text-align: center; font-size: 13px; line-height: 1.3; color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.journey-label.is-here { color: var(--navy); font-weight: 700; }
.journey-label.is-ahead { opacity: .7; }

/* ── the mirror and the gap ──────────────────────────────
   Parts 2 and 3 of the result: what already works (a green edge), the quiet
   bottleneck (an ochre edge), then the missing piece on the pale-blue ground
   the next panel will pick up. Flat cards inside the card; the CTA below
   stays the only element with depth. */
.mirror { display: grid; gap: 10px; margin-top: 18px; }
.mirror-item {
  padding: 12px 14px; border-radius: 12px; background: var(--bg-alt);
  border-inline-start: 4px solid var(--line);
}
.mirror-good { border-inline-start-color: var(--ok); }
.mirror-leak { border-inline-start-color: var(--ochre-deep); }
.mirror-label {
  margin: 0 0 4px; font-family: var(--font-display); font-size: 14px;
  font-weight: 700; color: var(--navy);
}
.mirror-text { font-size: 16px; line-height: 1.5; white-space: pre-line; }
.gap {
  margin-top: 14px; padding: 14px 16px; border-radius: 12px;
  background: var(--navy-soft);
}
.gap-label {
  margin: 0 0 4px; font-family: var(--font-display); font-size: 14px;
  font-weight: 700; color: var(--navy);
}
.gap-text { font-size: 17px; line-height: 1.5; white-space: pre-line; }

/* The share, under the CTA: conversion first, virality second. Deliberately
   FLAT -- the CTA above it is the only element on this page that spends any
   depth, and a second raised button would be arguing with it. */
.share-wa {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-top: 12px; padding: 15px 20px;
  border-radius: 12px; background: #25d366; color: #05391a;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  text-decoration: none; transition: background .15s;
}
.share-wa:hover { background: #1fbe5a; }
.share-wa:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }

/* The other types, below the fold. Curiosity, and a reason to send the link
   on. Nothing here is clickable. */
.types { margin-top: 22px; }
.types-head {
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
  color: var(--navy); margin: 0 0 10px;
}
.type-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 15px; margin-bottom: 8px;
  background: var(--bg-card); border-radius: 12px;
  box-shadow: var(--shadow-soft);
}
.type-emoji { flex: none; font-size: 28px; line-height: 1.2; }
.type-copy { min-width: 0; }
.type-title {
  font-weight: 700; color: var(--navy); font-size: 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.type-teaser {
  margin: 3px 0 0; font-size: 15px; line-height: 1.45; color: var(--ink-soft);
}
/* The respondent's own row is marked in place, never moved to the top: the
   list is the quiz's cast of characters, and reordering it per respondent
   would make two people's screenshots of the same quiz disagree. */
.type-row.is-mine { box-shadow: inset 0 0 0 2px var(--ochre), var(--shadow-soft); }
.type-me {
  flex: none; background: var(--ochre); color: var(--ochre-text);
  border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 700;
}

.outcome-title {
  font-family: var(--font-display); font-size: clamp(26px, 6vw, 38px);
  font-weight: 700; color: var(--navy); letter-spacing: -.015em;
  margin-bottom: 12px;
}
.outcome-body { font-size: 19px; line-height: 1.55; white-space: pre-line; }

/* "Why this result" folded away. It is the second question a reader asks,
   and open by default it pushed the button below the fold on a phone. */
.why { margin-top: 24px; border-top: 1px solid var(--line); }
.why summary {
  display: flex; align-items: center; gap: 8px; list-style: none;
  padding: 15px 0 0; cursor: pointer;
  font-weight: 600; font-size: 15px; color: var(--ink-soft);
}
.why summary::-webkit-details-marker { display: none; }
.why summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin-top: -4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .15s;
}
.why[open] summary::after { transform: rotate(225deg); margin-top: 2px; }
.why summary:focus-visible { outline: 2px solid var(--navy-container); outline-offset: 4px; }
.why-text {
  padding: 10px 0 2px; white-space: pre-line;
  font-size: 16px; color: var(--ink-soft);
}

/* ── the author card ─────────────────────────────────────
   Who is behind the quiz (settings.show_author, absent = OFF). Two sizes of
   one thing: a byline at the top of the intro, and a card directly above the
   action panel — who is inviting, then the invitation. Both are FLAT: a
   hairline and a round photo, no ground and no shadow, because the CTA is
   still the only element on the page that spends any depth. */
.author-byline {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
  font-size: 14px; line-height: 1.35; color: var(--ink-soft);
}
.author-byline img, .author-card img {
  flex: none; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--bg-chip);
}
.author-card {
  display: flex; align-items: flex-start; gap: 14px;
  margin-top: 26px; padding-top: 20px;
  border-top: 1px solid var(--line);
}
.author-bio {
  font-size: 15.5px; line-height: 1.55; color: var(--ink);
  white-space: pre-line;
}
.author-byline a, .author-bio a {
  color: inherit; font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 3px; text-decoration-color: var(--ochre);
}
/* The card and the panel under it are one thought, so the panel gives up
   most of its own top margin. */
.author-card + .next { margin-top: 18px; }

/* The action panel. The next step and the button that carries it out are
   one object on a navy ground, so the end of the card is unmistakably the
   thing to do — not a third paragraph with a link after it. */
.next {
  margin-top: 26px; padding: 22px; border-radius: var(--radius-card);
  background: var(--navy);
}
.next-text {
  margin: 0 0 18px; color: #dbe6f7; font-size: 17px; line-height: 1.5;
  white-space: pre-line;
}
.btn-cta {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 19px 24px; border-radius: 12px;
  font-size: clamp(18px, 4.5vw, 21px); font-weight: 700;
  /* A solid ledge in the pressed-shade rather than a blur: on a navy panel
     it reads as a physical key, and it is the one place on the page that
     spends any depth at all. */
  box-shadow: 0 5px 0 var(--ochre-deep);
  transition: transform .1s, box-shadow .1s, background .15s;
}
.btn-cta:hover { background: #ffce70; }
.btn-cta:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ochre-deep); }
.btn-cta:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.next-alt {
  display: block; text-align: center; margin-top: 16px;
  font-size: 14px; color: var(--ink-soft);
}
.share-box {
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}
.share-box input { flex: 1; min-width: 220px; }

/* ── admin ────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td {
  text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th { font-weight: 700; color: var(--navy); font-size: 14px; }
.table-scroll { overflow-x: auto; }

.badge {
  display: inline-block; border-radius: 99px; padding: 2px 10px;
  font-size: 13px; font-weight: 700;
}
.badge-draft { background: var(--bg-chip); color: var(--navy-container); }
.badge-published { background: #d7f5dd; color: #0b5c22; }
.badge-ok { background: #d7f5dd; color: #0b5c22; }
.badge-failed { background: #ffdad6; color: #410002; }
.badge-pending { background: var(--ochre-soft); color: var(--ochre-text); }

.bar-track {
  height: 10px; background: var(--bg-alt); border-radius: 99px; overflow: hidden;
  min-width: 90px;
}
.bar-fill { height: 100%; background: var(--navy); }

.topbar {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 14px 0; margin-bottom: 10px; border-bottom: 1px solid var(--line);
}
.topbar .brand { font-family: var(--font-display); font-weight: 700; color: var(--navy); }
.muted { color: var(--ink-soft); font-size: 14px; }
.mono { font-family: ui-monospace, Consolas, monospace; direction: ltr;
        display: inline-block; font-size: 13px; }
/* The quiz serial number. It IS quizzes.id -- the same number that is
   already in every /admin/<id>/... URL -- shown so a quiz can be named
   out loud ("#3") instead of by its Hebrew title. */
.qid { font-family: ui-monospace, Consolas, monospace; direction: ltr;
       display: inline-block; font-size: 13px; font-weight: 400;
       color: var(--ink-soft); white-space: nowrap; }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  .wrap { padding: 16px 14px 60px; }
  .card { padding: 18px 16px; }
  .next { padding: 18px 16px; }
  .reveal-emoji { font-size: 64px; }
}

/* stats: the source row currently used as the page filter */
.table tr.row-selected td { background: var(--ochre-soft); }

@media (prefers-reduced-motion: reduce) {
  .btn-cta, .share-wa, .why summary::after { transition: none; }
}

/* Strengths and gaps (stats). Three segments in one track: how many
   respondents came out low / mid / high on each question. One hue getting
   darker, not red-to-green — this is a teaching signal, not a pass/fail,
   and the reading order (light to dark) has to match low to high or the
   bar says the opposite of what it means. */
.strength-bar { display: flex; }
.strength-low { background: var(--navy-soft); }
.strength-mid { background: #7fa3dd; }
.strength-high { background: var(--navy); }
.strength-low, .strength-mid, .strength-high { height: 100%; }
