/* Design code of 4bms, part one: what everything is made of. Fonts, colours, type,
   spacing and the roles both rooms share. The parts live next door: parts.css — what
   is pressed and typed into, marks.css — what tells you something, blocks.css — what a
   screen is built out of, talk.css — a conversation and a questionnaire, which the bar
   does not hold yet. The two rooms are till.css and office.css; they live in web beside
   the frame and are loaded last, because a room may change what a part is worth but
   never what it is.

   The office is dressed in shadcn/ui: its palette, its sizes, its corner radii and
   the shape of every part are carried over here by hand. The kit itself is built for
   another kind of program — React with a build step — and this one is a Go server that
   must work with the internet unplugged, so what travels is the design, not the code.

   What decides is blue and there is one such button on a screen. What cannot be undone
   by an ordinary operation is red. Everything else is an outline or a whisper.

   The till stands in a dim bar and keeps its own worth for the same names.

   Nothing is loaded from the network: the typeface lies in static/fonts beside this
   file, and the program serves it itself. */

/* Geist, SIL Open Font License 1.1 (github.com/vercel/geist-font). One variable file
   per alphabet, 400 to 700, sixty kilobytes for all three — less than one photograph.
   unicode-range lets the browser take only the alphabet a page actually shows.

   «optional», а не «swap»: со «swap» браузер рисовал страницу запасным шрифтом и
   перемерял её заново, когда доезжал наш, — и весь экран дёргался вбок на каждом
   переходе. Замерено: пилюля отбора 93,10 → 92,29 точки после подмены. Шрифт лежит
   внутри программы, доезжает за миллисекунды, и «optional» просто не даёт подмене
   случиться; в самый первый раз страница может выйти запасным шрифтом целиком, и
   это честнее прыжка на каждом щелчке. */
@font-face {
    font-family: "Geist";
    font-style: normal;
    font-weight: 400 700;
    font-display: optional;
    src: url("/static/fonts/geist-latin.woff2") format("woff2");
    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: "Geist";
    font-style: normal;
    font-weight: 400 700;
    font-display: optional;
    src: url("/static/fonts/geist-latin-ext.woff2") format("woff2");
    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: "Geist";
    font-style: normal;
    font-weight: 400 700;
    font-display: optional;
    src: url("/static/fonts/geist-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
    color-scheme: dark;

    --bg: #0c0a07;
    --surface: #17130e;
    --raised: #221c14;
    --sunken: #100d09;
    --line: #322a1f;
    --line-soft: #241e16;
    /* The boundary of something you can press or type into. A rule between rows may be
       a hairline; the edge of a control may not, or the field stops looking like one. */
    --edge: #322a1f;
    /* Клетка листа зала: её видно, но она тише всякой рамки — по ней целятся, а не жмут. */
    --grid: #2b241a;
    --accent-deep: var(--accent);
    --text: #f6efe2;
    --muted: #a3957d;
    /* На тёмном мелкое и так светлее подложки: касса берёт тот же серый. */
    --ink-soft: var(--muted);
    /* Дробь числа — «,55» у рублей, «,85» у литров: тише подписей, её ищут, а не читают. */
    --kop: #7d7262;
    --accent: #f2a93c;
    --accent-ink: #1a1206;
    --accent-soft: rgba(242, 169, 60, 0.14);
    --accent-line: var(--accent);
    --accent-text: var(--accent);
    --accent-hover: #ffc264;
    --ring: rgba(242, 169, 60, 0.4);
    --ok: #8fbf6b;
    --ok-soft: rgba(143, 191, 107, 0.16);
    --ok-text: #8fbf6b;
    --warn: #f2a93c;
    --warn-soft: rgba(242, 169, 60, 0.16);
    --warn-text: #f2a93c;
    --danger: #e4735c;
    --danger-hover: #e4735c;
    --danger-soft: rgba(228, 115, 92, 0.16);
    --danger-text: #e4735c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5);

    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    --radius: 10px; --radius-sm: 7px; --radius-control: 7px; --radius-pill: 999px;
    --control: 3rem; --control-sm: 2.5rem;

    --t-micro: 0.6875rem;
    --t-small: 0.8125rem;
    --t-body: 0.9375rem;
    --t-lead: 1.0625rem;
    --t-h1: 1.5rem;

    --font: "Geist", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
    --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

/* The office: the same product with the lights on, wearing the kit. Neutral greys off
   the shelf — white sheet, #fafafa desk, #e5e5e5 hairline, #737373 for the quiet voice
   — and one blue that says «this one decides» and «you are here». */
body.office {
    color-scheme: light;

    --bg: #fafafa;
    --surface: #ffffff;
    --raised: #ffffff;
    --sunken: #f5f5f5;
    --line: #e5e5e5;
    --line-soft: #f1f1f3;
    /* Край поля темнее, чем в самом наборе: там он 1,2 к белому и на экране его нет.
       Здесь 3,2 — поле остаётся полем, а на глаз это та же светлая линия. */
    --edge: #8f8f8f;
    --grid: #d8d8dc;
    --text: #0a0a0a;
    --muted: #737373;
    /* Серый для мелкого: на 12 пикселях --muted даёт 4,3 к подложке метки, а нужно
       4,5. Тем же цветом набраны метки типов — их в списке каждая строка. */
    --ink-soft: #595959;
    --kop: #a3a3a3;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-ink: #ffffff;
    --accent-soft: #eff6ff;
    --accent-line: #bfdbfe;
    --accent-text: #1d4ed8;
    --accent-deep: #1d4ed8;
    /* Ореол фокуса: к белому 3,31, к подложке #f5f5f5 — 3,12. При 0,35 было 1,66. */
    --ring: rgba(37, 99, 235, 0.75);
    --mark: var(--accent);
    --ok: #16a34a;
    --ok-soft: #f0fdf4;
    --ok-text: #15803d;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --warn-text: #b45309;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-text: #b91c1c;
    --shadow: 0 1px 2px rgba(10, 10, 10, 0.05);
    --shadow-pop: 0 10px 30px rgba(10, 10, 10, 0.12);

    --radius: 14px;
    --radius-sm: 6px;
    --radius-control: 8px;
    --control: 2.25rem;
    --control-sm: 2rem;
    /* Шапка панели: от неё считают, где садится прилипшая строка заголовков. */
    --hat: 3.5rem;

    --t-micro: 0.75rem;
    --t-small: 0.8125rem;
    --t-body: 0.875rem;
    --t-lead: 1rem;
    --t-h1: 1.125rem;
}

* { box-sizing: border-box; }
/* Место под полосу прокрутки держится занятым всегда. У кого в системе полосы стоят
   постоянно, там страница на десяток строк длиннее прежней сдвигала всё вбок на её
   ширину — и щелчок по отбору читался как прыжок экрана. Кому система рисует полосу
   поверх содержимого, тот не заметит: занимать там нечего. */
html { scrollbar-gutter: stable; }
html, body { height: 100%; }
html { scroll-padding-top: 5.5rem; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
}
body.office { font-size: 14px; }

.num, table, input[inputmode="decimal"], .money { font-variant-numeric: tabular-nums; }
/* Невидимый хвост «,00» у числа без копеек в столбце, где копейки есть: целая часть встаёт
   под целой частью соседа, и разряды считаются глазом. Место занимает, а не читается. */
.tail { visibility: hidden; user-select: none; }
.money { white-space: nowrap; }
.money small { color: var(--muted); margin-inline-start: 0.15em; }
/* Дробь числа тише целой части: «1 250,55» читают по рублям, «44,85 л» — по литрам, а «,55» и
   «,85» — когда ищут (владелец, 29.09: «часть с копейками делать приглушенной везде»). Она
   бледнее подписей: подпись читают, дробь — нет. На цветном — плитке, метке, кнопке, занятом
   столе — серый потерялся бы, и дробь там того же цвета, что число, только прозрачнее. */
.kop { color: var(--kop); }
tspan.kop { fill: var(--kop); }
:is(.badge, .btn--primary, .tile--on, .tile--painted:not(.tile--out), .seat--busy, .tick--on) .kop { color: inherit; opacity: 0.6; }

/* Цвета плиток ------------------------------------------------------------ */

/* Десять цветов, которыми бар красит плитку позиции на кассе, — одни в обеих комнатах: образец в
   карточке офиса тот же, что плитка на кассе. Надпись на плитке белая или почти чёрная — какая
   читается на этом цвете: у каждой пары не меньше 4,5 к одному. */
.paint--amber    { --paint: #b45309; --paint-ink: #ffffff; }
.paint--red      { --paint: #dc2626; --paint-ink: #ffffff; }
.paint--orange   { --paint: #ea580c; --paint-ink: #15161a; }
.paint--yellow   { --paint: #ca8a04; --paint-ink: #15161a; }
.paint--green    { --paint: #16a34a; --paint-ink: #15161a; }
.paint--teal     { --paint: #0d9488; --paint-ink: #15161a; }
.paint--blue     { --paint: #2563eb; --paint-ink: #ffffff; }
.paint--violet   { --paint: #7c3aed; --paint-ink: #ffffff; }
.paint--pink     { --paint: #db2777; --paint-ink: #ffffff; }
.paint--graphite { --paint: #44403c; --paint-ink: #ffffff; }

/* Type ------------------------------------------------------------------- */

h1 { margin: 0; font-size: var(--t-h1); font-weight: 650; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: var(--t-lead); font-weight: 650; }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
a { color: var(--text); text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

/* The quiet voice: a label over a group of rows, a caption under a field. Both are
   read only when the eye goes looking for them, so neither shouts. */
.section, .pane-head, th {
    color: var(--muted);
    font-size: var(--t-micro);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.section { display: block; margin: var(--s5) 0 var(--s3); }
.note { color: var(--muted); font-size: var(--t-small); line-height: 1.35; }

/* Every screen starts the same way: what this is, one line about it if it needs one,
   and what you can do from here on the right. A person who learned one screen has
   learned all of them, so the shape never changes from page to page. */
.head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.head-text { min-width: 0; }
.head .spacer { margin-inline-start: auto; }
/* One line under the title, and only when the screen would be puzzling without it.
   Everything longer belongs next to the field it explains, inside the panel that
   holds it, where it is read at the moment it matters. */
.lede { margin: var(--s1) 0 0; color: var(--muted); font-size: var(--t-body); max-width: 52rem; }
.gap { margin-top: var(--s4); }

/* Icons ------------------------------------------------------------------ */

/* Every icon comes from Tabler Icons (tabler.io, MIT): 24x24 outline, stroke 2,
   round caps. They live in one sprite shipped with the program, because the till
   works without the internet. A new icon is copied into static/icons.svg and used
   as <svg class="icon"><use href="/static/icons.svg#name"/></svg>. Letters and
   punctuation are not icons: no arrows drawn with characters. */
.icon { display: block; width: 1.125rem; height: 1.125rem; flex: none; }
.icon--lg { width: 1.375rem; height: 1.375rem; }
body.office .icon { width: 1rem; height: 1rem; stroke-width: 1.75; }

/* Read aloud but not drawn: a column of order arrows needs a name for whoever hears
   the table instead of seeing it, and the name has nothing to do on screen. */
.hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Seen only when it is reached: the first stop of the keyboard is the way past the hat,
   so a person does not walk seven links of the hat on every screen. */
.skip { position: absolute; inset-inline-start: -100vw; z-index: 30; }
.skip:focus { inset-inline-start: var(--s3); top: var(--s2); }

/* Chrome ----------------------------------------------------------------- */

/* The till wears a hat: the mark on the left, where you can go on the right. The
   office wears a column instead, and builds it in office.css. */
header {
    display: flex;
    align-items: center;
    gap: var(--s4);
    padding: var(--s2) var(--s4);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: 0.02em; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }

/* Только шапка. Закладки над списком и пилюли отбора — тоже nav, и общий вид пункта
   шапки надевался на них поверх собственного: закладка получала фон и скруглённые углы
   пункта меню и переставала быть закладкой. */
header nav { display: flex; gap: var(--s1); margin-inline-start: auto; }
header nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0 var(--s3);
    border-radius: var(--radius-control);
    color: var(--muted);
    font-size: var(--t-small);
    font-weight: 650;
    text-decoration: none;
}
header nav a:hover { background: var(--sunken); color: var(--text); }
header nav a[aria-current="page"] { background: var(--sunken); color: var(--text); }
/* The way out of the room you are in: the till from the office, the office from the
   till. It is the one link in the hat that changes where you are standing, so it is
   the one that is not grey. */
header nav a.to-office, header nav a.to-till { margin-inline-start: var(--s3); color: var(--accent); }

/* Письмо справа налево ---------------------------------------------------- */

/* Набор задаёт отступы и края «от начала» и «от конца», а не «слева» и «справа»,
   поэтому в языке, который пишут справа налево, он разворачивается сам. Разворотом
   букв это не лечится только там, где сторону задаёт поворот или сдвиг: стрелка
   пути, галочка тумблера и открывающееся вбок окно. Комнаты бара по-русски — этот
   разрез включают вместе с языком, которому он нужен. */
[dir="rtl"] .path .icon { transform: scaleX(-1); }
[dir="rtl"] .switcher:checked::after { transform: translateX(-0.875rem); }
[dir="rtl"] .veil--side .window { border-inline-start-width: 0; border-inline-end-width: 1px; }
