/*
  KosmoStars: a pink and blue zine printed on a starfield.
  Unbounded speaks (titles, navigation, buttons), Onest reads (everything else),
  Titan One is only the logo.
*/

/* Fonts are served from here (latin, latin-ext, cyrillic; SIL Open Font License): no third-party round trips before the first paint. */
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/onest-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/onest-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/onest-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: 'Titan One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/titan-one-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Titan One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/titan-one-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: 'Unbounded';
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
  src: url(../fonts/unbounded-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
  src: url(../fonts/unbounded-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
  src: url(../fonts/unbounded-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;
}

:root {
  --cobalt: #1d4ed8;
  --night: #0f1f5c;
  --ink: #1731d8;
  --pink: #ff1a8c;
  --pink-deep: #d6006f;
  --mist: #dbe5ff;
  --paper: #ffffff;
  --paper-blue: #f1f5ff;
  --muted: #4a5994;
  --display: 'Unbounded', 'Arial Black', sans-serif;
  --text: 'Onest', 'Segoe UI', system-ui, sans-serif;
  --side-w: 320px;
  --lift: 8px;
}

@property --off {
  syntax: '<length>';
  inherits: true;
  initial-value: 0px;
}

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

html[lang="ru"] [data-lang="en"],
html[lang="en"] [data-lang="ru"] { display: none !important; }

html {
  background: var(--cobalt) url(../img/stars-tile.svg) repeat;
  background-size: 192px 192px;
  image-rendering: pixelated;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--text);
  font-size: 18px;
  line-height: 1.6;
  color: var(--night);
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

h1, h2, h3 { text-wrap: balance; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--night);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--paper);
  border-right: 3px solid var(--pink);
  box-shadow: 6px 0 0 var(--paper), 9px 0 0 var(--pink);
  padding: 28px 28px 22px;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.side-head { display: flex; align-items: flex-start; justify-content: space-between; }

.logo {
  --logo: 56px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: calc(var(--logo) * 4.68);
  height: calc(var(--logo) * 3.3);
  color: var(--pink);
  font-family: 'Titan One', 'Arial Black', sans-serif;
  font-size: var(--logo);
  line-height: 1;
  text-decoration: none;
  filter: url(#rough);
}
.logo-row { display: block; margin-left: .1em; white-space: nowrap; }
.logo-row-2 { margin-left: .55em; margin-top: -.1em; }
.logo-row span { display: inline-block; transform: rotate(var(--r)) translateY(var(--y)); }
.logo-star { position: absolute; right: .12em; top: .3em; width: .94em; height: .94em; }
.logo:hover { color: var(--pink-deep); }

.menu-toggle { display: none; }

.side-menu { display: flex; flex-direction: column; flex: 1; }

.pink-rule {
  width: 100%;
  height: 3px;
  margin: 20px 0;
  border: 0;
  background: var(--pink);
}

.side-nav ul,
.side-projects { list-style: none; margin: 0; padding: 0; }

.side-nav a {
  position: relative;
  display: inline-block;
  padding: 3px 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.5;
  color: var(--night);
  text-decoration: none;
  transition: color .15s, transform .15s;
}
.side-nav a:hover { color: var(--cobalt); transform: translateX(4px); }
.side-nav a.is-active {
  padding-left: 30px;
  font-weight: 800;
  color: var(--cobalt);
}
.side-nav a.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 21px;
  height: 21px;
  margin-top: -10.5px;
  background: url(../img/asterisk.svg) center / contain no-repeat;
}
.side-nav a.is-active:hover { transform: none; }

.side-projects li + li { margin-top: 2px; }
.side-projects a {
  display: inline-block;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.6;
  color: var(--night);
  text-decoration: none;
}
.side-projects a:hover { color: var(--pink-deep); }

.side-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: auto;
  padding-top: 28px;
}

.side-social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.social-btn {
  --social-cut: var(--paper, #fff);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border: 2px solid var(--night);
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  color: var(--night);
  text-decoration: none;
  transition: background-color .15s, color .15s;
}
.social-btn svg { width: 18px; height: 18px; flex: none; }
.social-btn:hover,
.social-btn:focus-visible { background: var(--night); color: var(--pink, #ff1a8c); --social-cut: var(--night); }

/* EN | RU: the current language is filled in, the other one is a button. */
.lang-switch {
  display: inline-flex;
  border: 2px solid var(--night);
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}
.lang-current,
.lang-other { padding: 7px 10px 6px; }
.lang-current { background: var(--night); color: var(--paper); }
.lang-other {
  border: 0;
  background: none;
  font: inherit;
  color: var(--night);
  cursor: pointer;
}
.lang-other:hover { background: var(--pink); color: var(--paper); }

.copyright { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- content column ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 64px 56px 88px;
}

.column {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

/* ---------- hero: wide letters with a misprinted pink shadow ---------- */

.hero { color: var(--paper); }

.hero-title {
  --off: .055em;
  margin: 0;
  max-width: 13em;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(40px, 6.4vw, 92px);
  line-height: 1.02;
  letter-spacing: -.015em;
  text-shadow: var(--off) var(--off) 0 var(--pink);
  animation: misprint .7s cubic-bezier(.2, .8, .2, 1) .1s both;
}
.hero-title-sm { font-size: clamp(40px, 5.6vw, 80px); }
/* The site's asterisk takes the place of the full stop. */
.hero-star {
  display: inline-block;
  width: .62em;
  height: .62em;
  margin-left: .05em;
  vertical-align: .1em;
  filter: drop-shadow(var(--off) var(--off) 0 var(--night));
}

@keyframes misprint { from { --off: 0em; } }

.hero-lead {
  max-width: 34em;
  margin: 28px 0 0;
  font-size: 21px;
  line-height: 1.5;
  color: var(--mist);
  /* A cobalt halo keeps the background stars from cutting through the letters. */
  text-shadow: 0 0 3px var(--cobalt), 0 0 8px var(--cobalt);
}
.hero-lead a { color: var(--paper); font-weight: 700; text-decoration-color: var(--pink); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.hero-lead a:hover { color: var(--pink); }

/* ---------- panels: paper stuck onto the starfield ---------- */

.panel {
  background: var(--paper);
  border: 3px solid var(--night);
  box-shadow: var(--lift) var(--lift) 0 var(--night);
  padding: 40px 44px 44px;
}

/* Section titles sit on a pink plate. */
.plate {
  display: inline-block;
  margin: 0;
  padding: 7px 16px 9px;
  background: var(--pink);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -.01em;
}

.shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.more-link {
  display: inline-block;
  padding: 9px 16px 10px;
  background: var(--night);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 0 0 var(--pink);
  transition: transform .15s, box-shadow .15s;
}
.more-link:hover { transform: translate(-3px, -3px); box-shadow: 3px 3px 0 var(--pink); }

.link-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- covers (Steam-library style) ---------- */

.covers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 34px 28px;
}

.cover {
  --rx: 0deg;
  --ry: 0deg;
  --gx: 50%;
  --gy: 0%;
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 5px solid var(--paper);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--night), 0 14px 26px rgba(4, 12, 70, .45);
  color: var(--night);
  text-decoration: none;
  transform: perspective(800px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.cover-art, .cover-art img { display: block; width: 100%; height: 100%; }
.cover-art img { object-fit: cover; }

/* A project that isn't out yet, e.g. "In development". */
.cover-status {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px 3px;
  background: var(--pink-deep);
  color: var(--paper);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 2px 2px 0 var(--night);
}

.cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 55%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.cover-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 100%;
  overflow: hidden;
  padding: 12px 12px 13px;
  background: var(--paper);
  border-top: 3px solid var(--night);
  transform: translateY(calc(100% + 6px));
  transition: transform .22s ease-out;
}
.cover-title { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.2; color: var(--night); }
.cover-desc { font-size: 14px; line-height: 1.4; color: #2b3a7a; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  padding: 1px 7px 2px;
  background: var(--cobalt);
  color: var(--paper);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.5;
}

.cover:hover,
.cover:focus-visible,
.cover.is-open {
  transform: perspective(800px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-6px);
  box-shadow: 0 0 0 3px var(--pink), 0 22px 32px rgba(4, 12, 70, .55);
}
.cover:hover::after { opacity: 1; }
.cover:hover .cover-info,
.cover:focus-visible .cover-info,
.cover.is-open .cover-info { transform: none; }

.covers-empty {
  grid-column: 1 / -1;
  padding: 18px 20px;
  background: var(--paper);
  border: 3px solid var(--night);
  font-weight: 700;
}

/* ---------- sites: a browser window around each screenshot ---------- */

.sites {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 48px;
}

.site-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}

.site-frame {
  border: 3px solid var(--night);
  background: var(--paper);
  box-shadow: var(--lift) var(--lift) 0 var(--night);
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.site-card:hover .site-frame,
.site-card:focus-within .site-frame {
  transform: translate(-3px, -3px);
  box-shadow: calc(var(--lift) + 3px) calc(var(--lift) + 3px) 0 var(--pink);
}

.site-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border-bottom: 3px solid var(--night);
  background: var(--paper-blue);
}
.site-dots { display: flex; gap: 6px; flex-shrink: 0; }
.site-dots span { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--night); }
.site-dots span:nth-child(1) { background: var(--pink); }
.site-dots span:nth-child(2) { background: #ffd23f; }
.site-dots span:nth-child(3) { background: var(--cobalt); }
.site-address {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 3px 12px;
  border: 2px solid var(--night);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.site-shot { display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.site-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }

.site-info { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.site-title { margin: 0; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.1; color: var(--night); }
.site-desc { margin: 0; font-size: 16px; line-height: 1.55; color: #2b3a7a; }

@media (max-width: 900px) {
  .site-card { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}

/* ---------- feed ---------- */

.feed-list { list-style: none; margin: 26px 0 0; padding: 0; }
.feed-list li {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 2px solid var(--paper-blue);
}
.feed-list li:first-child { border-top: 0; }
.feed-list time { font-size: 15px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.feed-list a,
.feed-list span { font-weight: 600; }
.feed-list a {
  color: var(--night);
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.feed-list a:hover { color: var(--pink-deep); }

/* ---------- page transitions ---------- */

/* Cross-document view transitions: the sidebar and the page title stay put,
   and a project cover grows into that project's page. */
@view-transition { navigation: auto; }

.sidebar { view-transition-name: sidebar; }
.hero { view-transition-name: masthead; }

::view-transition-group(*) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .25s; }

/* ---------- project filters ---------- */

.filters {
  display: grid;
  gap: 16px;
  padding: 24px 26px;
  background: var(--paper);
  border: 3px solid var(--night);
  box-shadow: var(--lift) var(--lift) 0 var(--night);
}
.filter-search { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.filter-label { font-family: var(--display); font-weight: 700; font-size: 18px; }
.filter-search input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 14px;
  border: 3px solid var(--night);
  border-radius: 0;
  background: var(--paper);
  color: var(--night);
  font: 500 18px/1.2 var(--text);
}
.filter-search input::placeholder { color: #7c87b8; }
.filter-search input:focus-visible { outline-offset: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px;
  padding: 5px 15px;
  border: 2px solid var(--night);
  background: var(--paper);
  color: var(--night);
  font: 600 16px/1.2 var(--text);
  cursor: pointer;
}
.chip:hover { border-color: var(--pink-deep); color: var(--pink-deep); }
.chip[aria-pressed="true"] { background: var(--pink-deep); border-color: var(--pink-deep); color: var(--paper); }
.filter-status { margin: 0; font-size: 15px; color: var(--muted); }

.linklike {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--pink-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linklike:hover { color: var(--cobalt); }

/* ---------- visitor counter ---------- */

.visitor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 26px 0 0;
  font-weight: 600;
  font-size: 17px;
  color: var(--mist);
  text-shadow: 0 0 3px var(--cobalt), 0 0 8px var(--cobalt);
}
.visitor[hidden] { display: none; }
.odometer { display: inline-flex; gap: 3px; }
.odometer span {
  display: inline-block;
  min-width: 1.2em;
  padding: 4px 0 3px;
  background: var(--night);
  color: #ffe14d;
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -.55em rgba(255, 255, 255, .08);
}

/* ---------- guestbook ---------- */

.gb-form { display: grid; gap: 18px; margin-top: 26px; }
.field { display: grid; gap: 6px; }
.field-label { font-weight: 700; }
.field-hint { font-size: 14px; color: var(--muted); }
.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 3px solid var(--night);
  border-radius: 0;
  background: var(--paper);
  color: var(--night);
  font: 400 18px/1.5 var(--text);
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus-visible,
.field textarea:focus-visible { outline-offset: 0; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn-submit {
  justify-self: start;
  min-height: 52px;
  padding: 10px 24px 11px;
  border: 0;
  background: var(--pink-deep);
  color: var(--paper);
  font: 700 17px/1.2 var(--display);
  box-shadow: 4px 4px 0 var(--night);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.btn-submit:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--night); }
.btn-submit:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--night); }
.btn-submit:disabled { background: #9aa3c7; box-shadow: none; transform: none; cursor: progress; }

.form-message { margin: 0; font-weight: 700; }
.form-message[data-kind="error"] { color: #c40054; }
.form-message[data-kind="ok"] { color: #0a7a3d; }

.gb-list { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 18px; }
.gb-entry {
  padding: 16px 20px 18px;
  background: var(--paper-blue);
  border-left: 6px solid var(--pink);
}
.gb-entry header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; }
.gb-name { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink); overflow-wrap: anywhere; }
.gb-entry time { font-size: 14px; color: var(--muted); }
.gb-text { margin: 8px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.gb-more { margin-top: 22px; border: 0; cursor: pointer; }
.gb-more:disabled { opacity: .6; cursor: progress; }
.gb-more[hidden] { display: none; }
.gb-empty { margin: 26px 0 0; }

/* ---------- home: the best work pinned to the starfield ---------- */

.home-hero { container-type: inline-size; color: var(--paper); }
.home-stage { position: relative; }
.home-intro { position: relative; z-index: 6; }
.home-hero .hero-title { font-size: clamp(34px, 10.4cqi, 64px); }

.collage {
  --mx: 0;
  --my: 0;
  --sy: 0;
  position: relative;
  aspect-ratio: 100 / 136;
  margin-top: 34px;
}

@container (min-width: 700px) {
  .home-stage { aspect-ratio: 5 / 4; }
  .home-intro { width: 60%; }
  .home-hero .hero-title { font-size: min(6.7cqi, 78px); }
  /* Russian words are longer: one size down keeps the lead clear of the collage. */
  html[lang="ru"] .home-hero .hero-title { font-size: min(5.9cqi, 70px); }
  .home-hero .hero-lead { font-size: clamp(17px, 2.1cqi, 21px); }
  .collage { position: absolute; inset: 0; margin: 0; aspect-ratio: auto; pointer-events: none; }
  .piece { pointer-events: auto; }
}

.piece {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  z-index: var(--z, calc(var(--i) + 1));
  display: block;
  color: var(--night);
  text-decoration: none;
  /* Parallax: the pointer pushes near pieces further, and they rise at their own pace on scroll. */
  translate: calc(var(--mx) * var(--d) * 16px) calc(var(--my) * var(--d) * 12px - var(--sy) * var(--d) * .22px);
}
.piece[hidden] { display: none; }
.collage.is-waiting .piece { visibility: hidden; }
.piece:focus-visible { outline: 0; }

.piece-body {
  position: relative;
  display: block;
  background: var(--paper);
  rotate: var(--r);
  transition: rotate .4s cubic-bezier(.3, 1.5, .5, 1), scale .4s cubic-bezier(.3, 1.5, .5, 1), box-shadow .25s, filter .3s;
}
.piece-cover .piece-body {
  border: 5px solid var(--paper);
  box-shadow: 0 0 0 3px var(--night), 0 14px 26px rgba(4, 12, 70, .45);
}
.piece-site .piece-body {
  border: 3px solid var(--night);
  box-shadow: 6px 6px 0 var(--night);
}

/* A strip of pink tape holds every piece. */
.piece-body::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -13px;
  z-index: 2;
  width: 46%;
  min-width: 52px;
  height: 22px;
  background: rgba(255, 196, 226, .82);
  box-shadow: 0 1px 2px rgba(15, 31, 92, .2);
  translate: -50% 0;
  rotate: -4deg;
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 0, 88% 0, 92% 10%, 96% 0, 100% 8%, 100% 92%, 96% 100%, 92% 90%, 88% 100%, 12% 100%, 8% 90%, 4% 100%, 0 92%);
}
.piece:nth-child(even) .piece-body::before { left: 38%; rotate: 6deg; }
.piece:nth-child(3n) .piece-body::before { left: 64%; rotate: -9deg; }

.piece-bar {
  display: flex;
  gap: 4px;
  padding: 5px 7px;
  border-bottom: 3px solid var(--night);
  background: var(--paper-blue);
}
.piece-bar span { width: 8px; height: 8px; border: 2px solid var(--night); border-radius: 50%; }
.piece-bar span:nth-child(1) { background: var(--pink); }
.piece-bar span:nth-child(2) { background: #ffd23f; }
.piece-bar span:nth-child(3) { background: var(--cobalt); }

.piece-img { display: block; overflow: hidden; }
.piece-img img { display: block; width: 100%; height: auto; object-fit: cover; object-position: top; }
.piece-cover .piece-img img { aspect-ratio: 2 / 3; }
.piece-site .piece-img img { aspect-ratio: 16 / 10; }

.piece-label {
  position: absolute;
  left: 50%;
  bottom: -18px;
  z-index: 3;
  padding: 5px 11px 6px;
  background: var(--pink-deep);
  color: var(--paper);
  font: 700 14px/1.1 var(--display);
  white-space: nowrap;
  box-shadow: 3px 3px 0 var(--night);
  translate: -50% 0;
  rotate: -3deg;
  scale: 0;
  transition: scale .3s cubic-bezier(.3, 1.6, .5, 1);
}
.piece-arrow { display: inline-block; transition: translate .2s; }

.piece:hover,
.piece:focus-visible { z-index: 30; }
.piece:hover .piece-body,
.piece:focus-visible .piece-body { rotate: 0deg; scale: 1.07; }
.piece-cover:hover .piece-body,
.piece-cover:focus-visible .piece-body { box-shadow: 0 0 0 3px var(--pink), 0 24px 40px rgba(4, 12, 70, .55); }
.piece-site:hover .piece-body,
.piece-site:focus-visible .piece-body { box-shadow: 10px 10px 0 var(--pink); }
.piece:hover .piece-label,
.piece:focus-visible .piece-label { scale: 1; }
.piece:hover .piece-arrow { translate: 3px 0; }
/* The rest of the board dims a little while one piece is lifted. */
.collage:has(.piece:hover) .piece:not(:hover) .piece-body { filter: saturate(.55) brightness(.82); }

/* Touch screens have no hover, and stickers left on would cover each other: a tap just opens the work. */
@media (hover: none) {
  .piece-label { display: none; }
}

/* Pieces get slapped onto the board one by one, then breathe. */
.collage.is-live .piece-body {
  animation:
    slap .75s cubic-bezier(.2, .9, .3, 1.15) calc(var(--i) * 90ms + 250ms) both,
    bob calc(5.5s + var(--i) * .6s) ease-in-out calc(var(--i) * -1.3s) infinite alternate;
}
@keyframes slap {
  0% { opacity: 0; transform: translateY(-48px) scale(1.25) rotate(9deg); }
  55% { opacity: 1; transform: translateY(4px) scale(.97) rotate(-1deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes bob {
  from { translate: 0 -3px; }
  to { translate: 0 4px; }
}

/* ---------- home: selected work with big numbers ---------- */

.stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px 28px;
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 210px;
  padding: 26px 28px 24px;
  overflow: hidden;
  container-type: inline-size;
  background: var(--paper);
  border: 3px solid var(--night);
  box-shadow: var(--lift) var(--lift) 0 var(--night);
  color: var(--night);
  text-decoration: none;
  transition: translate .2s ease-out, box-shadow .2s ease-out;
}
.stat-card:hover,
.stat-card:focus-visible {
  translate: -3px -3px;
  box-shadow: calc(var(--lift) + 3px) calc(var(--lift) + 3px) 0 var(--pink);
}

.stat-num {
  position: relative;
  z-index: 2;
  display: block;
  font-family: var(--display);
  font-weight: 900;
  /* Long numbers shrink to fit the card; --len is the number of characters. */
  font-size: min(60px, calc(128cqi / var(--len, 8)));
  line-height: 1.05;
  letter-spacing: -.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: .05em .05em 0 var(--pink);
}
/* The final number keeps the width and is what screen readers get; the counting copy sits on top. */
.stat-ghost { color: transparent; text-shadow: none; }
.stat-live { position: absolute; left: 0; top: 0; }

.stat-label,
.stat-foot { position: relative; z-index: 1; padding-right: 32%; }
.stat-label { font-size: 16px; line-height: 1.45; color: #2b3a7a; }
.stat-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.2;
}
.stat-arrow { color: var(--pink-deep); transition: translate .2s; }
.stat-card:hover .stat-arrow { translate: 6px 0; }

.stat-thumb {
  position: absolute;
  z-index: 0;
  right: -12px;
  bottom: -48px;
  width: 25%;
  height: auto;
  border: 3px solid var(--night);
  box-shadow: 4px 4px 0 var(--night);
  rotate: 9deg;
  transition: translate .3s cubic-bezier(.3, 1.5, .5, 1), rotate .3s cubic-bezier(.3, 1.5, .5, 1);
}
.stat-thumb-site { width: 37%; bottom: -18px; right: -22px; }
.stat-card:hover .stat-thumb { translate: -8px -16px; rotate: 3deg; }

@media (max-width: 760px) {
  .stats { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .stat-card { min-height: 190px; padding: 22px 20px 20px; }
}

/* ---------- living details ---------- */

/* Things below the fold fade up as they scroll in (motion.js marks them). */
html.motion .rv { opacity: 0; transform: translateY(28px); }
html.motion .rv.rv-in {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease-out, transform .7s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--rv-i, 0) * 80ms);
}

/* Section plates land like a rubber stamp. */
html.motion .plate.stamp { opacity: 0; }
html.motion .plate.stamp.is-stamped { animation: stamp .55s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.7) rotate(-9deg); }
  60% { opacity: 1; transform: scale(.94) rotate(1.5deg); }
  100% { opacity: 1; transform: none; }
}

/* The sky: twinkling pixel stars and a shooting star now and then, behind everything. */
.layout { position: relative; z-index: 1; }
.sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.twinkle {
  position: absolute;
  width: var(--size);
  height: var(--size);
  background:
    linear-gradient(#fff, #fff) center / 2px 100% no-repeat,
    linear-gradient(#fff, #fff) center / 100% 2px no-repeat;
  opacity: 0;
  animation: twinkle 4s ease-in-out infinite;
}
.twinkle:nth-child(3n) { filter: drop-shadow(0 0 3px var(--pink)); }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.3); }
  50% { opacity: .95; transform: scale(1); }
}
.shooter {
  position: absolute;
  width: var(--len, 140px);
  height: 2px;
  background: linear-gradient(90deg, #fff, rgba(255, 196, 226, .7) 30%, rgba(255, 255, 255, 0));
  border-radius: 2px;
  opacity: 0;
}
.shooter.is-on { animation: shoot 1.2s cubic-bezier(.4, 0, .7, 1) both; }
@keyframes shoot {
  0% { opacity: 0; transform: rotate(-28deg) translateX(0); }
  12% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: rotate(-28deg) translateX(-380px); }
}

/* Sparks from a click on the empty starfield. */
.spark {
  position: fixed;
  z-index: 80;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: url(../img/asterisk.svg) center / contain no-repeat;
  pointer-events: none;
  animation: spark .7s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes spark {
  from { opacity: 1; transform: translate(0, 0) scale(.4) rotate(0); }
  to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--spin)); }
}

/* The logo letters straighten up and the star turns when you point at it. */
.logo-row span { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.logo-row span:nth-child(2) { transition-delay: .03s; }
.logo-row span:nth-child(3) { transition-delay: .06s; }
.logo-row span:nth-child(4) { transition-delay: .09s; }
.logo-row span:nth-child(5) { transition-delay: .12s; }
.logo:hover .logo-row span { transform: rotate(calc(var(--r) * -1)) translateY(calc(var(--y) * -1)); }
.logo-star { transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.logo:hover .logo-star { transform: rotate(120deg) scale(1.12); }

/* Navigation: an asterisk pops in next to the link you point at; the active one slowly turns. */
.side-nav a:not(.is-active)::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background: url(../img/asterisk.svg) center / contain no-repeat;
  transform: scale(0) rotate(-120deg);
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.side-nav a:not(.is-active):hover::before { transform: scale(1) rotate(0); }
.side-nav a.is-active::before { animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.side-projects a {
  background: linear-gradient(var(--pink), var(--pink)) left bottom / 0 2px no-repeat;
  transition: background-size .25s ease-out, color .15s;
}
.side-projects a:hover { background-size: 100% 2px; }

/* The title's asterisk sways; point at the title and it spins. */
.hero-star { animation: sway 7s ease-in-out infinite; transition: transform .7s cubic-bezier(.3, 1.4, .5, 1); }
.hero-title:hover .hero-star { transform: rotate(240deg); }
@keyframes sway {
  0%, 100% { rotate: -10deg; }
  50% { rotate: 12deg; }
}

.more-link::after { content: '→'; display: inline-block; margin-left: .45em; transition: transform .2s; }
.more-link:hover::after { transform: translateX(4px); }
.more-link:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--pink); }

/* Visitor counter digits flip in one by one. */
.odometer span { animation: odo .6s cubic-bezier(.2, .8, .3, 1.3) both; }
.odometer span:nth-child(2) { animation-delay: .07s; }
.odometer span:nth-child(3) { animation-delay: .14s; }
.odometer span:nth-child(4) { animation-delay: .21s; }
.odometer span:nth-child(5) { animation-delay: .28s; }
.odometer span:nth-child(6) { animation-delay: .35s; }
.odometer span:nth-child(7) { animation-delay: .42s; }
@keyframes odo {
  from { opacity: 0; transform: perspective(200px) rotateX(-90deg); }
}

/* Feed: fresh entries blink like it's 1999. */
.fresh {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 7px 2px;
  background: var(--pink);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 800;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: 2px;
  rotate: -4deg;
  animation: blink 1.4s steps(1) infinite;
}
@keyframes blink { 50% { background: var(--night); } }
.feed-list time { transition: color .2s; }
.feed-list li:hover time { color: var(--pink-deep); }

/* Page changes: the old page lifts away, the new one settles in; the sidebar stays put. */
::view-transition-old(root) { animation: vt-out .2s ease-in both; }
::view-transition-new(root) { animation: vt-in .38s cubic-bezier(.2, .8, .2, 1) .04s both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .main { padding: 48px 32px 72px; }
  .covers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --lift: 6px; }

  .layout { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    height: auto;
    /* The bar is drawn by site.js; keep its height from the first paint so nothing jumps:
       padding + the 22px logo (3.3 lines tall) + the border. */
    min-height: calc(22px * 3.3 + 23px);
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 3px solid var(--pink);
    box-shadow: 0 5px 0 var(--paper), 0 8px 0 var(--pink);
    overflow: visible;
  }
  .side-head { align-items: center; }
  .logo { --logo: 22px; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 3px solid var(--night);
    background: var(--paper);
    color: var(--night);
    font: 700 30px/1 system-ui, sans-serif;
    cursor: pointer;
  }
  .side-menu { display: none; padding-bottom: 12px; }
  .sidebar.is-open .side-menu { display: flex; }
  .side-foot { padding-top: 20px; }

  .main { padding: 40px 20px 56px; }
  .column { gap: 44px; }
  .panel { padding: 28px 22px 32px; }
  .hero-lead { font-size: 19px; }
  .covers { gap: 22px 18px; }
  .plate { font-size: 22px; }
  .feed-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media (max-width: 600px) {
  .main { padding: 32px 16px 48px; }
  .panel { padding: 24px 16px 28px; }
  .hero-title { letter-spacing: -.02em; }
  .covers { gap: 18px 14px; }
  .cover { border-width: 4px; }
  .cover-info { gap: 5px; padding: 8px 8px 9px; }
  .cover-title { font-size: 13px; }
  .cover-desc { font-size: 12px; line-height: 1.3; }
  .cover-status { top: 6px; left: 6px; padding: 0 5px 1px; font-size: 11px; }
  .tag { padding: 0 5px 1px; font-size: 11px; }
  .more-link { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .cover:hover, .cover:focus-visible, .cover.is-open { transform: none; }
}
