/* ==========================================================================
   usual.red — base: tokens, fonts, reset, named text styles, item states.

   Values come from Figma "web 3.0" (file 7jm5DUx5HbEVl1BsjrxT1M). Where the
   brief says "как было", they come from the old pasha.rehab tokens
   (git show main:assets/tokens.css).

   Named text styles — use the class, never spell a size out:

     .ts-base       Arial Regular 20/23, black           — everything by default
     .ts-button     Arial Regular 33/33, black           — menu and list items
     .ts-button-italic  .ts-button in Arial Italic       — Index, Timeline, Type
     .ts-quiet      .ts-base at 60%                      — About, the copy of a block
     .ts-highlight  .ts-base in --accent                 — accents in copy
     .ts-title      Arial Narrow Bold Italic 20/23, black — a block's title
     .ts-micro      Arial Regular 12/13, #605E5C, on the line's top — micro
                    comments, years, --note-gap after their word
     .ts-link       .ts-button, underlined               — every link in copy
     .ts-mark       --accent                             — red words in copy
     .ts-obr        Obr Var Regular 96/1 on a 102px plate, in proportion to
                    it (--typer-h) — the typing block (obr var); its ink is
                    the block's

   States — one set for every menu, list and link:

     .is-current    the page you are on: --ink-lit, a red glow round the letters
     :hover         the same
     .is-viewed     --ink-visited: opened since the page was loaded (About me
                    too; a link in copy: .is-followed)
     .is-next       "(Next one)" micro comment after the name (the sheet only)
   ========================================================================== */

:root {
  /* ---- colour ---- */
  --bg: #EBEBEB;                    /* page ground */
  --sheet-bg: var(--bg);            /* the sheet (шторка): same grey as the page */
  /* Over the sheet's top, outside it (no part of its size): a strip of the
     page's grey, --sheet-rim-w, then the white edge, --sheet-edge-w, above
     it. The white fades out as the sheet closes; the grey stays. */
  --sheet-rim-w: 2px;
  --sheet-edge-w: 2px;
  --sheet-edge-color: #FFFFFF;
  --sheet-rim: 0 calc(-1 * var(--sheet-rim-w)) 0 0 var(--bg);
  --sheet-edge-lift: calc(-1 * (var(--sheet-rim-w) + var(--sheet-edge-w)));
  --sheet-edge: 0 var(--sheet-edge-lift) 0 0 var(--sheet-edge-color);
  --ink: #000000;                   /* text */
  --ink-quiet: rgba(0, 0, 0, 0.6);  /* тихий текст (About), a block's copy */
  /* Text blocks of the cases keep the old pasha.rehab inks: */
  --ink-text: rgba(0, 0, 0, 0.68);  /* case tagline */
  --ink-faint: rgba(0, 0, 0, 0.4);  /* notes and quiet lines */
  --accent: #D53E0F;                /* ↵, (Next one), underlines, red words, selection */
  --ink-lit: #3D0000;               /* a link glowing */
  --ink-visited: #85000D;           /* a case already opened, a link already followed */
  --media-bg: #FFFFFF;              /* under an image or a video: transparent art shows on white */

  /* ---- fonts: Adobe Fonts kit uuw6roz ----
     The kit's helvetica-neue-lt-pro has Roman 400 and Bold 700 only, no
     Medium 500. Until Medium is added to the kit, the local Helvetica Neue
     (macOS/iOS, which has Medium) goes first; elsewhere the kit's Roman is
     used. Once Medium is in the kit, swap the first two names. */
  --font-text: "Helvetica Neue", "helvetica-neue-lt-pro", Arial, sans-serif;
  --font-text-cond: "helvetica-neue-lt-pro-cond", "Helvetica Neue", Arial, sans-serif;
  --font-arial: "arial", Arial, sans-serif;
  --font-arial-narrow: "arial-narrow", "Arial Narrow", Arial, sans-serif;
  --font-obr: "obr", var(--font-arial);   /* Obr Var, below */

  /* ---- named text styles (font shorthand: weight size/leading family) ---- */
  --type-base: 400 20px/23px var(--font-arial);
  --type-title: italic 700 20px/23px var(--font-arial-narrow);
  --type-button: 400 33px/33px var(--font-arial);
  --type-button-italic: italic 400 33px/33px var(--font-arial);
  --type-micro: 400 12px/13px var(--font-arial);
  /* 96px on the typing block's 102px plate (Figma 3853:1513), and in that
     proportion to the plate as it changes (--typer-h). */
  --type-obr: 400 calc(var(--typer-h) * 96 / 102)/1 var(--font-obr);

  /* ---- the typing block (obr var, css/blocks.css) ----
     102px tall in 1110px of width (Figma 3853:1512), in that proportion when
     narrower; cqi is the width of the block's row (.wide). */
  --typer-h: min(102px, 102 / 1110 * 100cqi);

  /* ---- decoration ---- */
  --deco: 1.5px;                    /* underline thickness */
  --glow: #FF1100;                  /* the glow round a selected or hovered item */
  --glow-blur: 8px;                 /* Figma drop shadow: 0 0, blur 8, spread 0 */
  --glow-fade: 0.2s;                /* it comes over this */
  --glow-fade-out: 0.8s;            /* and goes four times slower */
  --selection-blur: 4px;            /* how soft the red under selected text is */
  --ink-micro: #605E5C;             /* micro comments */
  --note-gap: 8px;                  /* a micro comment after its word, everywhere */
  --timeline-shift: 171px;          /* how far the oldest case slides in the Timeline view */

  /* ---- space ---- */
  --frame: 80vw;                    /* content width, как было: 10vw each side */
  --col-gap: 34px;                  /* between the three columns: 369px each at 1470 (Figma) */
  --stack: 12px;                    /* between blocks in a column, every screen */
  --project-gap: 48px;              /* between two projects (blocks with years) instead */
  --after-head: 24px;               /* the case's first line → the columns */
  --gutter: 12px;                   /* side margin on mobile */
  --pad-x: 32px;                    /* menu inset from the screen edge */
  --pad-top: 24px;                  /* menu from the top of the page and of the sheet */

  /* The list → the page's first line, grid or About copy: one gap on every
     page, where the wavy rule and the gaps round it used to be. */
  --after-list: 82px;

  /* ---- bottom of a case ----
     Extra room between the end of the columns and the sheet, so the sheet
     first slides over empty space; how blurred the page is under the
     sheet, and only there; and how it loses its colour as the sheet covers
     it (js/fall.js). */
  --page-tail: 120px;
  --sheet-blur: 2px;                /* the page under the sheet: a little blurred */
  --sheet-fade: 100%;               /* how much colour the page loses as the sheet covers it (grayscale) */
  --fade-from: 15%;                 /* the page starts to lose it once the sheet covers this much */
  /* The sheet comes in tilted, between --sheet-tilt-min and --sheet-tilt-max
     either way, a new angle each time, and straightens as it rises: level at
     --settle-from, where it may close by itself (js/fall.js). It is
     --sheet-overhang wider than the screen each side, so its tilted corners
     never show the page beside it. */
  --sheet-tilt-min: 3deg;
  --sheet-tilt-max: 5deg;
  --sheet-overhang: 48px;
  /* Once the sheet covers --fall-at, the page falls back as on pizzapizza.io:
     at once, over --fall, not following the scroll; below it, it comes back
     the same way (js/fall.js). --fall-ease is pizzapizza.io's own spring
     (react-spring, mass 1, tension 280, friction 20, clamped), which ends
     in --fall. */
  --fall-at: 25%;
  --fall: 165ms;
  --fall-ease: linear(0, 0.024, 0.087, 0.177, 0.283, 0.397, 0.511, 0.62, 0.721, 0.81, 0.886, 0.95, 1);
  /* From --closing-from covered, the sheet closes, following the scroll: its
     white edge fades, the glow on the current case in it too, and the ground
     behind the page turns to --backdrop (css/layout.css). */
  --closing-from: 75%;
  --settle-from: 25%;              /* stopped past this much covered, the sheet closes by itself (js/settle.js) */
  --backdrop: var(--bg);            /* behind the page as it falls back: the usual grey */
  --fall-scale: 0.95;
  --sheet-fill-from: 40%;           /* the sheet's grey starts this opaque, reaches 100% when it covers */

  /* ---- blurred placeholder of a photo while it loads (css/blocks.css) ----
     One steady blur; the photo comes in from it over --lqip-fade. */
  --lqip-blur: 14px;
  --lqip-fade: 0.2s;                /* the photo coming in over it: unblurring, fading in */
  --lqip-out: 0.4s;                 /* then the placeholder going */

  /* ---- a block coming in (js/loader.js, js/lqip.js) ----
     When its turn comes, it turns opaque while all of it comes into focus
     from --reveal-blur, the blur spilling past its edges: over --reveal,
     or, for a block with media, as they download (js/lqip.js). The next
     block anywhere on the page follows a moment later (STAGGER there). */
  --reveal: 1600ms;
  --reveal-loaded: calc(var(--reveal) / 2); /* a block with nothing left to load */
  --reveal-blur: 48px;

  /* ---- the first look of a page (css/layout.css) ----
     Its header and its case's first line, once, on a real page load. */
  --intro: 400ms;
  --intro-blur: 4px;

  /* ---- a page going (js/router.js, css/layout.css) ----
     Moving to another page of the site, all of the old one but its header
     blurs and fades out over --leave before the next takes its place. */
  --leave: 150ms;
  --leave-blur: var(--intro-blur);

  /* ---- media in a block (css/blocks.css) ---- */
  --media-gap: 4px;                 /* between two media on one line */
  --media-edge-thick: 4px;          /* the line in the art's own colour (edge: in data.js) */
  --r-media: 8px;                   /* every image and video, the About photo too */

  /* ---- shadow ---- */
  --shadow-tile: 0 0 12px 0 rgba(0, 0, 0, 0.2);   /* under every image and video */
  --shadow-vector: 0 0 8px rgba(0, 0, 0, 0.2);    /* under vector art, right under its shapes (Figma: drop shadow, blur 8) */
}

/* Mobile, как было: one breakpoint at 768px. */
@media (max-width: 768px) {
  :root {
    --pad-x: 12px;
    --pad-top: 8px;                 /* from the browser bar, page and sheet alike */
    --after-list: 121px;
    /* Taller for its width than on the web, so the letters are too and
       fewer fit: four times, then a third less (÷ 1.5) — 89px on a 390px
       phone, and no taller. */
    --typer-h: min(134px / 1.5, 4 / 1.5 * 102 / 1110 * 100cqi);
  }
}

/* Obr Var, Pavlo's typeface (its demo: assets/obr-var/obr-var.zip). Lower
   case a–z, space and a little punctuation, with ligatures; no capitals,
   no digits. The site's copy (scripts/obr-web.mjs) also gives each letter's
   alternates characters of their own (pages/obr.js). Invisible until it
   has loaded, never in a fallback. */
@font-face {
  font-family: "obr";
  src: url("/assets/obr-var/obr-web.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* Page to page: the browser keeps the old page until the new one is ready and
   crossfades between them, instead of flashing an empty page. */
@view-transition {
  navigation: auto;
}

/* ---- reset ---- */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Scrollbar hidden, как было. overflow-anchor: none — js/sheet.js corrects
   the scroll itself when it removes the case above a sheet. */
html {
  overflow-anchor: none;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

/* clip, not hidden: hidden would turn body into its own scroll container and
   break the sticky case page (css/layout.css). */
body {
  background: var(--bg);
  color: var(--ink);
  font: var(--type-base);
  text-align: left;
  overflow-x: clip;
}

ul,
ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

/* Selected text: white on blurred red.
   ::selection takes no filter, so the browser's own highlight is cleared and
   js/selection.js draws the red under the selected lines in .selection__glow
   and the same lines in white over it in .selection__text. On a phone, the
   browser's own highlight in the same red, unblurred, and no layer. */
@media (min-width: 769px) {
  ::selection {
    background-color: transparent;
  }
}

@media (max-width: 768px) {
  ::selection {
    background-color: var(--accent);
    color: #FFFFFF;
  }
}

.selection {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
}

.selection__glow {
  position: absolute;
  inset: 0;
  filter: blur(var(--selection-blur));
}

.selection__glow > div {
  position: absolute;
  background-color: var(--accent);
}

.selection__text > div {
  position: absolute;
  white-space: pre;
  color: #FFFFFF;
}

/* ---- named text styles ---- */

.ts-base {
  font: var(--type-base);
  color: var(--ink);
}

.ts-quiet {
  font: var(--type-base);
  color: var(--ink-quiet);
}

.ts-highlight {
  font: var(--type-base);
  color: var(--accent);
}

.ts-title {
  font: var(--type-title);
  color: var(--ink);
}

/* Micro comment: small, grey, hung on the top of the line it sits in (the
   e-mail next to "Email"; years later). line-height normal and
   vertical-align: top keep it from stretching the line. */
.ts-micro {
  font: var(--type-micro);
  color: var(--ink-micro);
  vertical-align: top;
}

.ts-button {
  font: var(--type-button);
  color: var(--ink);
}

.ts-button-italic {
  font: var(--type-button-italic);
  color: var(--ink);
}

.ts-obr {
  font: var(--type-obr);
}

/* Every link in copy — the case's first line, cards, About — shares the
   menu's button style, underlined. */
.ts-link {
  font: var(--type-button);
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: var(--deco);
}

.ts-mark {
  color: var(--accent);
}

/* ---- states ----
   The red glow is a text shadow, --glow-blur soft, fading in over
   --glow-fade and out, four times slower, over --glow-fade-out (from the
   same shadow, clear): each state carries the transition that leads into
   it. Glowing, a link's letters turn --ink-lit with it. Where the visitor
   has already gone since the page was loaded — a case or About opened, a
   link in copy clicked (js/states.js) — turns --ink-visited (for an item,
   --rest, which the sheet fades its current item back to, css/layout.css).
   A reload clears it: not :visited, which the browser keeps. */

.is-viewed > .item__name {
  --rest: var(--ink-visited);
}

.ts-link.is-followed {
  color: var(--ink-visited);
}

.item__name,
.ts-link {
  text-shadow: 0 0 var(--glow-blur) transparent;
  transition: text-shadow var(--glow-fade-out) ease, color var(--glow-fade-out) ease;
}

.is-current > .item__name,
.item__name:hover,
.ts-link:hover {
  color: var(--ink-lit);
  text-shadow: 0 0 var(--glow-blur) var(--glow);
  transition-duration: var(--glow-fade);
}

/* (Next one) and (Recent one): micro comments, --note-gap after the name, on
   the top of its line (align-self: the row is a flex line). Empty while the
   Timeline view shows the years instead, and then they take no room. */
.item__mark {
  margin-left: var(--note-gap);
  font: var(--type-micro);
  color: var(--ink-micro);
  align-self: flex-start;
}

.item__mark:empty {
  margin-left: 0;
}
