/* Studiolo design tokens (contract C2 §8). Every colour, size and motion of the
   table, panels and site comes from here, so the look can change without a rewrite.
   Direction: walnut, deep blue felt with gold, parchment, after the old deck. */

@font-face {
  font-family: "Forum";
  src: url("/web/fonts/Forum-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Alegreya";
  src: url("/web/fonts/Alegreya-Variable.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: "Forum", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-text: "Alegreya", "Palatino Linotype", Georgia, serif;

  /* Page and table */
  --c-bg: #1a120c;            /* dark walnut behind everything */
  --c-felt: #16304f;          /* deep blue table cloth */
  --c-felt-2: #0e2139;        /* felt edge, darker */
  --c-wood: #5a3a22;          /* walnut rail */
  --c-wood-2: #3b2414;
  --c-parchment: #f2e6c9;     /* card faces, panels */
  --c-parchment-2: #e6d5ad;
  --c-ink: #2a1b10;           /* text on parchment: 13:1 on --c-parchment */
  --c-ink-soft: #5b4532;      /* secondary text on parchment: 6.6:1 */
  --c-on-felt: #f4ead2;       /* text on felt: 11:1 on --c-felt */
  --c-on-felt-soft: #c9bb98;  /* 6.4:1 on --c-felt */
  --c-gold: #d7b46a;          /* gold lines and highlights: 6.9:1 on --c-felt */
  --c-gold-soft: #8f7440;
  --c-on-page-accent: var(--c-gold); /* the brand in the header and the hints on the wood around the table; a skin may set it */
  --c-accent: #9c2f22;        /* vermilion of the old deck: cups, coins on the index */
  --c-suit-dark: #24384f;     /* swords, batons on the index */
  /* The card's own colours (frame, not skin): a card, its index plate and its glow look the same in every skin.
     table.css puts them back on .card over the skin's values. Same values as the default look. */
  --card-parchment: #f2e6c9;
  --card-shadow: rgba(0, 0, 0, 0.45);
  --card-text: #f4ead2; /* the inherited text colour of a card (the default --c-on-felt) */
  --card-parchment-2: #e6d5ad;
  --card-ink: #2a1b10;
  --card-ink-soft: #5b4532;
  --card-gold: #d7b46a;
  --card-gold-soft: #8f7440;
  --card-accent: #9c2f22;
  --card-parchment-a95: rgba(242, 230, 201, 0.95);
  --card-gold-a90: rgba(215, 180, 106, 0.9);
  --c-danger: #b3261e;
  --c-ok: #3f7d4e;
  --c-focus: #ffd666;
  --c-shadow: rgba(0, 0, 0, 0.45);

  /* ---- Colours that used to be written straight into the stylesheets (lane T1). Same values as before. ---- */
  --c-shade: #000;                /* shading and shadows: black */
  --c-hilite: #fff;               /* a faint light veil */
  --c-gold-hover: #e4c685;        /* primary button under the pointer */
  --c-on-danger: #fff;            /* text on --c-danger */
  --c-error-text: #ffb4a8;        /* error line on the dark page */
  --c-ok-text: #1f5a2f;           /* "in the book" mark, ok badge text */
  --c-ok-bg: #dcebd5;
  --c-wait-text: #6a4a12;
  --c-wait-bg: #f1e2b6;
  --c-read-text: #8a5a00;
  --c-scrim-panel: rgba(10, 8, 6, 0.62);  /* behind a panel dialog */
  --c-scrim-sheet: rgba(10, 6, 3, 0.7);   /* behind a sheet */
  --c-scrim-zoom: rgba(12, 8, 5, 0.9);    /* behind the zoomed card */
  --c-cardback-a: #20406a;        /* card back pattern: the card back is the frame's, not the skin's */
  --c-cardback-b: #2b5285;

  /* Button, plate, hint: three different looks, the form is the frame's, the colours are the skin's */
  --c-btn-bg: var(--c-parchment);
  --c-btn-text: var(--c-ink);
  --c-btn-edge: var(--c-gold-soft);
  --c-plate-bg: rgba(6, 14, 28, 0.62);
  --c-plate-text: var(--c-on-felt);
  --c-hint-bg: transparent;
  --c-hint-text: var(--c-on-felt-soft);
  --c-hint-edge: var(--c-gold-a40);

  /* Suit colours of the frame (read at the card index in the new layout; the skin does not set them) */
  --c-suit-swords: #2b4a8b;
  --c-suit-batons: #2f6b3a;
  --c-suit-cups: #8b2b2b;
  --c-suit-coins: #765a14;
  --c-suit-trumps: #3a2418;

  /* Colour with alpha: the default look keeps the exact values it had; a skin derives them from its own colours (block at the end) */
  --c-wood-a28: rgba(90, 58, 34, 0.28);
  --c-wood-a12: rgba(90, 58, 34, 0.12);
  --c-gold-a22: rgba(215, 180, 106, 0.22);
  --c-gold-a15: rgba(215, 180, 106, 0.15);
  --c-gold-a35: rgba(215, 180, 106, 0.35);
  --c-gold-a45: rgba(215, 180, 106, 0.45);
  --c-gold-a90: rgba(215, 180, 106, 0.9);
  --c-gold-a40: rgba(215, 180, 106, 0.4);
  --c-gold-a50: rgba(215, 180, 106, 0.5);
  --c-gold-soft-a10: rgba(143, 116, 64, 0.1);
  --c-ok-a12: rgba(63, 125, 78, 0.12);
  --c-ink-a15: rgba(42, 27, 16, 0.15);
  --c-ink-a25: rgba(42, 27, 16, 0.25);
  --c-parchment-a95: rgba(242, 230, 201, 0.95);
  --c-hilite-a05: rgba(255, 255, 255, 0.05);
  --c-hilite-a08: rgba(255, 255, 255, 0.08);
  --c-shade-a18: rgba(0, 0, 0, 0.18);
  --c-shade-a25: rgba(0, 0, 0, 0.25);
  --c-shade-a28: rgba(0, 0, 0, 0.28);
  --c-shade-a35: rgba(0, 0, 0, 0.35);
  --c-shade-a40: rgba(0, 0, 0, 0.4);
  --c-shade-a50: rgba(0, 0, 0, 0.5);
  --c-shade-a55: rgba(0, 0, 0, 0.55);

  /* Frame of a button, a tab, the rail and the felt (lane K). All of them are optional in a skin; the values below
     draw exactly what the frame drew before. A skin sets them in web.tokens (docs/SKINS.md). */
  --btn-edge-w: 1px;              /* 0..3px: the width of the edge of a button and a tab */
  --btn-shadow: none;             /* skin words none | soft | raised become a box-shadow in shared/skin.js */
  --btn-case: none;               /* skin words none | upper become none | uppercase */
  --c-tab-bg: var(--c-wood-2);    /* a tab (class btn-tab) and a bar button (btn-bar): not selected ... */
  --c-tab-text: var(--c-on-felt);
  --c-tab-edge: var(--c-gold-soft);
  --c-tab-on-bg: var(--c-parchment); /* ... and selected (aria-selected or aria-pressed is "true") */
  --c-tab-on-text: var(--c-ink);
  --c-tab-on-edge: var(--c-gold);
  --c-button-img-text: var(--c-ink);  /* the text of the main button when it is a picture (web.button) */
  /* the main button: how the picture button differs from the coloured one; shared/skin-frame.js sets these with web.button */
  --btn-prim-bg: var(--c-gold);
  --btn-prim-bg-hover: var(--c-gold-hover);
  --btn-prim-color: var(--c-ink);
  --btn-prim-clip: border-box;
  --btn-prim-bw: var(--btn-edge-w);
  --btn-prim-bc: var(--c-gold);
  --btn-prim-radius: var(--radius-m);
  --c-score: currentcolor;        /* the numbers and the title of the hand score */
  --c-rail-icon: currentcolor;    /* the icons and labels of the column of sections */
  --c-rail-line: var(--c-gold-soft);  /* the thin line of the table rail where there is no rail picture */
  /* Optional colours of lane K2: what is chosen, the plate of the player, the second entrance. Same values as the frame drew before. */
  --c-rail-on-bg: var(--c-parchment);   /* the current item of the column of sections */
  --c-rail-on-text: var(--c-ink);
  --c-sel-bg: var(--c-gold);            /* "chosen": the circle of the number of players, a pressed language or lens, the letter of the layout */
  --c-sel-text: var(--c-ink);
  --c-me-bg: var(--c-shade-a25);        /* the plate «Вы» and the buttons of the strip of the hand */
  --c-alt-bg: transparent;              /* the second entrance of the home page and the circles that are not chosen */
  --c-alt-text: var(--c-on-felt);
  --c-alt-edge: var(--c-gold);
  --alt-radius: var(--btn-prim-radius); /* 0px..32px: the corners of the second entrance */
  /* the bottom tabs of a phone and a tablet; the tabs of the panel of a laptop keep the tab colours above */
  --c-dock-bg: var(--c-tab-bg);
  --c-dock-text: var(--c-tab-text);
  --c-dock-edge: var(--c-tab-edge);
  --c-dock-on-bg: var(--c-tab-on-bg);
  --c-dock-on-text: var(--c-tab-on-text);
  --c-dock-on-edge: var(--c-tab-on-edge);
  --c-slot-bg: var(--c-hint-bg);        /* the dashed place «Ваша карта» on the felt */
  --c-slot-text: var(--c-hint-text);
  --c-slot-edge: var(--c-gold);
  --c-hero-plate: var(--c-felt);          /* the plate behind the text of the first screen of the home page */
  --c-hero-text: var(--c-on-felt);        /* its text and its quiet text */
  --c-hero-text-soft: var(--c-on-felt-soft);
  --label-case: none;             /* skin word none | upper: the status line and the names on the plates of the table, layout D from 768 px */
  --felt-glow: transparent;       /* the light at the middle of the cloth (drawn only when a skin sets it) */

  /* Pictures of a skin. "none" until a skin sets them (web/skins/<id>/); the default look has no pictures. */
  --img-page: none;
  --img-felt: none;
  --img-panel: none;
  --img-rail: none;
  --img-medal: none;
  --img-ornament: none;
  --img-ornament-tr: none;       /* the same corner turned: made by shared/skin.js when web.ornament_corners is 4 */
  --img-ornament-bl: none;
  --img-ornament-br: none;
  --img-glow: none;              /* the light on the cloth: skin-frame.js makes it of --felt-glow */
  --img-button: none;            /* web.button: the nine-slice picture of the main button */
  --dropcap-float: none; --dropcap-size: 1em; --dropcap-lh: inherit; --dropcap-pad: 0; --dropcap-color: inherit; --dropcap-weight: inherit; --dropcap-font: inherit; /* --dropcap "on" of a look: see css/site.css */
  --img-plate: none;             /* web.plate: the nine-slice picture round the plate of a finished trick (the text stays live) */
  --page-size: cover;             /* bg_fit of the skin */
  --page-pos: center;
  --page-repeat: no-repeat;       /* tile of bg_fit repeats */
  --felt-size: auto;              /* felt_fit: "auto" is a tile, "cover" is one picture */
  --felt-repeat: repeat;
  --img-hero: var(--img-felt);    /* web.hero: the cloth of the first screen of the home page; by default the cloth of the table */
  --hero-size: var(--felt-size);
  --hero-repeat: var(--felt-repeat);
  --panel-slice: 48 48 48 48;     /* panel_margins: where the nine-slice cuts the picture */
  --panel-edge: 24px;             /* width the cut edges are drawn at */
  --rail-slice: 24 24 24 24;      /* rail_margins */
  --rail-edge: 24px;
  /* the width of the rail by sides and the places of the corner pictures: shared/skin-frame.js sets them for the skin word --felt-frame
     (normal | wide | sides); without a word they are what --rail-edge was */
  --rail-edge-x: var(--rail-edge);
  --rail-edge-y: var(--rail-edge);
  --rail-edge-w: var(--rail-edge);
  --trick-in-x: 0px;               /* the trick keeps this far from the left and right edge of the felt, and --trick-in-y from the bottom: the rail is drawn inside the felt box */
  --trick-in-y: 0px;
  --top-pad: 8px;                  /* the room above the row of the opponents' plates (a wide rail: 0, the plates sit on the upper band) */
  --trick-cap: 26px;               /* the name tag under a card of the trick: it may lie on the lower band of the rail */
  --rail-inset-x: 0px;             /* the stacks at the edges of the felt stand this much further in */
  --seat-inset-x: 0px;             /* the columns of the side seats stand this much further in (a wide side band: the plates stay in the field) */
  --ornament-at-x: var(--rail-edge-x);
  --ornament-at-y: var(--rail-edge-y);
  --ornament-size: clamp(56px, 12vmin, 132px); /* the corner ornament stays in its corner, off the seats' plates */
  --button-slice: 20 32 20 32;    /* web.button_margins */
  --button-edge: 18px 32px 18px 32px; /* the width the cut edges of the button are drawn at (capped, see below) */
  --button-cap-x: 32px;
  --button-cap-y: 18px;
  --heading-case: none;           /* heading_case of the skin: none or uppercase */

  --radius-s: 4px;
  --radius-m: 10px;
  --radius-card: 7px;

  --gap-s: 4px;
  --gap-m: 8px;
  --gap-l: 16px;

  --tap: 44px;
  --tap-min: 24px;

  --motion-fast: 120ms;
  --motion-normal: 240ms;
  --motion-slow: 420ms;

  --card-ratio: 90 / 189;

  --z-panel: 40;
  --z-zoom: 80;
}

@media (max-width: 599px) {
  :root { --button-cap-x: 16px; } /* a ribbon button on a phone: its ends must not eat the width */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-normal: 0ms;
    --motion-slow: 0ms;
  }
}

/* A skin (any look but the default) derives its colours with alpha from the colours it sets, so one change of
   --c-gold recolours every gold veil. The default look keeps the literal values above: they paint the same pixels
   as before, color-mix() does not (it rounds alpha differently). Shade and hilite stay black and white. */
:root[data-skin]:not([data-skin="studiolo"]) {
  --c-wood-a28: color-mix(in srgb, var(--c-wood) 28%, transparent);
  --c-wood-a12: color-mix(in srgb, var(--c-wood) 12%, transparent);
  --c-gold-a22: color-mix(in srgb, var(--c-gold) 22%, transparent);
  --c-gold-a15: color-mix(in srgb, var(--c-gold) 15%, transparent);
  --c-gold-a35: color-mix(in srgb, var(--c-gold) 35%, transparent);
  --c-gold-a45: color-mix(in srgb, var(--c-gold) 45%, transparent);
  --c-gold-a90: color-mix(in srgb, var(--c-gold) 90%, transparent);
  --c-gold-a40: color-mix(in srgb, var(--c-gold) 40%, transparent);
  --c-gold-a50: color-mix(in srgb, var(--c-gold) 50%, transparent);
  --c-gold-soft-a10: color-mix(in srgb, var(--c-gold-soft) 10%, transparent);
  --c-ok-a12: color-mix(in srgb, var(--c-ok) 12%, transparent);
  --c-ink-a15: color-mix(in srgb, var(--c-ink) 15%, transparent);
  --c-ink-a25: color-mix(in srgb, var(--c-ink) 25%, transparent);
  --c-parchment-a95: color-mix(in srgb, var(--c-parchment) 95%, transparent);
}

/* the default look: a dark second entrance on the home page, as on the mock-up (a skin sets its own --c-alt-bg) */
:root:not([data-skin]), :root[data-skin="studiolo"] { --c-alt-bg: var(--c-felt-2); }
