/* ───────────────────────────────────────────────────────────────────────────
   demo-theme.css — shared styling for the portal, admin console and demo pages.

   All colour, type and radius come from theme-tokens.css (the Try for
   Tomorrow look, from the programme design sheet). Nothing here should hard-code a brand
   colour — rebranding means editing the tokens, not hunting through pages.
   ─────────────────────────────────────────────────────────────────────────── */
@import url('theme-tokens.css');

:root { --accent-2: var(--pop); }

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

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image: var(--paper-image);
  background-size: var(--paper-size);
  color: var(--ink);
  line-height: 1.5;
  padding: 1.75rem 1rem 4rem;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 58.75rem; margin: 0 auto; }
.wrap.narrow { max-width: 40rem; }

/* ── Header ─────────────────────────────────────────────────────────────── */
header.page { margin-bottom: 1.5rem; }
header.page .eyebrow {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-strong); font-weight: 800;
}
header.page h1, .display {
  font-family: var(--font-display); font-weight: var(--display-weight);
  text-transform: var(--display-case); letter-spacing: var(--display-track);
}
header.page h1 { font-size: 1.95rem; margin-top: .15rem; line-height: 1.1; }
header.page p.sub { color: var(--muted); margin-top: .35rem; font-size: .95rem; }

/* ── Emulation notice — always visible, never let a tester forget ───────── */
.emulation-note {
  background: var(--warn-bg); border: 1px solid #fcd34d; color: #78350f;
  border-radius: var(--radius-sm); padding: .7rem 1rem; font-size: .84rem;
  margin-bottom: 1.5rem;
}
.emulation-note strong { font-weight: 700; }

/* ── Cards & grids ──────────────────────────────────────────────────────── */
h2.section {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin: 1.75rem 0 .7rem; font-weight: 800;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .85rem; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}
a.card { text-decoration: none; color: inherit; display: block; transition: transform .12s, box-shadow .12s; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(18,33,46,.08), 0 14px 32px rgba(18,33,46,.10); }
.card .t { font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; }
.card .d { font-size: .84rem; color: var(--muted); margin-top: .35rem; }
.card .meta { font-size: .75rem; color: var(--accent-strong); font-weight: 700; margin-top: .6rem; }
.card.lead { border-left: 4px solid var(--accent); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: var(--radius-sm);
  padding: .68rem 1.2rem; font: inherit; font-weight: 700; cursor: pointer;
  transition: filter .12s, transform .08s, box-shadow .12s; text-decoration: none;
}
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover:not(:disabled) { border-color: var(--accent); filter: none; }
.btn.ghost { background: transparent; color: var(--accent-strong); padding: .4rem .6rem; }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); filter: none; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.wide { width: 100%; }
.btn.big { padding: .95rem 1.4rem; font-size: 1.05rem; font-family: var(--font-display);
           font-weight: 800; text-transform: var(--display-case); letter-spacing: .02em; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
label.field { display: block; margin-bottom: .9rem; }
label.field > span { display: block; font-size: .82rem; font-weight: 700; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: .62rem .8rem; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 96px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .87rem; }
th, td { text-align: left; padding: .6rem .85rem; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-size: .72rem; text-transform: uppercase;
     letter-spacing: .05em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: none; }

/* ── Bits ───────────────────────────────────────────────────────────────── */
code, .mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .88em; }
.ref { background: var(--accent-soft); color: var(--accent-strong); padding: .1rem .4rem; border-radius: 5px;
       font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.pill { display: inline-block; font-size: .7rem; font-weight: 800; padding: .17rem .55rem; border-radius: 99px; white-space: nowrap; }
.pill.ok      { background: #d1fae5; color: #065f46; }
.pill.pending { background: #fef3c7; color: #92400e; }
.pill.none    { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.live    { background: #dbeafe; color: #1e40af; }
.pill.next    { background: var(--accent); color: var(--accent-ink); }
.muted  { color: var(--muted); }
.hidden { display: none !important; }
.empty  { text-align: center; color: var(--muted); padding: 2.25rem 1rem; font-size: .9rem; }
.row    { display: flex; gap: .6rem; align-items: center; }
.row.between { justify-content: space-between; }
.stack  { display: flex; flex-direction: column; gap: .6rem; }
.crumb  { font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }
.crumb a { color: var(--accent-strong); text-decoration: none; font-weight: 700; }
.crumb a:hover { text-decoration: underline; }

/* ── Stat tiles ─────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .7rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem .9rem; }
.stat .n { font-size: 1.7rem; font-weight: var(--display-weight); letter-spacing: -.01em;
           font-family: var(--font-display); line-height: 1.15; }
.stat .l { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800; margin-top: .1rem; }

/* ── Progress ───────────────────────────────────────────────────────────── */
.segs { display: flex; gap: 3px; }
.segs i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); display: block; }
.segs i.part { background: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.segs i.done { background: var(--ok); }
.bar-track { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar-fill  { height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s cubic-bezier(.3,1.2,.5,1); }

/* ── The design sheet's heading treatment ────────────────────────────────── */
header.page h1 { color: var(--accent); font-size: 2.7rem; line-height: .95;
  padding-bottom: .3rem; border-bottom: 3px solid var(--accent); display: inline-block; }
header.page p.sub { font-style: italic; font-weight: 300; }
h2.section { font-family: var(--font-display); font-weight: 400; font-size: 1.45rem;
  letter-spacing: .03em; color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: .12rem; }
.card { box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.btn.big { font-size: 1.4rem; font-weight: 400; letter-spacing: .04em; padding: .78rem 1.4rem; }

@media (max-width: 560px) {
  body { padding: 1.1rem 1rem 3rem; }
  header.page h1 { font-size: 1.9rem; }
  /* Wide tables scroll inside themselves rather than widening the whole page. */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ═══ Screen sizes ════════════════════════════════════════════════════════════
   One layout, tuned for the screens the tool is used on:
     large / high-resolution monitors · 1080p monitors · projectors (768px tall
     or less) · tablets · phones (delivering outside).                        */

/* Monitors: sizes are in rem, and the base size grows gently with the screen —
   16px up to ~1440px wide, ~17.5px at 1080p, ~19px on a 2560px-wide monitor —
   so a big screen shows a bigger page, not a small one in the middle. It builds
   on the browser's own text-size setting (100%), never below it. */
html { font-size: clamp(100%, calc(0.3vw + 11.7px), 125%); }

/* Touch screens (tablets, phones): anything you tap is at least ~44px. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.ghost { min-height: 40px; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select { min-height: 44px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .crumb a { display: inline-block; padding: .55rem 0; }
  summary { padding: .5rem 0; }
}

/* Phones: small labels are nudged up so they read outdoors. */
@media (max-width: 600px) {
  .pill, header.page .eyebrow, .stat .l, th { font-size: .76rem; }
  header.page p.sub { font-size: 1rem; }
}

/* Projectors and other short screens (768px tall or less): tighter headings
   and spacing, so what matters fits without scrolling. */
@media (max-height: 800px) and (min-width: 700px) {
  body { padding-bottom: 2rem; }
  header.page { margin-bottom: .8rem; }
  header.page h1 { font-size: 2.1rem; }
  header.page p.sub { margin-top: .2rem; }
  .crumb { margin-bottom: .5rem; }
  h2.section { margin-top: 1.1rem; }
}
