/* Colours and type from brand/BRAND.md and site/src/styles/tokens.css (paper and teal); phone first. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); }

:root {
  --teal: #12B5A9;
  --teal-dark: #0E8F86;
  --teal-ink: #0B7A72;
  --slate: #1E2B33;
  --paper: #F2F7F7;
  --white: #FFFFFF;
  --muted: #4A5A63;
  --line: #E3ECEC;
  --border: #CFDCDC;
  --error: #A3262A;
  --radius: 12px;
  --font-latin: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: "IBM Plex Sans Arabic", "Inter", system-ui, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
html[lang="en"] { font-family: var(--font-latin); }
html[lang="ar"] { font-family: var(--font-arabic); }
body { margin: 0; color: var(--slate); font-size: 16px; line-height: 1.6; background: var(--paper); }
html[lang="ar"] body { line-height: 1.7; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 6vw, 34px); line-height: 1.2; font-weight: 700; text-wrap: balance; }
html[lang="ar"] h1 { line-height: 1.4; }
a { color: inherit; text-decoration-line: underline; text-decoration-color: var(--teal); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--teal-dark); outline-offset: 3px; }
.num { unicode-bidi: isolate; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
       max-width: 560px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.lang { font-weight: 600; }
.draft { background: var(--slate); color: var(--paper); text-align: center; font-size: 14px; padding: 6px 16px; }

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; }
.card { background: var(--white); border-radius: 20px; padding: 22px 18px; display: grid; gap: 16px; }
.kicker { color: var(--teal-ink); font-weight: 600; font-size: 14px; }
.lede { color: var(--muted); }
.note { color: var(--muted); font-size: 14px; }

label, .label { font-weight: 600; display: block; }
.field { display: grid; gap: 6px; }
.help { color: var(--muted); font-size: 14px; font-weight: 400; }
input[type=text], input[type=email], input[type=url], input[type=number], input[inputmode], select {
  font: inherit; color: inherit; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--white); }
input:focus { border-color: var(--teal-dark); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--teal-dark); flex: none; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg label { position: relative; font-weight: 600; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 11px 6px; border: 1px solid var(--border); border-radius: var(--radius);
            background: var(--white); }
.seg input:checked + span { background: var(--slate); color: var(--paper); border-color: var(--slate); }
.seg input:focus-visible + span { outline: 3px solid var(--teal-dark); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; }
.chips span { display: inline-block; padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; font-weight: 600; background: var(--white); }
.chips input:checked + span { background: var(--slate); color: var(--paper); border-color: var(--slate); }
.chips input:focus-visible + span { outline: 3px solid var(--teal-dark); outline-offset: 2px; }

.photo { display: grid; gap: 10px; justify-items: start; }
.photo img { max-height: 220px; border-radius: var(--radius); background: var(--paper); }
.photo input { position: absolute; width: 1px; height: 1px; opacity: 0; }

button, .btn { font: inherit; font-weight: 700; min-height: 50px; padding: 12px 20px; border-radius: var(--radius); border: 0;
               cursor: pointer; background: var(--teal); color: var(--slate); text-decoration: none; display: inline-block; text-align: center; }
button:hover, .btn:hover { box-shadow: inset 0 0 0 2px var(--slate); }
button:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
button.quiet, .btn.quiet { background: transparent; color: var(--slate); text-decoration: underline; text-decoration-color: var(--teal);
                           text-decoration-thickness: 2px; text-underline-offset: 4px; font-weight: 600; }
.actions { display: grid; gap: 8px; }

.error { color: var(--error); font-weight: 600; }
.status { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--teal); flex: none; }
@media (prefers-reduced-motion: no-preference) { .status.wait .dot { animation: pulse 1.4s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: 0.25; } }

.tape { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.tape .in { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 6px; border-bottom: 1px solid var(--line); }
th { font-size: 14px; color: var(--muted); font-weight: 600; }
td.cm { text-align: end; }

.brandsize { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; }
.brandsize h2 { font-size: 18px; }
.brandsize ul, .counts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.brandsize li, .counts li { display: flex; justify-content: space-between; gap: 12px; }
.counts li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.size { font-weight: 700; }

footer { max-width: 560px; margin: 0 auto; padding: 0 16px 32px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.stack { display: grid; gap: 16px; }
.stack.tight { gap: 12px; }
/* the "where the tape goes" figure inside each tape card: always visible, about 160 px tall on a phone, never mirrored;
   its legend is page text beside two small marks (teal band: here; grey dashed line with a cross: not here) */
.tape .fig { display: block; height: 160px; width: auto; max-width: 100%; margin: 4px auto 0; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.legend .key { display: inline-flex; align-items: center; gap: 8px; }
.legend .sw { width: 40px; height: 14px; flex: none; }
.legend .sw-tape { fill: var(--teal); }
.legend .sw-wrong { fill: none; stroke: #8A99A1; stroke-width: 2.5; stroke-linecap: round; }
/* step 5: the person's pieces and their answers */
h2.sub { font-size: 18px; margin: 4px 0 0; }
.wants { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.want { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; }
.want .head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.want .head .host { unicode-bidi: isolate; direction: ltr; overflow-wrap: anywhere; }
.want .answer { font-weight: 700; font-size: 17px; }
.want .size { font-size: 20px; }
.want .row { font-size: 14px; }
.want.reading .answer { font-weight: 600; font-size: 16px; }
