/* Corbel Operator and Setter Portal themes. The shared action and text tokens support both modes. */

/* ---------------------------------------------------------------- fonts */
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/archivo-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/archivo-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/archivo-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/archivo-latin-700-normal.woff2") format("woff2"); }

/* Corbel night is the default. The saved theme switch selects the day palette. */
:root {
  /* Neutrals, dark (90% of every screen) */
  --ground: #0E1822;            /* page background */
  --card: #15222E;              /* surface: cards, panels, inputs */
  --soft: #24384A;              /* surface 2: raised, menus, quiet fills */
  --hairline: #24384A;          /* borders, dividers */
  --line-2: #9CAFBE;            /* control borders */
  --ink: #EAF1F6;               /* main text */
  --ink-2: #C4D1DB;             /* body text a step down from ink */
  --muted: #9CAFBE;             /* secondary text */
  --muted-2: #9CAFBE;           /* labels only, 18 px and up (3.5:1) */

  /* Primary action and readable accent. */
  --ember: #D3A27A;             /* the main button's fill, the mark */
  --ember-hover: #E2B795;
  --on-ember: #0E1822;          /* primary button text */
  --navy: #8EC3E6;              /* ember as text, links, outlines, focus, "needs you" */
  --on-navy: #0E1822;
  --navy-soft: #24384A;

  /* The crew: each colour tags that agent's own work, nothing else */
  --sara: #EA580C; --taylor: #C9A44F; --emma: #7F9C76;
  --sara-face: #EA580C; --sara-bubble: #291B13;
  --taylor-face: #C9A44F; --taylor-bubble: #26221A;
  --emma-face: #7F9C76; --emma-bubble: #212420;

  /* Signal: green is proven (done only), gold is reported and not checked, dashed is unknown, orange is act */
  --done-bg: #1D2920; --done-ink: #8FD39F; --done-line: #3E784C;            /* sent, saved, confirmed, connected */
  --waiting-bg: #2D281C; --waiting-ink: #C9A44F; --waiting-line: #816A37;   /* reported, not checked; coming */
  --checked: #4C9A5E;                                                       /* check marks, the undo countdown */
  --conflict: #F08A4B; --conflict-bg: #2E1C13; --conflict-line: #B4470E;   /* errors and conflicts */
  --tile-drawings: var(--soft); --tile-estimate: var(--soft); --tile-money: var(--soft);
  --tile-permit: var(--soft); --tile-punch: var(--soft); --tile-papers: var(--soft);

  /* Archivo carries headings and body text. Tabular numbers align the financial figures. */
  --font-head: "Archivo", system-ui, sans-serif;
  --font-ui: "Archivo", system-ui, sans-serif;
  --font-figures: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --figures-numeric: tabular-nums;
  --lh-head: .95;
  --track-head: -.01em;
  --fs-page: 40px;        /* page titles: Archivo Condensed 800, uppercase */
  --fs-card: 19px;        /* card titles, 600 */
  --fs-body: 16px;        /* desktop body; 17 on the phone (below) */
  --fs-secondary: 15px;
  --fs-small: 13px;       /* nothing smaller */
  --fs-eyebrow: 13px;     /* the label above a headline: caps, .14em, ember (the kit's 11.5, at the 13 px floor) */
  --track-eyebrow: .14em;
  --fs-btn: 14px;         /* button text: caps, .06em */
  --track-btn: .06em;
  --track-lockup: .16em;  /* wordmark spacing */
  --fs-figure: 24px;      /* amounts 24-44 */
  --fs-figure-lg: 44px;
  --lh-body: 1.55;

  /* Sizes and shape */
  --control: 44px;        /* every control at least this */
  --control-main: 56px;   /* the main button */
  --control-camera: 64px; /* the camera button; check answers */
  --radius-card: 14px;
  --radius-btn: 10px;
  --radius-input: 10px;
  --radius-chip: 6px;
  --radius-mark: 12.5%;   /* the mark's ground square */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;

  /* Motion: confirms an action, shows progress, or shows where something went */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --motion-press: 120ms;
  --motion-move: 300ms;
  --motion-pop: 450ms;
  --motion-row: 500ms;
  --motion-card: 500ms;
  --motion-rise: 550ms;
  --motion-meter: 1.1s;
  --motion-draw: 1.1s;
  --motion-undo: 10s;

  /* The names the existing screens and modules already read, pointed at the tokens above */
  --surface: #15222E;
  --surface-2: var(--soft);
  --line-strong: var(--line-2);
  --line: var(--hairline);
  --accent: #D3A27A;
  --accent-soft: var(--navy-soft);
  --on-accent: #0E1822;
  --waiting: var(--waiting-ink);
  --sans: var(--font-ui);
  --serif: var(--font-ui);   /* Instrument Serif is retired */
  --mono: var(--font-figures);
  color-scheme: dark;
}
@media (max-width: 860px) {
  :root { --fs-body: 17px; --fs-page: 32px; }
}
/* The kit's light sections, as the light set (the saved switch) */
:root[data-theme="light"] {
  --ground: #FFFFFF; --card: #F6F9FC; --soft: #EAF2F8; --hairline: #D6E2EB; --line-2: #4F5F6B;
  --ink: #13212C; --ink-2: #354956; --muted: #4F5F6B; --muted-2: #4F5F6B;
  --ember: #7A4A28; --ember-hover: #633C21; --on-ember: #FFFFFF;
  --navy: #1D5A85; --on-navy: #FFFFFF; --navy-soft: #EAF2F8;   /* selection tint */
  --sara-bubble: #FDF0E9; --taylor-bubble: #F7F2E6; --emma-bubble: #EDF1EC;
  --done-bg: #E6F1E8; --done-ink: #1F5C30; --done-line: #4C9A5E;
  --waiting-bg: #F4EDDC; --waiting-ink: #6B4E0A; --waiting-line: #C9A44F;
  --checked: #2F7D46; --conflict: #C2410C; --conflict-bg: #FDF0E9; --conflict-line: #EA580C;
  color-scheme: light;
}

/* ---------------------------------------------------------------- base
   Zero-specificity (:where) so every page's own rules still win; these are floors, not overrides. */
:where(html) { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:where(body) { background: var(--ground); color: var(--ink); font-family: var(--font-ui);
  font-size: var(--fs-body); line-height: var(--lh-body); -webkit-font-smoothing: antialiased; }
:where(button, input, select, textarea) { font-family: inherit; }
:where(code, kbd, samp, .figures) { font-family: var(--font-figures); font-variant-numeric: tabular-nums; }
::selection { background: rgba(234, 88, 12, .35); }

/* Every control at least 44 px. Checkboxes and radios sit inside 44 px labels instead. */
:where(button, select, summary, .btn, a.btn,
  input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"], [type="range"], [type="color"])) {
  min-height: var(--control);
}
:where(input[type="checkbox"], input[type="radio"]) { width: 20px; height: 20px; accent-color: var(--navy); }
:where(:focus-visible) { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ---------------------------------------------------------------- motion
   CSS only. Every class answers one question: did it work, how far along is it, or where did it go. */
@keyframes bnz-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes bnz-slideup { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes bnz-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bnz-pop { 0% { opacity: 0; transform: scale(.4); } 60% { opacity: 1; transform: scale(1.15); } 100% { opacity: 1; transform: scale(1); } }
@keyframes bnz-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes bnz-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bnz-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes bnz-spin { to { transform: rotate(360deg); } }
@keyframes bnz-draw { from { stroke-dashoffset: var(--draw-length, 400); } to { stroke-dashoffset: 0; } }
@keyframes bnz-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Message arrives: rises 14 px and fades in (stagger with --delay, 0.1-0.3 s) */
.m-rise { animation: bnz-rise var(--motion-rise) var(--ease-out) var(--delay, 0s) both; }
/* Tiles and rows: a page opens, children rise in 50 ms apart */
.m-stagger > * { animation: bnz-rise var(--motion-row) var(--ease-out) both; }
.m-stagger > :nth-child(2) { animation-delay: 50ms; }
.m-stagger > :nth-child(3) { animation-delay: 100ms; }
.m-stagger > :nth-child(4) { animation-delay: 150ms; }
.m-stagger > :nth-child(5) { animation-delay: 200ms; }
.m-stagger > :nth-child(6) { animation-delay: 250ms; }
.m-stagger > :nth-child(7) { animation-delay: 300ms; }
.m-stagger > :nth-child(n+8) { animation-delay: 350ms; }
/* Pinned card: slides up from the reply box */
.m-slideup { animation: bnz-slideup var(--motion-card) var(--ease-out) var(--delay, 0s) both; }
/* Sent, Confirmed, Connect: the check mark pops 0.4 -> 1.15 -> 1 */
.m-pop { animation: bnz-pop var(--motion-pop) var(--ease-out) var(--delay, 0s) both; }
/* The undo bar drains over 10 s */
.m-drain { transform-origin: left center; animation: bnz-drain var(--motion-undo) linear forwards; }
/* Meter: the bar fills from the left */
.m-fill { transform-origin: left center; animation: bnz-fill var(--motion-meter) var(--ease-out) var(--delay, .2s) both; }
/* Working: typing dots, 1.2 s loop (three <span>s inside) */
.m-dots { display: inline-flex; gap: 5px; align-items: center; }
.m-dots > span { width: 7px; height: 7px; border-radius: 50%; background: var(--checked); animation: bnz-dot 1.2s infinite; }
.m-dots > span:nth-child(2) { animation-delay: .15s; }
.m-dots > span:nth-child(3) { animation-delay: .3s; }
/* Connect: a spinner while a connection is under way (the only other loop allowed) */
.m-spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--navy); animation: bnz-spin .8s linear infinite; }
/* Confirmed: a progress bar slides while the desk acts on the answer */
.m-sweep { position: relative; overflow: hidden; }
.m-sweep::after { content: ""; position: absolute; inset: 0; background: var(--checked); opacity: .35; animation: bnz-sweep 1.4s ease-in-out infinite; }
/* Note highlight: a navy outline draws itself around the number that was read (SVG stroke) */
.m-draw { stroke-dasharray: var(--draw-length, 400); animation: bnz-draw var(--motion-draw) var(--ease-out) .5s both; }
/* Action moves: the chip cross-fades, the row slides to its new group */
.m-xfade { transition: background-color var(--motion-move) ease, color var(--motion-move) ease, border-color var(--motion-move) ease; }
.m-move { transition: transform var(--motion-move) var(--ease-out); }
/* Press: any button scales to 0.97 */
:where(button, .btn, [role="button"]) { transition: transform var(--motion-press) ease; }
:where(button, .btn, [role="button"]):not(:disabled, [aria-disabled="true"]):active { transform: scale(.97); }
/* Shown only with motion, or only without it (the undo countdown becomes "Undo, 10 s" in text) */
.m-reduced-only { display: none !important; }

/* Reduced motion: nothing moves. Things fade in place; loops stop on their still frame. */
@media (prefers-reduced-motion: reduce) {
  .m-rise, .m-stagger > *, .m-slideup, .m-pop { animation-name: bnz-fade; animation-duration: 200ms; }
  .m-drain, .m-fill, .m-draw, .m-dots > span, .m-spin, .m-sweep::after { animation: none; }
  .m-dots > span { opacity: .6; }
  .m-xfade, .m-move, :where(button, .btn, [role="button"]) { transition: none; }
  :where(button, .btn, [role="button"]):active { transform: none; }
  .m-motion-only { display: none !important; }
  .m-reduced-only { display: revert !important; }
  html { scroll-behavior: auto; }
}

/* ---------------------------------------------------------------- desktop width (Jose, 8 Oct)
   On desktop the screens fill the window instead of a 1,120 px column centred in it. Above the phone
   breakpoint only (861 px and up), so the phone layout is untouched. The :root prefix outranks the
   page's own single-class caps in index.html (.content 1120, .thread 780, Usage 720, More and
   Actions 640, the bid room 860). The side padding matches the top bar so content lines up with the
   logo. Readability stays guarded: chat bubbles and the intro line under each page title keep a
   reading width. Classes used only by index.html; onboard and team-invite don't use them. */
@media (min-width: 861px) {
  :root .frame-bar,
  :root .content,
  :root .room { padding-left: clamp(24px, 2.5vw, 48px); padding-right: clamp(24px, 2.5vw, 48px); }
  :root .content,
  :root .room,
  :root .thread,
  :root .more-list, :root .more-also, :root .more-foot,
  :root .usage-hero, :root .usage-units, :root .usage-observations, :root .usage-help,
  :root #usage-terms, :root .usage-details,
  :root .actions-time { max-width: none; }
  :root .more-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  :root .msg:not(.mine) .msg-body { max-width: min(82%, 880px); }
  :root .msg.mine .msg-body { max-width: min(70%, 720px); }
  :root .content p.sub { max-width: 90ch; }
}
