/* Archive of Cyrillic websites.
   Three colours (black, white, one solid grey), one font (Inter Tight 380-440), no borders.
   Radii nest: an inner radius is the outer radius minus the padding between them.
   Motion: short, ease-out on the way in, about a third shorter on the way out; only opacity and
   transform where possible; with reduced motion only opacity changes (WCAG 2.3.3). */
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight.woff2") format("woff2");
  font-weight: 380 440;
  font-display: swap;
}

:root {
  /* colour */
  --black: #000;
  --white: #fff;
  --grey: #efefef;
  /* type */
  --font: "Inter Tight", system-ui, sans-serif;
  --w-text: 380;
  --w-strong: 440;
  --t-text: 13px;       /* the only text size; the page title is the one exception */
  --leading: 18px;
  /* space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --margin: var(--s4);
  /* shape */
  --hit: 36px;
  --r-tile: 24px;
  --pad-tile: var(--s1);   /* card edge to screenshot */
  --r-card: calc(var(--r-tile) - var(--pad-tile));
  --r-panel: 24px;
  --pad-panel: var(--s2);
  --r-inner: calc(var(--r-panel) - var(--pad-panel));
  --r-sheet: 32px;
  --pill: 999px;
  --gap-pill: var(--s1);   /* between pills in a row: filter menus, tags, count, language */
  /* motion (NN/g: 100-500 ms, enter longer than exit, frequent actions shorter) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);    /* things arriving */
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);     /* things leaving */
  --ease-move: cubic-bezier(0.65, 0, 0.35, 1);   /* things changing size in place */
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);   /* ease-out cubic: no sudden start, for the card hover */
  --t-hover: 120ms;
  --t-in: 200ms;
  --t-out: 140ms;
  --t-size: 240ms;
  --t-sheet: 300ms;
  --t-card: 320ms;      /* a card growing under the pointer */
  --t-image: 400ms;     /* a screenshot surfaces slowly from the card's grey */
  --lift: 6px;          /* how far a panel travels as it appears */
  --shrink: 0.97;       /* the scale a panel grows from */
  --press: 0.97;        /* the scale of a pressed button */
  --grow: 1.01;         /* a card under the pointer */
  --sink: 0.98;         /* a pressed card */
}
@media (min-width: 768px) {
  :root { --margin: var(--s6); }
}
@media (pointer: coarse) {
  :root { --hit: 44px; }   /* Apple HIG: 44 pt targets on touch screens */
}
@media (prefers-reduced-motion: reduce) {
  :root { --lift: 0px; --shrink: 1; --press: 1; --grow: 1; --sink: 1; --t-size: 0ms; }
}
/* EN/RU are two pages: cross-fade between them where the browser can */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }   /* pressed scale is the feedback */
body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font: var(--w-text) var(--t-text)/var(--leading) var(--font);
  font-feature-settings: "case" 0;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
[hidden] { display: none !important; }

/* the bar with filters, search and language stays on screen while scrolling */
.bar {
  position: sticky;
  z-index: 20;
  top: 0;
  padding: var(--s3) var(--margin);
  background: var(--white);
}
/* brand on the left, search and filter menus in the middle, language on the right.
   Phone: brand and language, then search and the Filters button. */
.tools { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand langs" "filters filters"; gap: var(--s2); align-items: center; }
.brand { grid-area: brand; justify-self: start; display: flex; align-items: center; gap: var(--s3); min-width: 0; max-width: 100%; }   /* only as wide as the heart and the name: hover starts there */
.brand h1 { cursor: pointer; margin: 0; overflow: hidden; font-size: var(--t-text); font-weight: var(--w-strong); text-overflow: ellipsis; white-space: nowrap; }
.corner { grid-area: langs; justify-self: end; display: flex; gap: var(--gap-pill); align-items: center; }
/* The heart opens About: on hover where there is a pointer, on tap on a touch screen. A click on
   the heart or the name takes the page back to the top.
   At rest it is whole. Under the pointer it cracks into two halves that lean apart from the tip;
   a click mends it with one beat (app.js), and it stays whole while About is open. */
.mark { flex: none; display: grid; place-items: center; width: var(--hit); height: var(--hit); padding: 0; border: 0; border-radius: var(--pill); background: var(--grey); color: var(--black); }
.mark svg { width: 36px; height: 36px; overflow: visible; }
/* On the way back the halves stay drawn until they have closed, then the whole heart returns. */
.mark .whole { transition: opacity 0s var(--t-out); }
.mark .l, .mark .r { opacity: 0; transform-box: view-box; transform-origin: 18px 24.5px;
  transition: transform var(--t-out) var(--ease-out), opacity 0s var(--t-out); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .brand:hover .mark:not([aria-expanded="true"]) :is(.whole, .l, .r) { transition: transform var(--t-in) var(--ease-out), opacity 0s; }
  .brand:hover .mark:not([aria-expanded="true"]) .whole { opacity: 0; }
  .brand:hover .mark:not([aria-expanded="true"]) .l { opacity: 1; transform: translateX(-0.6px) rotate(-14deg); }
  .brand:hover .mark:not([aria-expanded="true"]) .r { opacity: 1; transform: translateX(0.6px) rotate(14deg); }
}
.panel.about { display: block; width: min(380px, calc(100vw - 2 * var(--margin))); padding: var(--s4) var(--s5); white-space: normal; }
.panel.about::after { content: none; }
.about p { margin: 0; }
.about p + p { margin-top: var(--s3); }
.about a { color: inherit; text-underline-offset: 3px; }
/* «Отдельное спасибо» heads its part as a white pill, like a picked filter on the black panel. */
.about h2 { display: inline-block; margin: var(--s5) 0 var(--s3); padding: var(--s1) var(--s3); border-radius: var(--pill); background: var(--white); color: var(--black); font-size: var(--t-text); font-weight: var(--w-strong); line-height: var(--leading); }
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s3); margin: 0 0 var(--s3); padding: 0; list-style: none; }   /* two names to a row */
.people a { display: flex; gap: var(--s3); align-items: center; color: inherit; font-weight: var(--w-strong); text-decoration: none; }
.about .updated { margin-top: var(--s5); opacity: 0.6; }
.people img { flex: none; width: 32px; height: 32px; border-radius: var(--pill); background: var(--grey); }
/* The note opens while the pointer is on the heart, the name next to it or the note itself (its links). */
@media (hover: hover) {
  .info:hover .panel { visibility: visible; opacity: 1; transform: none;
    transition: opacity var(--t-in) var(--ease-out), transform var(--t-in) var(--ease-out), visibility 0s; }
}
/* The search circle sits at the start of the row in a reserved slot, so the row never changes width. */
.filters {
  grid-area: filters;
  position: relative;
  display: flex;
  gap: var(--gap-pill);
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: var(--hit);
  padding-left: calc(var(--hit) + var(--s2));
}
.filters > :not(.search) {
  transition: opacity var(--t-in) var(--ease-out) var(--t-out), visibility 0s;
}
@media (min-width: 768px) {
  .tools { grid-template-columns: 1fr auto 1fr; grid-template-areas: "brand filters langs"; }
  .filters { justify-content: center; }
}

/* Search: a circle with a magnifier; on focus it grows over the whole filter row and the menus
   fade out underneath. A query left behind shows as a chip next to the selected tags. */
.search {
  position: absolute;
  z-index: 1;
  top: calc(50% - var(--hit) / 2);
  left: 0;
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: var(--hit);
  height: var(--hit);
  padding-left: calc((var(--hit) - 16px) / 2);
  overflow: hidden;
  border-radius: var(--pill);
  background: var(--grey);
  cursor: pointer;
  transition: width var(--t-size) var(--ease-move), transform var(--t-hover) var(--ease-out);
}
.search:active:not(:focus-within) { transform: scale(var(--press)); }
.search:focus-within { width: 100%; cursor: text; }
.filters:has(.search:focus-within) > :not(.search) {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-out) var(--ease-in), visibility 0s var(--t-out);
}
.search svg { width: 16px; height: 16px; }
.search input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  padding: 0 var(--s3) 0 0;
  border: 0;
  background: none;
  outline: none;
  opacity: 0;
  cursor: inherit;
  transition: opacity var(--t-out) var(--ease-in);
}
.search:focus-within input { opacity: 1; transition: opacity var(--t-in) var(--ease-out) calc(var(--t-size) / 3); }
.search input::placeholder { color: var(--black); opacity: 0.6; }   /* 4.9:1 on the grey */
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search:focus-within { outline: 2px solid var(--black); outline-offset: 2px; }

.langs { display: flex; flex: none; padding: 2px; border-radius: var(--pill); background: var(--grey); }
.langs a {
  display: grid;
  place-items: center;
  width: calc(var(--hit) - 4px);   /* a circle, like the «i» next to it */
  height: calc(var(--hit) - 4px);
  padding: 0;
  border-radius: var(--pill);
  color: var(--black);
  text-decoration: none;
  transition: background-color var(--t-hover) ease-out, color var(--t-hover) ease-out;
}
.langs a[aria-current="true"] { background: var(--white); color: var(--black); }

/* buttons */
.pill, .chip, .row, .round {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  border: 0;
  background: var(--grey);
  white-space: nowrap;
  transition: background-color var(--t-hover) ease-out, color var(--t-hover) ease-out, transform var(--t-hover) var(--ease-out);
}
.pill:active:not(:disabled), .chip:active:not(:disabled), .round:active { transform: scale(var(--press)); }
/* a tag that would give nothing, while its panel or the sheet is open */
.row:disabled, .chip:disabled { opacity: 0.35; cursor: default; }
.panel .row:disabled:hover { background: none; color: inherit; }
.pill { height: var(--hit); padding: 0 var(--s3); border-radius: var(--pill); }
.pill.solid, [aria-pressed="true"].chip, [aria-pressed="true"].row, .pill[aria-expanded="true"] {
  background: var(--black);
  color: var(--white);
}
.pill.quiet { background: none; padding: 0 var(--s2); text-decoration: underline; text-underline-offset: 3px; }
.pill.solid svg { width: 18px; height: 18px; margin-right: -4px; }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--pill);
  background: var(--black);
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.pill[aria-expanded="true"] .badge { background: var(--white); color: var(--black); }
/* A menu button keeps its width: the count takes the chevron's place instead of adding to it. */
.end { display: grid; place-items: center; width: 20px; height: 20px; margin-right: -4px; }
.end > * { grid-area: 1 / 1; transition: opacity var(--t-in) var(--ease-out), transform var(--t-in) var(--ease-out); }
.end svg { width: 18px; height: 18px; }
.end .badge { opacity: 0; transform: scale(0.6); }
.pill[aria-expanded="true"] .end svg { transform: rotate(180deg); }
.pill[data-n] .end svg { opacity: 0; transform: scale(0.6); }
.pill[data-n] .end .badge { opacity: 1; transform: none; }
.round { justify-content: center; width: var(--hit); height: var(--hit); border-radius: var(--pill); }

/* filter menus (from 768 px; below it the sheet) */
.menus { display: none; gap: var(--gap-pill); }
.sheet-open { flex: none; margin-left: auto; }
@media (min-width: 768px) {
  .menus { display: flex; flex-wrap: wrap; justify-content: center; }
  .sheet-open { display: none; }
}
.menu { position: relative; }
/* A panel grows out of its button: from just above and a little smaller, centred on the button. */
.panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + var(--s2));
  left: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(180px, max-content));
  gap: 2px;
  width: max-content;
  max-width: calc(100vw - 2 * var(--margin));
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: var(--pad-panel);
  border-radius: var(--r-panel);
  background: var(--black);
  color: var(--white);
  visibility: hidden;
  opacity: 0;
  transform: translateY(calc(var(--lift) * -1)) scale(var(--shrink));
  transform-origin: var(--ox, 50%) 0;
  transition: opacity var(--t-out) var(--ease-in), transform var(--t-out) var(--ease-in), visibility 0s var(--t-out);
}
.panel.open {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity var(--t-in) var(--ease-out), transform var(--t-in) var(--ease-out), visibility 0s;
}
.panel .row { background: none; }
.panel .row:hover, .panel .row[aria-pressed="true"], .panel .row[aria-pressed="true"]:hover { background: var(--white); color: var(--black); }
.panel :focus-visible { outline-color: var(--white); }
.row {
  justify-content: space-between;
  width: 100%;
  min-height: var(--hit);
  padding: 0 var(--s3);
  border-radius: var(--r-inner);
  text-align: left;
}
.row:hover { background: var(--white); }
.row[aria-pressed="true"]:hover { background: var(--black); }

/* Year: each era heads its own column of years and picks them all */
.era { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.era .head { font-weight: var(--w-strong); }
/* An era heading starts with its logo: black on the grey circle, readable on the black panel and on a picked row. */
.head .logo { flex: none; width: 24px; height: 24px; margin-left: calc(var(--s1) * -1); border-radius: var(--pill); background: var(--grey); color: var(--black); }
.head .logo svg { display: block; width: 100%; height: 100%; }
.row.head { justify-content: flex-start; }   /* the name sits next to its logo, no count on the right */
.chip.head .logo { background: var(--white); }   /* a grey chip: the circle shows in white */
.chips .era { flex-direction: row; flex-wrap: wrap; gap: var(--gap-pill); flex-basis: 100%; }
.chips .era + .era { margin-top: var(--s3); }

/* chips inside the sheet */
.chip { height: var(--hit); padding: 0 var(--s4); border-radius: var(--pill); }
.chips { display: flex; flex-wrap: wrap; gap: var(--gap-pill); }

/* active filters and count */
.meta { padding: 0 var(--margin); }
/* One line: the count, the selected tags, then Reset, which clears them. The line keeps its height
   while tags come and go; it wraps only when there are many. */
.count-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-pill); min-height: var(--hit); margin-top: var(--s2); }
.active { display: contents; }
.active .pill { transform-origin: 0 50%; }
/* The count and Reset share one pill at the start of the line, apart from the selected tags.
   Reset is a white segment inside it, like the selected language. */
.tally { display: flex; flex: none; align-items: center; gap: 2px; height: var(--hit); padding: 2px; border-radius: var(--pill); background: var(--grey); }
.count { margin: 0; padding: 0 var(--s3); white-space: nowrap; font-variant-numeric: tabular-nums; }
#count-reset {
  display: inline-flex; align-items: center; justify-content: center;
  height: 100%; padding: 0 6px 0 0; border: 0; border-radius: var(--pill);   /* only the cross, spaced like a chip's: 8 px from the number and from the edge */
  background: none; color: inherit;
  transition: transform var(--t-hover) var(--ease-out);
}
#count-reset[hidden] { display: none; }
.tally:has(#count-reset:not([hidden])) .count { padding-right: 6px; }
#count-reset svg { width: 18px; height: 18px; }
#count-reset:active { transform: scale(var(--press)); }

.layout { padding: 0 var(--margin) var(--s7); }
.sheet h3 {
  margin: 0 0 var(--s2);
  padding-top: var(--s2);
  font-weight: var(--w-strong);
}

/* grid; with filters in the link it stays hidden until filtered (template.html) */
.grid, .count-row { transition: opacity var(--t-in) var(--ease-out); }
.pending .grid, .pending .count-row { opacity: 0; }
.grid {
  display: grid;
  --cols: 1;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--s4);
  margin: 0;
  padding: var(--s4) 0 0;   /* the filter line to the first cards: the same 16 px as between cards */
  list-style: none;
}
@media (min-width: 600px) { .grid { --cols: 2; } }
@media (min-width: 1024px) { .grid { --cols: 3; } }
@media (min-width: 1920px) { .grid { --cols: 4; } }

.card a {
  display: flex;
  flex-direction: column;
  transition: transform var(--t-card) var(--ease-soft);   /* the hover grows slowly and evenly */
  height: 100%;
  padding: var(--pad-tile);
  border-radius: var(--r-tile);
  background: var(--grey);
  color: inherit;
  text-decoration: none;
}
/* The screenshot box holds its 16:9 place on the card's grey while the image loads; the image
   then fades in over it. */
.shot, .noimg {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-card);
}
.noimg { background: var(--white); }   /* a post with no picture keeps a white field for its address */
.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: opacity var(--t-image) var(--ease-out);
}
.js .card img:not(.ready) { opacity: 0; }
/* The whole card answers the pointer: it grows a little under it and sinks when pressed. */
@media (hover: hover) {
  .card a:hover { transform: scale(var(--grow)); }
}
.card a:active { transform: scale(var(--sink)); transition-duration: var(--t-hover); }
/* A post with no picture (#3): the site's address in place of the screenshot. */
.noimg {
  display: grid;
  place-items: center;
  overflow-wrap: anywhere;
  padding: var(--s3);
}
/* Card: the title and an arrow to the site on top, the screenshot, then who made it, the date and
   the period's mark. Every card has the bottom line, so cards in a row are the same height. */
.top, .bottom { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 0 var(--s3); }
.top { align-items: flex-start; padding-top: var(--s3); padding-bottom: var(--s4); }   /* 16 px from the card edge, 16 px to the screenshot */
.bottom { margin-top: auto; padding-top: var(--s4); padding-bottom: var(--s3); }
.title { font-weight: var(--w-strong); overflow-wrap: anywhere; }
.go { flex: none; width: 20px; height: 20px; margin-right: -2px; }
.date { flex: none; font-variant-numeric: tabular-nums; }
.by { min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: var(--s7) 0; text-align: center; }
.empty p { margin: 0 0 var(--s4); font-weight: var(--w-strong); }
#more { height: 1px; }

/* sheet: slides up from the bottom (app.js), the backdrop fades */
.sheet {
  width: 100%;
  max-width: 100%;
  max-height: 85vh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--white);
  color: var(--black);
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgb(0 0 0 / 0.4); transition: opacity var(--t-sheet) var(--ease-out); }
@starting-style { .sheet[open]::backdrop { opacity: 0; } }
.sheet.closing::backdrop { opacity: 0; transition-duration: var(--t-in); transition-timing-function: var(--ease-in); }
.grabber, .sheet-head { touch-action: none; }
.grabber { width: 36px; height: 5px; margin: var(--s2) auto 0; border-radius: var(--pill); background: var(--grey); }
@media (min-width: 768px) { .grabber { display: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s4) 0 var(--s5); }
.sheet h2 { margin: 0; font-size: var(--t-text); font-weight: var(--w-strong); }
.sheet-body { overflow: auto; padding: var(--s4) var(--s5); }
.sheet-body section + section { margin-top: var(--s5); }
.sheet-foot { display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom)); }
.sheet-foot .solid { flex: 1; justify-content: center; max-width: 320px; }
.sheet-foot .solid:disabled { background: var(--grey); color: var(--black); cursor: default; }
@media (min-width: 768px) {
  .sheet { max-width: 640px; margin: auto; border-radius: var(--r-sheet); }
}

/* a group whose every tag would give nothing */
.panel:not(.about):not(:has(.row:not([hidden])))::after,
.chips:not(:has(.chip:not([hidden])))::after {
  content: attr(data-empty);
  grid-column: 1 / -1;
  padding: var(--s3);
}
.chips:not(:has(.chip:not([hidden])))::after { padding: 0; }
