/* =============================================================================
   /dvi - Deception Vulnerability Index working prototype
   =============================================================================
   Brand values come from ../shared/brand-tokens.css (--flggd-*).
   Everything below maps those onto local roles so light/dark both work and
   so nothing hardcodes a brand colour.
   Built for a handheld demo: touch targets >=44px, no hover-only affordances.
   ========================================================================== */

:root {
  --ink:        var(--flggd-ink, #1e3a4c);
  --ink-2:      var(--flggd-text, #5e7a8a);
  --ground:     var(--flggd-surface, #f9fafb);
  --surface:    var(--flggd-surface-raised, #ffffff);
  --line:       var(--flggd-line, #dfe8ed);
  --teal:       var(--flggd-teal-dark, #0e9a95);
  --teal-br:    var(--flggd-primary, #1dbab4);
  --teal-wash:  #e2f4f3;
  --coral:      #d9553f;
  --coral-wash: #fbeae6;
  --amber:      #b8791f;
  --amber-wash: #fbf1e0;
  --mist:       var(--flggd-muted, #8ba5b5);
  --font:       var(--flggd-font, Mulish, system-ui, sans-serif);
  --mono:       var(--flggd-font-mono, "IBM Plex Mono", ui-monospace, monospace);
  --radius:     var(--flggd-radius, 12px);
  --shadow:     0 1px 2px rgba(30,58,76,.06), 0 10px 28px -14px rgba(30,58,76,.22);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:#e8f2f2; --ink-2:#c2d6dc; --ground:#12232c; --surface:#19303b; --line:#2c4956;
    --teal:#3dd4ce; --teal-br:#5fe3dd; --teal-wash:#12383a;
    --coral:#f2836e; --coral-wash:#3a241f; --amber:#e0a94f; --amber-wash:#382c15; --mist:#8ba5b5;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.65);
  }
}
:root[data-theme="dark"] {
  --ink:#e8f2f2; --ink-2:#c2d6dc; --ground:#12232c; --surface:#19303b; --line:#2c4956;
  --teal:#3dd4ce; --teal-br:#5fe3dd; --teal-wash:#12383a;
  --coral:#f2836e; --coral-wash:#3a241f; --amber:#e0a94f; --amber-wash:#382c15; --mist:#8ba5b5;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.65);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* iPad: stop rubber-band scroll revealing white behind the app */
  overscroll-behavior-y: none;
}

.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 26px 18px calc(72px + env(safe-area-inset-bottom));
}

h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4.2vw, 2.45rem); font-weight: 900; letter-spacing: -.022em; }
h2 { font-size: clamp(1.15rem, 2.6vw, 1.5rem);  font-weight: 800; letter-spacing: -.012em; }
h3 { font-size: 1rem; font-weight: 800; }
p  { margin: 0; }

.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--teal);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.card  { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); padding: 20px; }
.lede  { color: var(--ink-2); max-width: 64ch; }
.small { font-size: .9rem; }
.hidden { display: none !important; }

/* Tab panels carry .stack (display:flex), which outranks the user-agent
   [hidden]{display:none}. Without this every panel renders at once. */
[hidden] { display: none !important; }

.banner {
  background: var(--amber-wash); border: 1px solid var(--amber);
  border-radius: 10px; padding: 12px 15px; font-size: .87rem; color: var(--ink);
}
.banner strong { color: var(--amber); }

/* While the assessment is running the page furniture collapses, so the item
   sits near the top of a handheld screen instead of below a masthead. */
body.taking #c-lede,
body.taking #c-honesty { display: none; }
body.taking h1 { font-size: 1.2rem; font-weight: 800; }
body.taking header { gap: 4px !important; }

/* ---------- tabs: horizontally scrollable on a tablet ---------- */
.tabs {
  display: flex; gap: 4px; margin: 22px 0 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0;
  border-bottom: 2.5px solid transparent; color: var(--mist);
  font-family: inherit; font-size: .95rem; font-weight: 700;
  padding: 12px 14px; cursor: pointer; margin-bottom: -1px;
  white-space: nowrap; min-height: 44px;
}
.tab[aria-selected="true"] { color: var(--teal); border-bottom-color: var(--teal); }
.tab:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 5px; }

/* ---------- scenario pack chooser ---------- */
.packs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.pack {
  appearance: none; text-align: left; font-family: inherit; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 16px; color: var(--ink);
  display: flex; flex-direction: column; gap: 5px; min-height: 44px;
  transition: border-color .15s, background .15s;
}
.pack:hover { border-color: var(--teal); }
.pack[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-wash); }
.pack .nm  { font-weight: 800; font-size: 1.02rem; }
.pack .who { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em;
             text-transform: uppercase; color: var(--mist); }
.pack .bl  { font-size: .88rem; color: var(--ink-2); }

/* ---------- assessment ---------- */
.prog { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--teal); transition: width .35s ease; }

.msg {
  background: var(--ground); border: 1px solid var(--line);
  border-left: 3px solid var(--mist); border-radius: 0 10px 10px 0;
  padding: 15px 17px; font-size: 1.02rem; line-height: 1.55;
}
.msg .from {
  display: block; margin-bottom: 7px; font-family: var(--mono);
  font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mist);
}

.opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opts.col { grid-template-columns: 1fr; }
.opt {
  appearance: none; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 15px 16px; font-family: inherit; font-size: .97rem;
  font-weight: 700; color: var(--ink); cursor: pointer; text-align: left;
  min-height: 52px; transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--teal); }
.opt[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-wash); color: var(--teal); }
.opt:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.conf label { display: flex; justify-content: space-between; font-size: .88rem;
              color: var(--mist); margin-bottom: 8px; }
input[type=range] { width: 100%; accent-color: var(--teal); height: 34px; }
.confval { font-family: var(--mono); font-weight: 600; color: var(--teal); }

.btn {
  appearance: none; border: 0; border-radius: 9px; background: var(--teal); color: #fff;
  font-family: inherit; font-size: .98rem; font-weight: 800; padding: 14px 24px;
  cursor: pointer; min-height: 48px;
}
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.ghost { background: none; color: var(--teal); border: 1.5px solid var(--line); }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- result ---------- */
.score { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.score .n { font-size: clamp(3rem, 11vw, 4.6rem); font-weight: 900;
            letter-spacing: -.04em; line-height: 1; }
.band {
  font-family: var(--mono); font-size: .78rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; padding: 6px 12px; border-radius: 20px;
}
.pillars { display: flex; flex-direction: column; gap: 12px; }
.pil { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.pil .nm { font-size: .92rem; font-weight: 700; }
.pil .wt { font-family: var(--mono); font-size: .72rem; color: var(--mist); }
.pil .v  { font-family: var(--mono); font-size: .9rem; font-weight: 600;
           font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 8px; background: var(--line);
       border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; transition: width .5s ease; }

/* ---------- tables ---------- */
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; min-width: 420px; }
th, td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line);
         vertical-align: top; }
thead th { font-family: var(--mono); font-size: .66rem; font-weight: 600;
           text-transform: uppercase; letter-spacing: .09em; color: var(--mist); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- tiles ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 16px; }
.tile .k { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em;
           text-transform: uppercase; color: var(--mist); }
.tile .v { font-size: 1.9rem; font-weight: 900; letter-spacing: -.025em;
           margin-top: 5px; font-variant-numeric: tabular-nums; }
.tile .s { font-size: .84rem; color: var(--ink-2); margin-top: 3px; }

/* ---------- permitted use ---------- */
.use { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .use { grid-template-columns: 1fr; } }
.use > div { border-radius: 10px; padding: 14px 16px; }
.use .ok { background: var(--teal-wash);  border: 1px solid var(--teal); }
.use .no { background: var(--coral-wash); border: 1px solid var(--coral); }
.use h3 { margin-bottom: 7px; }
.use .ok h3 { color: var(--teal); } .use .no h3 { color: var(--coral); }
.use ul { margin: 0; padding-left: 18px; font-size: .89rem; color: var(--ink-2); }
.use li { margin: 3px 0; }

/* ---------- certificate ---------- */
.cert { border: 1.5px solid var(--teal); border-radius: 14px; padding: 22px;
        background: linear-gradient(135deg, var(--teal-wash), var(--surface)); }
.cert-top { display: flex; justify-content: space-between; align-items: center;
            gap: 12px; flex-wrap: wrap; }
.cert-mark { font-weight: 900; font-size: 1.12rem; letter-spacing: -.02em; color: var(--teal); }
.cert-lvl { font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
            border: 1.5px solid var(--teal); color: var(--teal); padding: 5px 12px; border-radius: 20px; }
.cert-t { font-size: clamp(1.25rem, 3.4vw, 1.7rem); margin-top: 14px; }
.cert-sub { color: var(--ink-2); font-size: .94rem; margin-top: 6px; max-width: 54ch; }
.cert-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px;
             border-top: 1px dashed var(--teal); font-size: .7rem;
             letter-spacing: .07em; color: var(--mist); }
.cert-meta b { color: var(--ink); font-weight: 600; }

/* ---------- A vs B ---------- */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
@media (max-width: 760px) { .vs { grid-template-columns: 1fr; } .vs-mid { display: none; } }
.vs-col { background: var(--surface); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 18px; }
.vs-mid { align-self: center; color: var(--mist); font-size: .8rem;
          letter-spacing: .1em; text-transform: uppercase; }
.vs-what { background: var(--ground); border: 1px solid var(--line); border-radius: 9px;
           padding: 11px 13px; margin: 11px 0 13px; font-size: .89rem;
           font-weight: 600; line-height: 1.5; }
.vs-col ul { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--ink-2); }
.vs-col li { margin: 6px 0; }
.vs-col li.warn { color: var(--coral); }

/* ---------- gate ---------- */
.gate { position: fixed; inset: 0; z-index: 90; background: var(--ground);
        display: grid; place-items: center; padding: 24px; }
.gate .box { width: min(400px, 100%); text-align: center; }
.gate input { width: 100%; margin: 16px 0 12px; padding: 14px 16px; font-family: var(--mono);
              font-size: 1rem; text-align: center; letter-spacing: .06em;
              border: 1.5px solid var(--line); border-radius: 10px;
              background: var(--surface); color: var(--ink); min-height: 50px; }
.gate input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.gate .err { color: var(--coral); font-size: .88rem; min-height: 1.3em; margin-top: 8px; }

/* ---------- misc ---------- */
details { border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px;
          background: var(--surface); }
summary { cursor: pointer; font-weight: 700; font-size: .93rem; min-height: 28px; }
details[open] summary { margin-bottom: 10px; }
code { font-family: var(--mono); font-size: .85rem; background: var(--ground);
       padding: 1px 5px; border-radius: 4px; }
.foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line);
        font-size: .82rem; color: var(--mist);
        display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.dot { appearance: none; background: none; border: 0; cursor: pointer; padding: 6px 10px;
       color: var(--mist); font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; }
.dot:hover { color: var(--teal); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Printing the result is a legitimate leave-behind. Hide the furniture. */
@media print {
  .tabs, .presenter, .btn, .dot, .foot { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; }
}


/* =============================================================================
   Flggd demo hub - app-specific
   ========================================================================== */

.hl { color: var(--teal); }
.small { font-size: .9rem; }
h1 { text-wrap: pretty; }
.view.hidden, .hidden { display: none !important; }

/* ---------- mode chooser ---------- */
.modes { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-top: 24px; }
@media (max-width: 720px) { .modes { grid-template-columns: 1fr; } }
.mode {
  appearance: none; text-align: left; font-family: inherit; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 8px; min-height: 44px;
  transition: border-color .15s, background .15s, transform .15s;
}
.mode:hover { border-color: var(--teal); }
.mode:active { transform: scale(.995); }
.mode:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.mode .m-h { font-size: 1.3rem; font-weight: 900; letter-spacing: -.02em; }
.mode .m-b { font-size: .92rem; color: var(--ink-2); }
.mode .m-cta { margin-top: 6px; font-weight: 800; font-size: .92rem; color: var(--teal); }
.mode .m-cta::after { content: " \2192"; }
#m-tour { background: var(--ink); border-color: var(--ink); }
#m-tour .m-h { color: #fff; }
#m-tour .m-b { color: rgba(255,255,255,.72); }
#m-tour .m-cta { color: var(--teal-br); }

/* ---------- view chrome ---------- */
.viewhead { display: flex; align-items: center; justify-content: space-between;
            gap: 12px; margin: 22px 0 16px; flex-wrap: wrap; }
.btn.sm { padding: 9px 15px; font-size: .88rem; min-height: 42px; }
#tour-back::before, #browse-back::before { content: "\2190  "; }
.prog { font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
         color: var(--ink-2); font-weight: 600; background: var(--surface);
         border: 1px solid var(--line); border-radius: 20px; padding: 7px 14px;
         white-space: nowrap; }

/* ---------- tour stages ---------- */
.stages { list-style: none; margin: 14px 0 0; padding: 0; display: flex;
          flex-direction: column; gap: 0; }
.stage { position: relative; padding-left: 62px; padding-bottom: 22px; }
.stage::before {
  content: ""; position: absolute; left: 22px; top: 44px; bottom: -4px; width: 2px;
  background: var(--line);
}
.stage:last-child { padding-bottom: 0; }
.stage:last-child::before { display: none; }
.stage .n {
  position: absolute; left: 0; top: 4px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--mono); font-size: .8rem;
  font-weight: 600; background: var(--surface); border: 2px solid var(--line);
  color: var(--mist);
}
.stage[data-done="1"] .n { background: var(--teal); border-color: var(--teal); color: #fff; }
.stage[data-done="1"]::before { background: var(--teal); }
.stage-card { background: var(--surface); border: 1px solid var(--line);
              border-radius: var(--radius); padding: 18px 20px; }
.stage[data-done="1"] .stage-card { border-color: var(--teal); }
.stage .kicker { font-family: var(--mono); font-size: .66rem; letter-spacing: .13em;
                 text-transform: uppercase; color: var(--teal); }
.stage h3 { font-size: 1.22rem; font-weight: 900; letter-spacing: -.02em; margin: 4px 0 7px; }
.stage .b { font-size: .95rem; color: var(--ink-2); }
.stage .why { font-size: .88rem; color: var(--ink-2); background: var(--ground);
              border-left: 3px solid var(--line); border-radius: 0 8px 8px 0;
              padding: 10px 13px; margin-top: 11px; }
.stage .meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px;
               font-family: var(--mono); font-size: .68rem; letter-spacing: .06em;
               text-transform: uppercase; color: var(--mist); }
.stage .acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.stage .next { font-size: .9rem; color: var(--ink-2); font-style: italic;
               margin: 14px 0 0; padding-left: 2px; }
.launch {
  appearance: none; border: 0; border-radius: 9px; background: var(--teal); color: #fff;
  font-family: inherit; font-size: .93rem; font-weight: 800; padding: 12px 20px;
  cursor: pointer; min-height: 46px; text-decoration: none; display: inline-flex;
  align-items: center; gap: 7px;
}
.launch[data-done="1"] { background: none; color: var(--teal); border: 1.5px solid var(--teal); }
.launch[aria-disabled="true"] { background: var(--line); color: var(--mist); cursor: not-allowed; }
.launch:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.hint { font-family: var(--mono); font-size: .66rem; letter-spacing: .06em;
        text-transform: uppercase; color: var(--mist); }

.endcard { background: var(--ink); border-color: var(--ink); margin-top: 20px; }
.endcard h2 { color: #fff; }
.endcard .lede { color: rgba(255,255,255,.8); }
.bigline { font-size: clamp(1.15rem, 2.8vw, 1.5rem); font-weight: 900; letter-spacing: -.015em;
           color: var(--teal-br); margin-top: 6px; text-wrap: balance; }
.cta { font-size: .85rem; color: rgba(255,255,255,.62); margin-top: 6px; }

/* ---------- browse ---------- */
.group { margin-top: 22px; }
.group > h3 { font-size: 1.1rem; font-weight: 900; }
.group > p { font-size: .9rem; color: var(--ink-2); margin: 4px 0 12px; max-width: 62ch; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tile2 { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
         padding: 18px; display: flex; flex-direction: column; gap: 7px; }
.tile2 h4 { font-size: 1.05rem; font-weight: 800; margin: 0; }
.tile2 .b { font-size: .89rem; color: var(--ink-2); flex: 1; }
.tile2 .meta { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--mono);
               font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
               color: var(--mist); }
.tile2 .launch { align-self: flex-start; margin-top: 4px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
