/* Tokens + components shared by the app and the printable workbooks. */
/* Fonts are served by the app itself (no Google Fonts call on every page), so text
   never redraws in a stand-in font and shifts. Lexend: SIL OFL. Bricolage Grotesque: SIL OFL. */
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 100 900; font-display: block;
  src: url(/fonts/lexend/lexend-latin-wght-normal.woff2) format('woff2-variations'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 100 900; font-display: block;
  src: url(/fonts/lexend/lexend-latin-ext-wght-normal.woff2) format('woff2-variations'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 200 800; font-display: block;
  src: url(/fonts/bricolage/bricolage-grotesque-latin-opsz-normal.woff2) format('woff2-variations'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 200 800; font-display: block;
  src: url(/fonts/bricolage/bricolage-grotesque-latin-ext-opsz-normal.woff2) format('woff2-variations'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --ink: #15141b;
  --paper: #f6f1e7;
  --card: #ffffff;
  --muted: #5f5a52;
  --line: #15141b;
  --lime: #c6f432;
  --coral: #ff6b4a;
  --sun: #ffc53d;
  --blue: #4d7cfe;
  --teal: #2ec4b6;
  --violet: #b57bff;
  --pink: #ff5fa2;
  --zone: var(--lime);
  --zone-ink: #16210a;
  --r: 18px;
  --r-sm: 12px;
  --bw: 3px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 7px 7px 0 var(--ink);
  --display: 'Bricolage Grotesque', 'Arial Black', system-ui, sans-serif;
  --body: 'Lexend', 'Segoe UI', system-ui, sans-serif;
  /* red-flag colours */
  --f-rush: #ff6b4a;
  --f-reaction: #ff5fa2;
  --f-request: #ffc53d;
  --f-random: #4d7cfe;
}

.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }

/* Sticker: chunky icon tile with ink outline and hard shadow */
.sticker {
  --sz: 44px;
  display: inline-grid; place-items: center; flex: none;
  width: var(--sz); height: var(--sz);
  background: var(--s-bg); color: var(--s-ink);
  border: var(--bw) solid var(--ink); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-3deg);
}
.sticker .ico { width: 55%; height: 55%; stroke-width: 2.4; }
.sticker-sm { --sz: 34px; border-radius: 10px; box-shadow: 2px 2px 0 var(--ink); }
.sticker-lg { --sz: 60px; border-radius: 18px; }
.sticker-xl { --sz: 88px; border-radius: 24px; box-shadow: 5px 5px 0 var(--ink); }
.sticker-xxl { --sz: 150px; border-radius: 36px; border-width: 5px; box-shadow: 8px 8px 0 var(--ink); }

/* Phone mock-up */
.phone {
  width: 250px; flex: none;
  background: #fff; border: var(--bw) solid var(--ink); border-radius: 30px;
  box-shadow: var(--shadow); padding: 10px 10px 18px; position: relative;
  font-family: var(--body);
}
.phone-big { width: 290px; }
.phone-notch { width: 70px; height: 8px; background: var(--ink); border-radius: 8px; margin: 2px auto 8px; }
.phone-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px 10px; border-bottom: 2px solid #e5e0d6; font-size: 0.85rem; }
.phone-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e5e0d6; }
.phone-sender { font-weight: 600; }
.phone-body { padding: 14px 6px 0; min-height: 120px; }
.bubble {
  background: #eceae4; border-radius: 18px 18px 18px 4px; padding: 12px 14px;
  font-size: 0.98rem; line-height: 1.45; max-width: 92%;
}
.bubble-blank { height: 150px; max-width: 100%; background: repeating-linear-gradient(#fff 0 30px, #cfc9bd 30px 31px); border: 2px dashed #b6afa2; }
.phone-time { font-size: 0.72rem; color: var(--muted); margin: 6px 4px; }

/* Red flag tags */
.flag-tag {
  display: inline-block; font-family: var(--display); font-weight: 800; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 9px; border: 2px solid var(--ink); border-radius: 999px; background: #eee;
}
.flag-rush .flag-tag, .flag-tag.flag-rush { background: var(--f-rush); }
.flag-reaction .flag-tag, .flag-tag.flag-reaction { background: var(--f-reaction); }
.flag-request .flag-tag, .flag-tag.flag-request { background: var(--f-request); }
.flag-random .flag-tag, .flag-tag.flag-random { background: var(--f-random); color: #fff; }

/* Anatomy diagram */
.anatomy { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin: 0; }
.callouts { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; flex: 1; min-width: 240px; }
.callout { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 2px solid var(--ink); border-radius: var(--r-sm); padding: 10px 12px; }
.callout p { margin: 4px 0 0; font-size: 0.92rem; color: var(--muted); }
.callout-n { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: 0.85rem; }

/* Flow diagram */
.flow { display: flex; align-items: stretch; gap: 10px; margin: 0; flex-wrap: nowrap; }
.flow-step {
  flex: 1 1 0; min-width: 0; background: #fff; border: var(--bw) solid var(--ink); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 16px; text-align: center;
}
.flow-step:nth-of-type(1) { background: var(--f-rush); }
.flow-step:nth-of-type(2) { background: var(--sun); }
.flow-step:nth-of-type(3) { background: var(--lime); }
.flow-step:nth-of-type(4) { background: #8fd3ff; }
.flow-step:nth-of-type(5) { background: #c9b6f5; }
/* Four or five steps still fit on one row: a little more compact. */
.flow:has(.flow-step:nth-of-type(4)) { gap: 6px; }
.flow:has(.flow-step:nth-of-type(4)) .flow-step { padding: 12px 8px; }
.flow:has(.flow-step:nth-of-type(4)) .flow-step strong { font-size: clamp(.95rem, 1.75vw, 1.25rem); }
.flow:has(.flow-step:nth-of-type(4)) .flow-step p { font-size: .9rem; }
.flow:has(.flow-step:nth-of-type(4)) .flow-arrow .ico { width: 22px; height: 22px; }
.flow-step strong { display: block; font-family: var(--display); font-size: 1.6rem; font-weight: 800; }
.flow-step p { margin: 6px 0 0; }
.flow-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #fff; border: var(--bw) solid var(--ink); margin-bottom: 6px; }
.flow-icon .ico { width: 24px; height: 24px; }
.flow-arrow { display: grid; place-items: center; }
.flow-arrow .ico { width: 30px; height: 30px; stroke-width: 3; }
/* Phones: one column, arrows pointing down between the steps. */
@media screen and (max-width: 640px) {
  .flow { flex-direction: column; flex-wrap: nowrap; gap: 4px; }
  .flow-step { width: 100%; }
  .flow-arrow { padding: 2px 0; }
  .flow-arrow .ico { transform: rotate(90deg); width: 26px; height: 26px; }
}
/* Four or more steps need more room, so they stack a little sooner. */
@media screen and (max-width: 780px) {
  .flow:has(.flow-step:nth-of-type(4)) { flex-direction: column; gap: 4px; }
  .flow:has(.flow-step:nth-of-type(4)) .flow-step { width: 100%; padding: 12px 16px; }
  .flow:has(.flow-step:nth-of-type(4)) .flow-step strong { font-size: 1.3rem; }
  .flow:has(.flow-step:nth-of-type(4)) .flow-arrow { padding: 2px 0; }
  .flow:has(.flow-step:nth-of-type(4)) .flow-arrow .ico { transform: rotate(90deg); }
}

.lvl-chip, .wb-lvl {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-family: var(--display); font-weight: 800; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--sun); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px;
}
.lvl-chip .ico, .wb-lvl .ico { fill: currentColor; }

/* Document diagram (payslips, forms) */
.doc-card { background: #fff; border: var(--bw) solid var(--ink); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px 12px; min-width: 280px; max-width: 480px; font-size: .9rem; position: relative; }
.doc-title { font-family: var(--display); font-weight: 800; letter-spacing: .12em; font-size: 1.1rem; border-bottom: 3px solid var(--ink); padding-bottom: 6px; margin-bottom: 8px; }
/* Each row: [number] [label] [value]. --lw is set per document from its longest label. */
.doc-row { display: grid; grid-template-columns: min(var(--lw, 9em), 45%) 1fr; column-gap: 14px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed #cfc8bb; }
.has-n .doc-row { grid-template-columns: 22px min(var(--lw, 9em), 45%) 1fr; column-gap: 10px; }
/* A plain number needs little room, so its label can take the rest. */
.doc-row.is-num { grid-template-columns: 1fr auto; }
.has-n .doc-row.is-num { grid-template-columns: 22px 1fr auto; }
.doc-row.rule { border-top: 2px solid var(--ink); }
.doc-row.strong { font-weight: 700; font-size: 1.05em; background: #fff6cf; margin: 0 -8px; padding: 6px 8px; border-radius: 4px; }
.doc-label { color: #4a4640; }
.doc-value { text-align: left; overflow-wrap: anywhere; }
.doc-value.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-table-wrap { margin: 8px 0; }
.has-n .doc-table-wrap { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; align-items: start; }
.doc-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.doc-table th { text-align: left; border-bottom: 2px solid var(--ink); padding: 4px; }
.doc-table td { padding: 4px; border-bottom: 1px solid #e3ddd1; font-variant-numeric: tabular-nums; }
.doc-table td:not(:first-child), .doc-table th:not(:first-child) { text-align: right; }
.doc-n { align-self: center; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font: 700 .72rem var(--body); font-variant-numeric: normal; }
.doc-table-wrap > .doc-n { align-self: start; margin-top: 4px; }
/* Phones: the label sits above its value. */
@media screen and (max-width: 520px) {
  .doc-card { min-width: 0; }
  .doc-row, .doc-row.is-num { grid-template-columns: 1fr; row-gap: 1px; }
  .has-n .doc-row, .has-n .doc-row.is-num { grid-template-columns: 22px 1fr; }
  .has-n .doc-row .doc-n, .has-n .doc-row .doc-n-gap { grid-row: span 2; align-self: start; margin-top: 2px; }
  .has-n .doc-row > .doc-label, .has-n .doc-row > .doc-value { grid-column: 2; }
  .doc-label { font-size: .88em; }
  .doc-value.num { text-align: left; }
}
.doc-note { font-size: .75rem; color: var(--muted); margin: 8px 0 0; }

.doc-anatomy { align-items: flex-start; }
