/* ==========================================================================
   Voboda — one stylesheet for the homepage and posts.

   One dark theme for every page: the drawings are blue ink on a night table
   and do not survive a light background.
   ========================================================================== */

@font-face {
  font-family: "Recursive";
  src: url("/fonts/recursive-casl-latin.woff2") format("woff2");
  font-weight: 300 1000;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --width: 640px;
  /* The homepage's column. The header uses it on every page, so it stays
     in the same place going from the homepage to a post. */
  --wide: 1360px;
  --font-main: "Recursive", system-ui, sans-serif;
  --font-secondary: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --font-mono: Menlo, Inconsolata, monospace;
  --font-scale: 1.125rem;

  --background-color: #180524;
  --background-image: radial-gradient(circle 1939px at 144.7% 100%, #031a27 10%, #180524);
  --heading-color: #f2eef6;
  --text-color: #d6d0de;
  --link-color: #7ab2e8;
  --visited-color: #7ab2e8;
  --code-background-color: #000;
  --code-color: #ddd;
  --blockquote-color: #ccc;

  --ink: #7ab2e8;
  --ink-bright: #b8d6f4;
  --muted: #a99fb8;
  --quiet: #7d7290;
  --gold: #f4df57;
  --dash: 1px dashed rgba(255, 255, 255, 0.14);
  --card-bg: rgba(255, 255, 255, 0.055);
  --card-bg-hover: rgba(255, 255, 255, 0.09);
  --card-shadow: 0 14px 40px rgba(0, 0, 0, 0.32), 0 1px 0 rgba(255, 255, 255, 0.06) inset;

  --badge-gold: #f4df57;
  --badge-silver: #e4ebe2;
  --badge-bronze: #d99a5b;

  --rule-color: rgba(231, 231, 231, 0.55);
  --selection-bg: #114283;
  --selection-text: #fff;

  --image-filter: hue-rotate(140deg) saturate(30%);

  /* Desktop header height. */
  --masthead-h: 92px;

  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* The body spans the window so the pinned header can be a full-width bar
   without negative margins. The page column is set on main and the footer. */
body {
  font-family: var(--font-secondary);
  font-size: var(--font-scale);
  text-align: left;
  background-color: var(--background-color);
  background-image: var(--background-image);
  background-attachment: fixed;
  background-size: cover;
  background-repeat: no-repeat;
  min-height: 100vh;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: var(--text-color);
  margin: 0;
  padding: 72px 0;
  line-height: 1.66;
  letter-spacing: 0.01em;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

main {
  line-height: 1.6;
}

body > main,
.site-footer {
  max-width: var(--width);
  margin-inline: auto;
  padding-inline: 24px;
}

main > p:first-of-type {
  margin-top: 0.3em;
}

p {
  margin-block: 1.2em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-main);
  font-variation-settings: "CASL" 1;
  font-weight: 300;
  color: var(--heading-color);
}

h2 {
  font-size: 130%;
}

a {
  color: var(--link-color);
  cursor: pointer;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:visited {
  color: var(--visited-color);
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

strong,
b {
  color: var(--heading-color);
}

button {
  margin: 0;
  cursor: pointer;
}

time {
  font-family: var(--font-main);
  font-variation-settings: "CASL" 1;
  font-style: normal;
  font-size: 0.85em;
}

table {
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px dashed var(--rule-color);
}

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--font-mono);
  padding: 2px;
  background-color: var(--code-background-color);
  color: var(--code-color);
  border-radius: 3px;
}

blockquote {
  border-left: 1px solid #999;
  color: var(--blockquote-color);
  padding-left: 20px;
  margin-left: 0;
  font-style: italic;
}

footer {
  padding: 25px 0;
  text-align: center;
}

.inline {
  width: auto !important;
}

.highlight,
.code {
  padding: 1px 15px;
  background-color: var(--code-background-color);
  color: var(--code-color);
  border-radius: 3px;
  margin-block-start: 1em;
  margin-block-end: 1em;
  overflow-x: auto;
}

img[src*="shields.io/"] {
  filter: saturate(0.3) contrast(0.7);
  vertical-align: middle;
}

/* Hides a heading from sight but not from screen readers or search engines.
   The homepage used `h1 { display: none }`, which hid it from both. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ==========================================================================
   Masthead

   The same header on every page: name, tagline and contact icons, and the
   signup link on the right. On desktop it stays pinned while the page
   scrolls under it.
   ========================================================================== */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 0 0 48px;
  /* Lines up with the homepage column; 24px on small screens. */
  padding-inline: max(24px, calc((100% - var(--wide)) / 2 + 24px));
}

/* The footer's signup link, shorter and smaller, at the top right. */
.masthead .signup {
  font-size: 15px;
  font-weight: 400;
  text-underline-offset: 6px;
}

.who {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "name contacts"
    "tagline tagline";
  justify-content: start;
  align-items: center;
  column-gap: 18px;
}

.masthead h1,
.masthead .name {
  grid-area: name;
  margin: 0;
  font-family: var(--font-main);
  font-variation-settings: "CASL" 1;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  color: var(--heading-color);
}

.masthead .name:hover {
  text-decoration: none;
  color: var(--ink-bright);
}

.tagline {
  grid-area: tagline;
  margin: 0px;
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.contacts {
  grid-area: contacts;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contacts a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  border-radius: 16px 8px 14px 10px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.contacts a:hover,
.contacts a:focus-visible {
  color: var(--ink-bright);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px) rotate(-3deg);
}

.icon path,
.icon circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contacts .icon path {
  stroke-width: 1.8;
}

/* Phones: the name gets the whole line, icons go underneath. */
@media (max-width: 600px) {
  .who {
    grid-template-columns: auto;
    grid-template-areas:
      "name"
      "tagline"
      "contacts";
  }

  .contacts {
    margin: 10px 0 0 -10px;
  }
}

@media (min-width: 901px) {
  .masthead {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--masthead-h);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

/* ==========================================================================
   Footer

   Signup link over the contact icons, both centred. Used on the homepage and
   on posts. The header has the same link with shorter text.
   ========================================================================== */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 120px;
  padding: 0;
  text-align: center;
}

.signup {
  font-family: var(--font-main);
  font-variation-settings: "CASL" 1;
  font-size: 26px;
  font-weight: 300;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: underline wavy 2px;
  text-underline-offset: 8px;
}

.signup:hover {
  color: var(--ink-bright);
  text-decoration: underline wavy 2px;
}

.site-footer .contacts {
  justify-content: center;
  margin: 0;
}

.post .site-footer {
  margin-top: 80px;
}

/* ==========================================================================
   Posts
   ========================================================================== */

.post main > h1 {
  margin: 0.6em 0 0.2em;
  font-size: 2.2em;
  line-height: 1.15;
}

.post .meta {
  margin-top: 0;
  color: var(--muted);
}

.back {
  display: inline-block;
  padding: 10px 0;
  font-family: var(--font-main);
  font-variation-settings: "CASL" 1;
  color: var(--ink);
  transition: transform 0.2s ease;
}

.back:hover {
  text-decoration: none;
  color: var(--ink-bright);
  transform: translateX(-4px);
}

main > .back:last-child {
  margin-top: 2em;
}

/* Quotes and code blocks in posts are cards, like the homepage's: the same
   surface, shadow and hand-cut corners. They tilt much less, since they are
   read rather than glanced at, and they do not lift on hover. */
.post main blockquote,
.post main pre {
  margin: 2em 0;
  padding: 22px 28px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  border: 0;
}

.post main blockquote {
  font-style: normal;
  color: var(--text-color);
}

.post main blockquote > :first-child { margin-top: 0; }
.post main blockquote > :last-child { margin-bottom: 0; }

.post main pre {
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.55;
}

.post main pre code {
  padding: 0;
  background: none;
  color: var(--code-color);
}

/* Counted together (`of blockquote, pre`), so a quote and the code block
   after it are different cards. Each corner and the tilt cycle at a different
   length, as on the homepage, so the shapes rarely repeat. */
.post main :nth-child(3n + 1 of blockquote, pre) { border-top-left-radius: 255px 15px; }
.post main :nth-child(3n + 2 of blockquote, pre) { border-top-left-radius: 155px 15px; }
.post main :nth-child(3n of blockquote, pre) { border-top-left-radius: 205px 15px; }

.post main :nth-child(4n + 1 of blockquote, pre) { border-top-right-radius: 15px 225px; }
.post main :nth-child(4n + 2 of blockquote, pre) { border-top-right-radius: 45px 225px; }
.post main :nth-child(4n + 3 of blockquote, pre) { border-top-right-radius: 45px 25px; }
.post main :nth-child(4n of blockquote, pre) { border-top-right-radius: 30px 190px; }

.post main :nth-child(5n + 1 of blockquote, pre) { border-bottom-right-radius: 225px 15px; }
.post main :nth-child(5n + 2 of blockquote, pre) { border-bottom-right-radius: 125px 15px; }
.post main :nth-child(5n + 3 of blockquote, pre) { border-bottom-right-radius: 25px 15px; }
.post main :nth-child(5n + 4 of blockquote, pre) { border-bottom-right-radius: 190px 40px; }
.post main :nth-child(5n of blockquote, pre) { border-bottom-right-radius: 160px 20px; }

.post main :nth-child(7n + 1 of blockquote, pre) { border-bottom-left-radius: 15px 255px; }
.post main :nth-child(7n + 2 of blockquote, pre) { border-bottom-left-radius: 25px 255px; }
.post main :nth-child(7n + 3 of blockquote, pre) { border-bottom-left-radius: 20px 180px; }
.post main :nth-child(7n + 4 of blockquote, pre) { border-bottom-left-radius: 30px 200px; }
.post main :nth-child(7n + 5 of blockquote, pre) { border-bottom-left-radius: 50px 220px; }
.post main :nth-child(7n + 6 of blockquote, pre) { border-bottom-left-radius: 25px 170px; }
.post main :nth-child(7n of blockquote, pre) { border-bottom-left-radius: 40px 240px; }

.post main :nth-child(9n + 1 of blockquote, pre) { transform: rotate(-0.3deg); }
.post main :nth-child(9n + 2 of blockquote, pre) { transform: rotate(0.25deg); }
.post main :nth-child(9n + 3 of blockquote, pre) { transform: rotate(-0.15deg); }
.post main :nth-child(9n + 4 of blockquote, pre) { transform: rotate(0.35deg); }
.post main :nth-child(9n + 5 of blockquote, pre) { transform: rotate(-0.4deg); }
.post main :nth-child(9n + 6 of blockquote, pre) { transform: rotate(0.1deg); }
.post main :nth-child(9n + 7 of blockquote, pre) { transform: rotate(0.3deg); }
.post main :nth-child(9n + 8 of blockquote, pre) { transform: rotate(-0.2deg); }
.post main :nth-child(9n of blockquote, pre) { transform: rotate(0deg); }

/* ==========================================================================
   Homepage

   Markup comes from lib/home-sections.js; the section and list classes
   below are set there.
   ========================================================================== */

.home {
  --width: var(--wide);
  --story-bg: rgba(244, 223, 87, 0.07);
  --story-bg-hover: rgba(244, 223, 87, 0.11);

  padding-bottom: 120px;
  line-height: 1.5;
}

/* Recursive is only used with its Casual axis fully on. */
.home .legend,
.home .go,
.home .extras,
.home .year > h2,
.home blockquote {
  font-family: var(--font-main);
  font-variation-settings: "CASL" 1;
}

.home a:hover {
  text-decoration: none;
}

/* Communities ------------------------------------------------------------- */

.home .communities {
  margin-bottom: 56px;
  padding-bottom: 36px;
}

/* The band explains itself by sitting under the name; the heading stays for
   screen readers only. */
.home .communities > h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.home .community-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home .community-list > li {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 14px;
  align-items: center;
  /* Items in a row share the tallest one's height. Pack the title and its
     line together and centre them, rather than sharing the spare height
     out between them. */
  align-content: center;
  padding: 10px 18px 10px 8px;
  border-radius: 40px 14px 36px 12px / 12px 36px 14px 40px;
  transition: transform 0.25s ease, background 0.25s ease;
}

.home .community-list > li:hover,
.home .community-list > li:focus-within {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.05);
}

.home .community-list > li > p {
  margin: 0;
}

.home .community-list > li > p:first-child {
  grid-row: span 2;
}

.home .community-list img {
  display: block;
  width: 64px;
  height: 60px;
  object-fit: contain;
}

/* As with the cards, the title link covers the whole item. */
.home .community-list h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.home .community-list h3 a:focus-visible {
  outline: none;
}

.home .community-list > li:focus-within {
  outline: 2px dashed var(--ink);
  outline-offset: 4px;
}

.home .community-list h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 300;
  line-height: 1.15;
}

/* When the drawing is taller than the title and line together, its rows grow;
   pinning the title down and the line up keeps them touching. */
.home .community-list h3 {
  align-self: end;
}

.home .community-list h3 + p {
  align-self: start;
  font-size: 15px;
  color: var(--muted);
}

/* Legend ------------------------------------------------------------------ */

.home .legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--ink);
}

.home .legend button {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 10px 0 4px;
  font: inherit;
  font-variation-settings: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 14px 6px 12px 8px;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.home .legend button:hover,
.home .legend button:focus-visible {
  color: var(--ink-bright);
  background: rgba(255, 255, 255, 0.06);
}

.home .legend button:focus-visible {
  outline: 2px dashed var(--ink);
  outline-offset: 2px;
}

.home .legend button[aria-pressed="true"] {
  color: var(--heading-color);
  background: rgba(122, 178, 232, 0.18);
}

/* While one type is chosen, the others step back. */
.home .legend:has([aria-pressed="true"]) button[aria-pressed="false"] {
  opacity: 0.55;
}

/* Cards and years are display: grid/flex, which would beat the plain
   `hidden` attribute that filter.js sets. */
.home .card[hidden],
.home .year[hidden] {
  display: none;
}

/* Years ------------------------------------------------------------------- */

.home .year {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  column-gap: 56px;
  margin-top: 72px;
}

.home .year > h2 {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px;
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--quiet);
}

.home .year > h2::after {
  content: "";
  flex: 1;
  border-top: var(--dash);
}

.home .table {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 40px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home .rail {
  align-self: start;
  position: sticky;
  top: 28px;
  padding: 4px 0 0 26px;
}

.home .rail ul {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home .post a {
  display: block;
  padding: 2px 0 2px 14px;
  border-left: 2px solid rgba(122, 178, 232, 0.4);
  color: var(--text-color);
}

.home .post time {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.home .post span {
  display: block;
  font-size: 17px;
  line-height: 1.3;
}

.home .post a:hover span {
  color: var(--ink-bright);
  text-decoration: underline wavy 1px;
  text-underline-offset: 5px;
}

/* Cards ------------------------------------------------------------------- */

.home .card {
  position: relative;
  padding: 24px 28px 28px;
  color: var(--text-color);
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg));
  transition: transform 0.28s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.home .card[data-type~="story"] {
  background: var(--story-bg);
}

.home .card:hover,
.home .card:focus-within {
  z-index: 10;
  background: var(--card-bg-hover);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  transform: translate(var(--x, 0), calc(var(--y, 0px) - 8px)) rotate(0deg) scale(1.03);
}

.home .card[data-type~="story"]:hover,
.home .card[data-type~="story"]:focus-within {
  background: var(--story-bg-hover);
}

.home .card:focus-within {
  outline: 2px dashed var(--ink);
  outline-offset: 6px;
}

/* The title link covers the whole card. Anything else interactive sits above
   it. */
.home .card h3 a {
  color: inherit;
}

.home .card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.home .card h3 a:focus-visible {
  outline: none;
}

.home .card .extras a {
  position: relative;
  z-index: 2;
}

.home .card h3 {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 300;
  line-height: 1.12;
}

.home .card p {
  margin: 0 0 14px;
}

.home .card-type {
  display: flex;
  color: var(--ink);
}

/* Scatter: coprime cycles, so no two neighbours share a pose. */
.home .card:nth-child(9n + 1) { --r: -0.8deg; }
.home .card:nth-child(9n + 2) { --r: 1.6deg; }
.home .card:nth-child(9n + 3) { --r: -2.4deg; }
.home .card:nth-child(9n + 4) { --r: 1.2deg; }
.home .card:nth-child(9n + 5) { --r: -1.4deg; }
.home .card:nth-child(9n + 6) { --r: 2.6deg; }
.home .card:nth-child(9n + 7) { --r: -2deg; }
.home .card:nth-child(9n + 8) { --r: 0.8deg; }
.home .card:nth-child(9n)     { --r: -2.8deg; }

.home .card:nth-child(7n + 1) { --y: 0px; }
.home .card:nth-child(7n + 2) { --y: 20px; }
.home .card:nth-child(7n + 3) { --y: -18px; }
.home .card:nth-child(7n + 4) { --y: 26px; }
.home .card:nth-child(7n + 5) { --y: -8px; }
.home .card:nth-child(7n + 6) { --y: 14px; }
.home .card:nth-child(7n)     { --y: -22px; }

.home .card:nth-child(5n + 2) { --x: 8px; }
.home .card:nth-child(5n + 4) { --x: -10px; }

/* Hero cards: a picture first, a few words after. */

.home .hero {
  flex: 0 1 320px;
  min-width: 240px;
  /* Contains the floated extra links. */
  display: flow-root;
}

.home .hero:nth-child(4n + 1) { border-radius: 255px 45px 125px 25px / 15px 225px 15px 255px; }
.home .hero:nth-child(4n + 2) { border-radius: 205px 15px 25px 15px / 15px 225px 15px 255px; }
.home .hero:nth-child(4n + 3) { border-radius: 205px 30px 225px 25px / 15px 190px 15px 170px; }
.home .hero:nth-child(4n)     { border-radius: 255px 45px 25px 15px / 15px 25px 15px 255px; }

.home .hero .card-type {
  margin-bottom: 6px;
}

.home .hero p:has(> img) {
  margin-bottom: 14px;
}

.home .hero img {
  display: block;
  width: 56%;
  margin: 0 auto;
}

.home .hero p {
  font-size: 17px;
  color: #cfc8d8;
}

.home .hero blockquote {
  margin: 4px 0 22px;
  padding: 0;
  border: 0;
  font-size: 34px;
  font-weight: 300;
  font-style: normal;
  line-height: 1.15;
  color: var(--gold);
}

.home .hero blockquote p {
  margin: 0;
  font-size: inherit;
  color: inherit;
}

/* Extra links share the card's last line with the "verb →": they come
   before it in the markup, so floating them right puts the verb on the left
   and the links bottom right. */
.home .extras {
  float: right;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 14px;
  margin: 2px 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.home .extras p {
  margin: 0;
}

.home .extras a {
  text-decoration: underline wavy 1px;
  text-underline-offset: 5px;
}

.home .go {
  display: inline-block;
  font-size: 17px;
  color: var(--ink);
  transition: transform 0.25s ease;
}

.home .card:hover .go {
  transform: translateX(6px);
}

/* Chips: icon and title; the line underneath opens on hover or focus. */

.home .chip {
  flex: 0 0 auto;
  min-width: 200px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  padding: 14px 22px 14px 14px;
}

.home .chip:nth-child(4n + 1) { border-radius: 40px 12px 30px 14px / 14px 30px 12px 40px; }
.home .chip:nth-child(4n + 2) { border-radius: 14px 40px 12px 30px / 30px 12px 40px 14px; }
.home .chip:nth-child(4n + 3) { border-radius: 30px 14px 40px 12px / 12px 40px 14px 30px; }
.home .chip:nth-child(4n)     { border-radius: 12px 30px 14px 40px / 40px 14px 30px 12px; }

.home .chip h3 {
  margin: 0;
  font-size: 21px;
  white-space: nowrap;
}

/* Everything under the title (description, "verb →", extra links) spans the
   full row, so none of it can widen the icon column and push the title
   over, and all of it opens together on hover. */
.home .chip > :is(p, .go, .extras) {
  grid-column: 1 / -1;
  /* Never widens the chip: the title alone sets its width. */
  contain: inline-size;
  max-height: 0;
  margin: 0;
  padding-left: 38px;
  overflow: hidden;
  opacity: 0;
  font-size: 15px;
  line-height: 1.4;
  transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease, transform 0.25s ease;
}

/* Only the description is grey; the verb keeps the ink colour of a link. */
.home .chip > p {
  color: #cfc8d8;
}

.home .chip > .extras {
  justify-content: flex-start;
}

.home .chip:hover > :is(p, .go, .extras),
.home .chip:focus-within > :is(p, .go, .extras) {
  max-height: 6em;
  margin-top: 8px;
  opacity: 1;
}

/* Prizes: a drawn rosette pinned to the corner, tier sets the colour. */

.home .card[data-badge] {
  --badge-color: var(--ink);
}

.home .card[data-tier="gold"]   { --badge-color: var(--badge-gold); }
.home .card[data-tier="silver"] { --badge-color: var(--badge-silver); }
.home .card[data-tier="bronze"] { --badge-color: var(--badge-bronze); }

.home .chip[data-badge] {
  padding-right: 48px;
}

.home .card[data-badge]::before {
  content: "";
  position: absolute;
  top: -22px;
  right: -14px;
  z-index: 3;
  width: 46px;
  height: 46px;
  background: var(--badge-color);
  transform: rotate(-8deg);
  pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='9.5' r='5.6'/%3E%3Cpath d='M8.6 14.1L7 21l3.4-1.7 1.6 2.1M15.4 14.1L17 21l-3.4-1.7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='9.5' r='5.6'/%3E%3Cpath d='M8.6 14.1L7 21l3.4-1.7 1.6 2.1M15.4 14.1L17 21l-3.4-1.7'/%3E%3C/svg%3E") center / contain no-repeat;
}

.home .card[data-badge]::after {
  content: attr(data-badge);
  position: absolute;
  top: 24px;
  right: -22px;
  z-index: 3;
  font-family: var(--font-main);
  font-variation-settings: "CASL" 1;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
  color: var(--badge-color);
  transform: rotate(-8deg);
  pointer-events: none;
}

/* Narrow screens: one column, and each year's posts fold in between its cards
   using the `order` values home-sections.js wrote. */

@media (max-width: 900px) {
  /* One column: the filters go. filter.js clears any filter at this width
     too, so nothing stays hidden without a way to bring it back. */
  .home .legend {
    display: none;
  }

  .home .year {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    margin-top: 56px;
  }

  .home .year > h2 {
    align-self: stretch;
    margin: 0;
  }

  .home .table,
  .home .rail,
  .home .rail ul {
    display: contents;
  }

  .home .card,
  .home .post {
    width: 100%;
    max-width: 460px;
  }

  /* In a column, the hero's 320px flex-basis would act as a minimum height. */
  .home .card {
    flex: none;
  }

  .home .post {
    padding-left: 12px;
  }
}

@media (max-width: 640px) {
  .home {
    padding-block: 48px 96px;
  }

  .home > main,
  .home .site-footer {
    padding-inline: 16px;
  }

  .home .masthead {
    padding-inline: 16px;
  }

  /* A long chip title would run past the screen edge; let it wrap here. */
  .home .chip {
    max-width: 100%;
  }

  .home .chip h3 {
    min-width: 0;
    white-space: normal;
  }

  .home .card {
    --x: 0px;
    --y: 0px;
  }

  .home .card:nth-child(odd) { --r: -0.6deg; }
  .home .card:nth-child(even) { --r: 0.5deg; }

  /* Cards are full width here, so the prize stays inside the screen edge and
     its label moves beside the rosette. */
  .home .card[data-badge]::before {
    right: -4px;
  }

  .home .card[data-badge]::after {
    top: -6px;
    right: 42px;
  }
}

/* Touch screens have no hover, so chips show their line all the time and a
   press gives the feedback instead. */
@media (hover: none) {
  .home .chip > :is(p, .go, .extras) {
    max-height: none;
    margin-top: 8px;
    opacity: 1;
  }

  .home .card:hover {
    transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg));
  }

  .home .card:active {
    transform: rotate(0deg) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home .card,
  .home .go,
  .home .chip > :is(p, .go, .extras),
  .contacts a,
  .back,
  .home .legend button,
  .home .community-list > li {
    transition: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
