/* -------------- Global variables -------------- */

:root {
  /* Colors */
  --transparent: rgba(0, 0, 0, 0);

  /* Content (.responsive-container): at most this wide, and this far off the screen's sides, from tablets up */
  --content-max-width: 1200px;
  --content-gutter: 2rem;

  /* Header */
  --header-height: 64px;

  /* Navigation */
  --navmenu-mobile-width: min(20rem, 85%);
  --navmenu-mobile-min-width: 300px;
  --navmenu-sidebar-transition-duration: 0.1s;

  /* Footer */
  --footer-height: 80px;
}

/* -------------- Page changes -------------- */

/* Browsers that support it cross-fade from one page to the next, instead of blanking the window while the next loads. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* -------------- Colors -------------- */

/* The shared ones are in colors.css. */

:root {
  /* Header: how far it's scrolled from the top, 0 to 1 (and on, past 300px: main.ts), lighting its bottom edge. */
  --header-bg-opacity: 0;

  /* Navigation */
  --navmenu-mobile-bg-color: #0d120d;
  --navmenu-item-bg-hover-color: #142614;
  /* Light enough on the background to read (WCAG AA); the current page's the accent. */
  --navmenu-item-text-color: #8fb08f;
  --navmenu-item-text-active-color: var(--link-color);
  --navmenu-item-font-weight: 500;
  --navmenu-item-active-font-weight: 600;

  /* Home page's sections: a shade above the background, so the panels read as surfaces. */
  --home-section-bg-color: #0e130e;

  /* Brushed metal, for the big headings' letters: a soft sheen, light to grey. */
  --chrome-gradient: linear-gradient(
    180deg,
    #f4f8f4 0%,
    #d4dcd4 55%,
    #a8b2a8 100%
  );
}

/* -------------- Body -------------- */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--bg-color);
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--text-color);
  font-family: Hack, monospace;
}

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

/* Less motion for those who asked for it (stories slide at once, components/media-story). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.header__menu-toggler,
.navmenu__close-button {
  all: unset;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 4px;
}

/* -------------- Utility classes -------------- */

.no-scroll {
  overflow: hidden;
}

/* The first thing the keyboard reaches (main_layout.html): shown only then. */
.skip-link:focus {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1100;
  padding: 0.5rem 1rem;
  background-color: var(--bg-color);
  border: 1px solid var(--link-color);
  border-radius: 0;
}

/* -------------- Responsive container -------------- */

/*
 * The header's, main's and footer's content: the screen's width, less a gutter on each side, up to its widest. Fluid,
 * so the text uses the room there is at any width, and doesn't jump between fixed widths as the window is resized.
 * On phones the whole width: what's in it keeps itself off the edges (main's padding, the footer's, the header's).
 */
.responsive-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;

  @media (min-width: 768px) {
    max-width: min(var(--content-max-width), 100% - 2 * var(--content-gutter));
    margin-inline: auto;
  }
}

/* -------------- Header section -------------- */

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--header-height);
  height: var(--header-height);
  box-sizing: border-box;
  /*
   * Opaque: it's in the flow, over nothing at the top, so it has nothing to show through then; and what scrolls under
   * it, it hides. Scrolling lights its bottom edge instead, so it reads as lifted off the page.
   */
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow:
    0 1px 0 rgba(57, 255, 122, calc(min(1, var(--header-bg-opacity)) * 0.35)),
    0 0 12px rgba(57, 255, 122, calc(min(1, var(--header-bg-opacity)) * 0.15));
}

.header__menu-toggler {
  font-size: 1.5rem;
  padding-right: 1rem;
  color: var(--navmenu-item-text-color);
  cursor: pointer;
  height: auto;
  width: auto;
  @media (min-width: 1024px) {
    display: none;
  }
}

.header__container {
  height: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* The logo, and the site's name after it as a prompt, a cursor blinking after it. */
.header__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: inherit;
  margin-left: 0.5rem;
  text-decoration: none;

  @media (min-width: 768px) {
    margin-left: 0;
  }
}

.header__logo-image {
  height: 48px;
  width: auto;
}

.header__logo-text {
  color: var(--navmenu-item-text-color);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;

  &::after {
    content: "_" / "";
    margin-left: 0.1em;
    color: var(--link-color);
    animation: cursor-blink 1.1s steps(1) infinite;
  }
}

.header__logo:hover .header__logo-text {
  color: var(--link-color);
}

/* Only with the filters after it, there for SVG logos (header.html): */
.header__logo:has(+ .header__logo-filter) .header__logo-image {
  filter: url("#header-logo-tint");
}

.header__logo:hover:has(+ .header__logo-filter) .header__logo-image {
  filter: url("#header-logo-hover");
}

.header__logo-filter {
  position: absolute;
  width: 0;
  height: 0;
}

.header__logo-filter-flood {
  flood-color: var(--link-color);
}

.header__logo-filter-flood--tint {
  flood-color: var(--navmenu-item-text-color);
}

/* -------------- Navigation menu -------------- */

.navmenu {
  visibility: hidden;

  /* Positioning: */
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;

  /* Colors: */
  opacity: 0;
  background-color: rgba(0, 0, 0, 0.7); /* put in vars */
  backdrop-filter: blur(2px);

  /* Animations: */
  transition: opacity var(--navmenu-sidebar-transition-duration) ease-in-out,
    visibility 0s var(--navmenu-sidebar-transition-duration);

  /* User interaction: */
  pointer-events: none;

  @media (min-width: 1024px) {
    /* Display: */
    display: flex;
    visibility: visible;

    /* Positioning: */
    position: static;
    margin-right: 0.5rem;

    /* Dimensions: */
    width: auto;
    min-width: auto;

    /* Colors: */
    opacity: 1;
    background-color: inherit;
    backdrop-filter: none;

    /* Animations: */
    transition: none;

    /* User interaction: */
    pointer-events: all;
  }
}

.navmenu.navmenu--open {
  /* Display: */
  visibility: visible;

  /* Colors: */
  opacity: 1;

  /* Animations: */
  transition: opacity var(--navmenu-sidebar-transition-duration) ease-in-out, visibility 0s;

  /* User interaction: */
  pointer-events: all;
}

.navmenu .navmenu__content {
  /* Display: */
  visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;

  /* Positioning: */
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;

  /* Dimensions: */
  width: var(--navmenu-mobile-width);
  height: 100%;

  /* Colors: */
  background-color: var(--navmenu-mobile-bg-color);
  /* Lit along its edge, as the header is when scrolled. */
  border-left: 1px solid var(--border-color);
  box-shadow: -1px 0 0 var(--accent-dim), 0 0 24px rgba(57, 255, 122, 0.08);

  /* Animations: */
  transition: transform var(--navmenu-sidebar-transition-duration) ease-in-out;
  transform: translateX(100%);

  @media (min-width: 1024px) {
    /* Display: */
    display: flex;
    flex-direction: row;
    visibility: visible;

    /* Positioning: */
    position: static;
    margin-right: 0.5rem;

    /* Dimensions: */
    width: auto;
    min-width: auto;

    /* Colors: */
    background-color: inherit;
    border-left: none;
    box-shadow: none;

    /* Animations: */
    transition: none;
    transform: none;
  }
}

.navmenu.navmenu--open .navmenu__content {
  /* Display: */
  visibility: visible;

  /* Animations: */
  transform: translateX(0);
}

.navmenu.navmenu--open .navmenu__close-section {
  display: flex;
  justify-content: end;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
  height: var(--header-height);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

/* Where the menu button was, the same size, so the one stands in for the other. */
.navmenu.navmenu--open .navmenu__close-button {
  padding-right: 1rem;
  font-size: 1.5rem;
  color: var(--navmenu-item-text-color);
}


.navmenu__close-section {
  display: none;
}

/* Leads to the search page: atop the drawer's links on phones, left of them on wider screens; a prompt before it. */
.navmenu__search {
  position: relative;
  align-self: stretch;
  margin: 0 1rem 1rem;

  @media (min-width: 1024px) {
    flex: 0 1 14rem;
    min-width: 8rem;
    align-self: auto;
    margin: 0 1rem 0 0;
  }
}

.navmenu__menu-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: center;
  justify-content: start;
  width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;

  /* In the drawer: full-width rows, left-aligned. */
  @media (max-width: 1023px) {
    align-items: stretch;
  }

  @media (min-width: 1024px) {
    flex-direction: row;
    width: auto;
    flex: 0;
  }
}

.navmenu__menu-item {
  margin: 0 0.2rem;
  user-select: none;

  @media (max-width: 1023px) {
    margin: 0;
  }
}

/* Lit from below on hover, and for the current page (in the accent). */
.navmenu__menu-link {
  white-space: nowrap;
  padding: 10px 12px;
  display: block;
  transition: color 0.15s ease, box-shadow 0.15s ease;

  /* Colors: */
  color: var(--navmenu-item-text-color);
  font-weight: var(--navmenu-item-font-weight);

  @media (max-width: 1023px) {
    padding: 0.75rem 1.25rem;
  }
}

.navmenu__menu-link:hover,
.navmenu__menu-link:focus-visible {
  color: var(--light-text-color);
  box-shadow: inset 0 -2px 0 var(--accent-dim);
}

.navmenu__menu-link.navmenu__menu-link--current-page {
  color: var(--navmenu-item-text-active-color);
  font-weight: var(--navmenu-item-active-font-weight);
  box-shadow: inset 0 -2px 0 var(--link-color);
}

/* In the drawer, lit from the left instead: a bar along the row's edge, the row shaded. */
@media (max-width: 1023px) {
  .navmenu__menu-link:hover,
  .navmenu__menu-link:focus-visible {
    background-color: var(--navmenu-item-bg-hover-color);
    box-shadow: inset 2px 0 0 var(--accent-dim);
  }

  .navmenu__menu-link.navmenu__menu-link--current-page {
    background-color: var(--navmenu-item-bg-hover-color);
    box-shadow: inset 2px 0 0 var(--link-color);
  }
}


/* -------------- Main section -------------- */

main {
  /* Fills the body (a flex column), keeping the footer at the bottom. */
  flex: 1;
  /* Every page's first thing (its title, its frame) the same way off the header: */
  padding-top: 2.5rem;
  padding-bottom: 3rem;

  /* On phones, everything in it off the screen's edges (the container has none). */
  @media (max-width: 767px) {
    padding-inline: 1rem;
  }
}

/* That padding is the room above it, not its own margin as well: */
main > :first-child {
  margin-top: 0;
}

/* -------------- Footer section -------------- */

/*
 * At least as tall as it's always been, taller only when what's in it wraps (on phones). Empty, it's just the edge.
 */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: var(--footer-height);
  padding-block: 1rem;
  box-sizing: border-box;
  /* Edged as the header is (its bottom border), framing the page between them. */
  border-top: 1px solid var(--border-color);

  /*
   * The text on the left, the links on the right, lined up with the content's edges above (as main is, inset from
   * the screen's only on phones); either alone sits on the left. Where they don't fit side by side, the links go
   * under the text, on the left too.
   */
  .footer__container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1.5rem;

    @media (max-width: 767px) {
      padding-inline: 1rem;
    }
  }

  /* Quiet, as the links are: the footer frames the page rather than competing with it. */
  .footer__text {
    margin-bottom: 0;
    color: var(--muted-text-color);
    font-size: 0.9rem;
  }

  /* The feed's and the follow page's links, side by side (wrapping, on the narrowest screens). */
  .footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
  }

  .footer__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted-text-color);
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
  }

  .footer__link:hover,
  .footer__link:focus-visible {
    color: var(--link-color);
  }
}

/* -------------- Hero section -------------- */

/*
 * The image in a frame as the others are, about two thirds of the screen tall (the site's sections in sight under
 * it), its text in a terminal's panel at its bottom left.
 */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 1.5rem;
  height: min(70vh, 40rem);
  min-height: 20rem;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background-color: var(--placeholder-bg-color);
  user-select: none;
}

/*
 * Over the image: darker towards the text, a faint green cast (into the site's colours) and scanlines; under the
 * text. The noise (.hero::after, main.css's end) is over all of it.
 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.18) 2px 3px),
    linear-gradient(to top, rgba(10, 12, 10, 0.85) 0%, rgba(10, 12, 10, 0.25) 55%, rgba(10, 12, 10, 0.1) 100%),
    linear-gradient(rgba(57, 255, 122, 0.06), rgba(57, 255, 122, 0.06));
  pointer-events: none;
}

/* The image fills the hero, behind its text (a real <img>, so it loads like one: sized, prioritised). */
.hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: min(36rem, 100%);
  box-sizing: border-box;
  padding: 1rem;
  border: 1px solid var(--accent-dim);
  background-color: rgba(10, 12, 10, 0.75);
  backdrop-filter: blur(2px);
}

.hero__content p {
  margin: 0;
  color: var(--text-color);

  &::before {
    content: "$ " / "";
    color: var(--muted-text-color);
  }
}

/* -------------- Images and videos (blocks/image_block.html, video_block.html) -------------- */

.media-item {
  margin: 1.5rem 0;
}

/* As wide as there's room for, but no bigger than it is: a small picture isn't stretched (and blurred), it's centred. */
.media-item__image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-right: auto;
  margin-left: auto;
}

/*
 * No taller than about two thirds of the screen (and 44rem on big ones): tall images and videos (a phone's, upright)
 * are shown whole, scaled down, leaving room for the text around them.
 */
.media-item .media-item__image,
.media-item .hosted-file-video,
.media-item .hosted-file-embed iframe {
  max-height: min(65vh, 44rem);
}

.media-item .media-item__image {
  object-fit: contain;
}

/*
 * Its title, above it: centred, in the headings' letters, a lit bar under it as the page's title has. On one line
 * it's --media-title-height tall.
 */
.media-item {
  --media-title-height: calc(0.25rem + 1.2rem * 1.3 + 0.5rem + 2px + 1rem);
}

.media-item__title {
  margin: 0.25rem 0 1rem;
  padding: 0 3.5rem;
  color: var(--light-text-color);
  font-family: Bungee, Hack, monospace;
  font-size: 1.2rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-align: center;
  text-wrap: balance;
}

.media-item__title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin: 0.5rem auto 0;
  background-color: var(--accent-dim);
}

/* Its words under it (blocks/shared/media_item_words.html): the caption centred, then its text. */
.media-item__words {
  padding: 0.5rem 0.75rem 0;
}

.media-item__caption {
  margin: 0;
  color: var(--muted-text-color);
  font-size: 0.9rem;
  text-align: center;
}

.media-item__text {
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.media-item__text p {
  margin: 0 0 0.75rem;
}

.media-item__text p:last-child {
  margin-bottom: 0;
}

/* "More" under a text cut short (below): as a link, in the frames' small capitals. */
.media-item__more {
  margin-top: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link-color);
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.media-item__more::before {
  content: "[ more ]" / "";
}

/* The CSS's own words, in the site's other language (<html lang>, services/languages.py): */
.media-item__more:lang(sr)::before {
  content: "[ još ]" / "";
}

.media-item__more:hover {
  text-shadow: 0 0 8px var(--accent-dim);
}

/* -------------- Stories (blocks/shared/story.html, components/media-story) -------------- */

/*
 * A story's items are side by side in a strip that scrolls sideways and stops on each: by a swipe, a trackpad or the
 * arrow keys on their own; its buttons are the script's (hidden until it runs). The script also keeps the strip as
 * tall as the item shown (without it, as the tallest), so no item leaves empty space under it.
 * This part is every story's. How its items are laid out is its `layout`'s, each in a part of its own below:
 * "framed", "open", "dialog" and (with the microblog's posts over their listing, further down) "feed".
 */
.story {
  display: block;
  position: relative;
}

.story [hidden] {
  display: none;
}

.story .media-item,
.story .hosted-file-video,
.story .hosted-file-embed {
  margin: 0;
}

.story__slides {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}

.story__slides:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: -2px;
}

/*
 * Without the script, the scrollbar is the only way through it with a mouse. With it, as tall as the item shown
 * (--story-strip-height, which the script keeps).
 */
.story--ready .story__slides {
  align-items: flex-start;
  height: var(--story-strip-height, auto);
  overflow-y: hidden;
  scrollbar-width: none;
  transition: height 0.2s ease;
}

.story--ready .story__slides::-webkit-scrollbar {
  display: none;
}

.story__slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

/*
 * Its buttons: small squares, lit on hover as the frames are. Previous and next at the sides of the shown item's
 * picture, at its middle (--story-media-middle and --story-media-right, set by the script: off a video's controls,
 * along its bottom, and off the words under or beside it); "open" at its top right corner.
 */
.story__nav,
.story__open {
  padding: 0;
  border: 1px solid var(--accent-dim);
  border-radius: 0;
  background-color: rgba(10, 12, 10, 0.75);
  color: var(--light-text-color);
  font-family: Hack, monospace;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.story__nav:hover,
.story__nav:focus-visible,
.story__open:hover,
.story__open:focus-visible {
  border-color: var(--link-color);
  color: var(--link-color);
  box-shadow: 0 0 8px var(--accent-dim);
}

.story__nav {
  position: absolute;
  top: var(--story-media-middle, 50%);
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
  transform: translateY(-50%);
}

.story__nav--previous {
  left: 0.75rem;
}

.story__nav--next {
  right: calc(var(--story-media-right, 0px) + 0.75rem);
}

/*
 * What the buttons show is here, not in the page: its text is only what's read (their names are their aria-labels).
 */
.story__nav--previous::before {
  content: "<" / "";
}

.story__nav--next::before {
  content: ">" / "";
}

.story__open::before {
  content: "[+]" / "";
}

/* At the first item, and the last: nowhere to go. */
.story__nav:disabled {
  visibility: hidden;
}

.story__open {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  font-size: 0.8rem;
}

/* Its indicators: small squares in a row under it, the shown item's lit. */
.story__dots {
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
}

/* 8px squares; the space around each is clickable too. */
.story__dot {
  box-sizing: content-box;
  width: 8px;
  height: 8px;
  padding: 6px 3px;
  border: 0;
  border-radius: 0;
  background-color: var(--muted-text-color);
  background-clip: content-box;
  cursor: pointer;
}

.story__dot[aria-current="true"] {
  background-color: var(--link-color);
  filter: drop-shadow(0 0 3px var(--accent-dim));
}

/*
 * Where a story isn't in a page's frame ("open", "dialog", "feed"): no picture taller than --story-item-height, which
 * each of those sets; and on phones it's swiped through, its indicators or a count saying where it is.
 */
.story:not([layout="framed"]) .media-item .media-item__image,
.story:not([layout="framed"]) .media-item .hosted-file-video,
.story:not([layout="framed"]) .media-item .hosted-file-embed iframe {
  max-height: var(--story-item-height);
}

@media (max-width: 767px) {
  .story:not([layout="framed"]) .story__nav {
    display: none;
  }
}

/* -------------- Stories, framed: a media block's, in its page (blocks/media_items_block.html) -------------- */

/* Its indicators are the frame's title bar's squares, in place of the drawn ones. */
.story[layout="framed"] .story__dots {
  position: absolute;
  top: calc(-1 * var(--frame-bar-height));
  right: 0.75rem;
  /* The bar's height, but for its bottom border: */
  height: calc(var(--frame-bar-height) - 1px);
  align-items: center;
  padding: 0;
}

.frame:has(.story__dots:not([hidden]))::before {
  background: #0d140d;
}

/* A title is one line, cut short when longer (all of it once the story is opened): always --media-title-height tall. */
.story[layout="framed"] .media-item__title {
  overflow: hidden;
  text-overflow: ellipsis;
  text-wrap: nowrap;
}

/*
 * Where any of its items has a title, those without one leave its room above them: every picture starts as far down,
 * so the previous and next buttons (at the pictures' middle) don't jump as it's slid through.
 */
.story[layout="framed"]:has(.media-item__title) .media-item:not(:has(.media-item__title))::before {
  content: "";
  display: block;
  height: var(--media-title-height);
}

/*
 * One that opens (`expandable`, story-viewer.ts): by its images, and "more" under a text, which is its first lines
 * here; the rest is read once opened, where there's room for it. On phones its words open it too.
 */
.story--ready[layout="framed"][expandable] .media-item__image {
  cursor: zoom-in;
}

.story--ready[layout="framed"][expandable] .media-item__text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* -------------- Stories, open: a microblog post's, in its page (microblog/microblog_post.html) -------------- */

/* All of each text, under its picture. */
.story[layout="open"] {
  --story-item-height: min(70vh, 46rem);
}

@media (max-width: 767px) {
  .story[layout="open"] {
    --story-item-height: 60dvh;
  }
}

/* -------------- Stories, in the dialog: a media block's, opened (story-viewer.ts) -------------- */

/*
 * The dialog of what's over the page (overlay.ts): a story opened (story-viewer.ts moves it there, and back), and
 * the microblog's posts (microblog-feed.ts, further down). A frame of its own, its bar with a title, a count and a close
 * button. A window on big screens, the whole screen on phones.
 */
.story-dialog {
  --frame-bar-height: 2.25rem;
  --story-dialog-height: min(90vh, 60rem);

  flex-direction: column;
  width: min(80rem, 94vw);
  max-width: none;
  height: var(--story-dialog-height);
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--accent-dim);
  background-color: var(--placeholder-bg-color);
  color: var(--text-color);
}

.story-dialog[open] {
  display: flex;
}

/* Focused itself by the script, to keep the keyboard in it (overlay.ts): */
.story-dialog:focus {
  outline: none;
}

.story-dialog::backdrop {
  background-color: rgba(5, 7, 5, 0.9);
}

.story-dialog__bar {
  display: flex;
  flex: none;
  gap: 0.75rem;
  align-items: center;
  height: var(--frame-bar-height);
  padding-left: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background-color: #0d140d;
  color: var(--muted-text-color);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-dialog__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-dialog__title:not(:empty)::before {
  content: "\2500[ " / "";
}

.story-dialog__title:not(:empty)::after {
  content: " ]" / "";
}

/* What closes one of them (overlay.ts): after the stories' own "open", which the zoomed image's close button looks as. */
[data-overlay-close]::before {
  content: "[x]" / "";
}

/* The bar's buttons: text, as its title is, lit on hover. */
.story-dialog__bar button {
  height: 100%;
  padding: 0 0.75rem;
  border: 0;
  background: none;
  color: var(--muted-text-color);
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.story-dialog__bar button:hover,
.story-dialog__bar button:focus-visible {
  color: var(--link-color);
}

.story-dialog__bar button:disabled {
  visibility: hidden;
}

@media (max-width: 767px) {
  .story-dialog {
    width: 100vw;
    height: 100dvh;
    border: 0;
  }
}

/*
 * The story in it: as tall as the dialog, each item scrolling on its own when it's taller, centred in it when not.
 * All of each text; the bar counts the items and closes it.
 */
.story[layout="dialog"] {
  /* The dialog's height, but for its bar, borders, the space around the item and a title or caption: */
  --story-item-height: calc(var(--story-dialog-height) - var(--frame-bar-height) - 3px - 1.5rem - 5rem);

  display: flex;
  flex: 1;
  min-height: 0;
}

/* (As tall as the dialog, not as the item shown.) */
.story[layout="dialog"] .story__slides {
  flex: 1;
  align-items: stretch;
  min-width: 0;
  height: auto;
}

.story[layout="dialog"] .story__slide {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.story[layout="dialog"] .media-item {
  width: 100%;
  margin-block: auto;
  padding: 0.75rem;
}

.story[layout="dialog"] .story__dots,
.story[layout="dialog"] .story__open,
.story[layout="dialog"] .media-item__more {
  display: none;
}

/* The previous and next buttons at the dialog's middle, wherever the item's picture is in it: */
.story[layout="dialog"] .story__nav {
  top: 50%;
}

@media (max-width: 767px) {
  .story[layout="dialog"] {
    --story-item-height: 60dvh;
  }

  .story[layout="dialog"] .media-item__words {
    padding: 0.75rem 0.25rem 1.25rem;
  }
}

/*
 * On a big screen an item with text is laid out as the microblog's posts are opened (further down): its picture alone
 * on the left, centred, as tall as the dialog lets it; its words in a column of their own on the right, as tall as
 * the dialog, the title heading them, the text under it the only part that scrolls.
 */
@media (min-width: 60rem) {
  .story[layout="dialog"] .media-item:has(.media-item__text) {
    --story-item-height: calc(var(--story-dialog-height) - var(--frame-bar-height) - 3px - 1.5rem);

    display: grid;
    flex: 1;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    margin-block: 0;
    padding: 0;
  }

  .story[layout="dialog"] .media-item:has(.media-item__text) > :is(.media-item__image, .hosted-file-video, .hosted-file-embed) {
    grid-row: 1 / -1;
    grid-column: 1;
    align-self: center;
    justify-self: center;
    max-width: calc(100% - 1.5rem);
  }

  .story[layout="dialog"] .media-item:has(.media-item__text) > :is(.hosted-file-video, .hosted-file-embed) {
    width: calc(100% - 1.5rem);
  }

  .story[layout="dialog"] .media-item:has(.media-item__text) .media-item__title {
    grid-row: 1;
    grid-column: 2;
    margin: 0;
    padding: 1.25rem 1.25rem 0;
    border-left: 1px solid var(--border-color);
    text-align: left;
  }

  .story[layout="dialog"] .media-item:has(.media-item__text) .media-item__title::after {
    margin-left: 0;
  }

  .story[layout="dialog"] .media-item:has(.media-item__text) .media-item__words {
    grid-row: 2;
    grid-column: 2;
    padding: 1rem 1.25rem 1.25rem;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
  }

  .story[layout="dialog"] .media-item:has(.media-item__text):not(:has(.media-item__title)) .media-item__words {
    grid-row: 1 / -1;
  }

  .story[layout="dialog"] .media-item:has(.media-item__text) .media-item__caption {
    text-align: left;
  }
}

/* -------------- Images zoomed into (zoom.ts) -------------- */

/* Where a click zooms (a microblog post's images, in its page): */
.story--ready[layout="open"][zoom] .media-item__image {
  cursor: zoom-in;
}

/*
 * An image alone over the page, the whole screen: as big as fits, and at a click as big as it is, scrolled or dragged
 * around. Its buttons are the stories' (above): previous and next at its sides, close at its top right; the count of
 * the post's images at its top left.
 */
.zoom-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background-color: rgba(5, 7, 5, 0.97);
  color: var(--muted-text-color);
}

.zoom-dialog:focus {
  outline: none;
}

.zoom-dialog::backdrop {
  background-color: rgba(5, 7, 5, 0.97);
}

.zoom__stage {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: auto;
}

.zoom__image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
}

/* One that's bigger than the screen can be seen as big as it is: */
.zoom-dialog--zoomable .zoom__image {
  cursor: zoom-in;
}

.zoom-dialog--actual .zoom__image {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.zoom__counter {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.25rem 0.5rem;
  background-color: rgba(10, 12, 10, 0.75);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

/* The scrollbars' room, at actual size: */
.zoom-dialog .story__open {
  right: 1.25rem;
}

.zoom-dialog .story__nav--next {
  right: 1.25rem;
}

/* -------------- The microblog's posts over their listing (microblog-feed.ts) -------------- */

/*
 * The stories' dialog, with a post in each of its sections, one above the other: scrolled or swiped through, stopping
 * on each.
 * On big screens a post fills its section, nothing of it scrolling but the last part of its words: its pictures on
 * the left, and beside them its caption, date, tags and share links, then (scrolling) the shown picture's own words,
 * if it has any, and the comments.
 * On phones a post is its pictures, each with its own words under it, then the post's; one taller than the screen
 * scrolls in its section first, a shorter one is centred in it.
 */
/* The bar's hint of the arrow keys, in its title's place: only where there's likely a keyboard. */
.feed-viewer .story-dialog__title::before {
  /* (A space after an escape ends the escape: two, where one is to show.) */
  content: "\2500[ \2191  \2193  posts \00b7  \2190  \2192  slides ]" / "";
}

.feed-viewer .story-dialog__title:lang(sr)::before {
  content: "\2500[ \2191  \2193  objave \00b7  \2190  \2192  slajdovi ]" / "";
}

@media (hover: none) {
  .feed-viewer .story-dialog__title {
    visibility: hidden;
  }
}

.feed-viewer__posts {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.feed-viewer__posts::-webkit-scrollbar {
  display: none;
}

.feed-viewer__post {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Until its post is fetched (nothing in it yet but, maybe, the template's white space): */
.feed-viewer__post:not(:has(*))::before {
  content: "Loading\2026";
  margin: auto;
  color: var(--muted-text-color);
}

.feed-viewer__post:not(:has(*)):lang(sr)::before {
  content: "Učitava se\2026";
}

.feed-viewer__post > * {
  margin: auto;
}

/*
 * A post (microblog/microblog_post.html): its pictures, a story without their words (`bare`), and beside it
 * (.feed-viewer__side) the post's own words, each picture's words (the shown one's shown by the script) and the
 * post's comments.
 * On phones, one under the other, a picture's words right under the pictures: the side's parts are the post's own
 * there (display: contents), put in that order.
 */
.feed-viewer .microblog-post {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  padding: 0.5rem;
}

.story[layout="feed"] {
  --story-item-height: 55dvh;
}

.feed-viewer__side {
  display: contents;
}

.feed-viewer__items {
  order: 1;
}

.feed-viewer .microblog-post__info {
  order: 2;
}

.feed-viewer .comments {
  order: 3;
}

.feed-viewer__item .media-item__title {
  margin-top: 0.75rem;
  padding: 0;
}

.feed-viewer__item .media-item__words {
  padding: 0.5rem 0 0;
}

/*
 * On big screens the post fills its section and nothing of it scrolls but the side, under the post's own words,
 * which stay at its top.
 */
@media (min-width: 768px) {
  .feed-viewer__post {
    overflow: hidden;
  }

  .feed-viewer .microblog-post {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
    height: 100%;
    margin: 0;
    padding: 0;
  }

  /* The pictures: centred in their side, as tall as the dialog but for its bar, the space around and the indicators. */
  .story[layout="feed"] {
    --story-item-height: calc(var(--story-dialog-height) - var(--frame-bar-height) - 5rem);

    align-self: center;
    min-width: 0;
    padding: 0.75rem;
  }

  .feed-viewer__side:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: -2px;
  }

  .feed-viewer__side {
    display: block;
    min-height: 0;
    padding: 0 1.25rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-left: 1px solid var(--border-color);
  }

  .feed-viewer .microblog-post__info {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 1rem;
    background-color: var(--placeholder-bg-color);
  }

  .feed-viewer .microblog-post__caption {
    margin-top: 0;
  }
}

/* -------------- Listings (listing/listing_page.html, home_page.html) -------------- */

.listing__header {
  margin-bottom: 1.5rem;
}

/* The cards, and the filters in a sidebar on their right from laptops up. */
.listing__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;

  @media (min-width: 1024px) {
    grid-template-columns: minmax(0, 1fr) 16rem;
    align-items: start;
  }
}

/* Opens the sidebar, as a drawer, on phones and tablets. */
.listing__filters-toggle {
  all: unset;
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 0.9rem;
  cursor: pointer;

  &::before {
    content: "\2261  " / "";
    color: var(--link-color);
  }

  &:hover,
  &:focus-visible {
    border-color: var(--link-color);
  }

  @media (min-width: 1024px) {
    display: none;
  }
}

/*
 * The sidebar: a popover (listing_page.html), so a drawer from the right on phones and tablets, light-dismissed and
 * closed with Esc; from laptops up, always shown in the layout's column (over the browser's popover styles).
 */
.listing__sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(20rem, 85vw);
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1rem 1.25rem 2rem;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid var(--border-color);
  background-color: var(--navmenu-mobile-bg-color);
  color: var(--text-color);

  &::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
  }

  @media (min-width: 1024px) {
    display: block;
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    inset: auto;
    width: auto;
    height: auto;
    max-height: calc(100vh - var(--header-height) - 2rem);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--home-section-bg-color);
  }
}

.listing__sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  color: var(--muted-text-color);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  @media (min-width: 1024px) {
    display: none;
  }
}

.listing__sidebar-close {
  all: unset;
  padding: 0 0.25rem;
  color: var(--text-color);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.listing__search {
  margin-bottom: 1.5rem;
}

.listing__search input,
.navmenu__search input {
  width: 100%;
  max-width: 24rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* Each filter: its name, then its options. */
.listing__group + .listing__group {
  margin-top: 1.5rem;
}

.listing__group-title {
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--border-color);
  color: var(--muted-text-color);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  &::before {
    content: "// " / "";
  }
}

.listing__options {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.listing__options--inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.listing__option {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid transparent;
  color: var(--text-color);
  font-size: 0.9rem;
  text-decoration: none;

  &:hover,
  &:focus-visible {
    color: var(--link-color);
  }
}

.listing__options--inline .listing__option {
  border-color: var(--border-color);
}

.listing__option--active {
  border-color: var(--link-color);
  background-color: var(--navmenu-item-bg-hover-color);
  color: var(--link-color);
}

.listing__count {
  color: var(--muted-text-color);
  font-size: 0.8em;
}

/* The archive's years, opening on their months. */
.listing__year summary {
  padding: 0.1rem 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.listing__year[open] summary {
  color: var(--link-color);
}

.listing__year .listing__options {
  margin: 0.15rem 0 0.4rem 1rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-color);
}

.listing-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding: 0;
  list-style: none;
}

.listing-grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* The microblog's: each tile its own card (main.css's Microblog tiles), 2 a row on phones, 3 from tablets up. */
.listing-grid--tiles {
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .listing-grid--tiles {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

.listing__empty {
  grid-column: 1 / -1;
  justify-self: center;
}

/* -------------- Pagination (common/pagination.html) -------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin: 2rem 0;
}

.pagination__link,
.pagination__current {
  min-width: 2.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0;
  text-align: center;
  text-decoration: none;
}

.pagination__link {
  color: inherit;
}

.pagination__link:hover,
.pagination__current {
  border-color: var(--link-color);
}

.pagination__current {
  background-color: var(--navmenu-item-bg-hover-color);
  font-weight: 600;
}

/*
 * The home page's sections (home_page.html): each a panel, its title and "All ..." link in a header row above
 * 3 cards a row, 2 on tablets, 1 on phones.
 */
.home-section {
  margin: 2rem 0;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0;
  background-color: var(--home-section-bg-color);
}

@media (min-width: 768px) {
  .home-section {
    padding: 1.5rem;
  }
}

.home-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.home-section__title {
  margin: 0;
  font-size: 1.35rem;
}

.home-section__more {
  flex-shrink: 0;
  color: var(--muted-text-color);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.home-section__more::after {
  content: " ->";
}

.home-section__more:hover,
.home-section__more:focus-visible {
  color: var(--link-color);
  text-decoration: underline;
}

.home-section__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .home-section__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .home-section__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* The microblog's, more of them (IndexPage.section_length) and smaller: 3 a row on phones, 4 on tablets, 6 on laptops. */
.home-section__grid--tiles {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .home-section__grid--tiles {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 992px) {
  .home-section__grid--tiles {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* -------------- Cards (listing/page_card.html) -------------- */

/* As tall as the row's tallest, so cards side by side match. */
.page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
}

.page-card:hover {
  background-color: var(--hover-surface-color);
}

.page-card:has(.page-card__link:focus-visible) {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

/* The title's link covers the card, so all of it opens the page. */
.page-card__link {
  color: inherit;
  text-decoration: none;
}

.page-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.page-card__link:focus-visible {
  outline: none;
}

.page-card__summary {
  margin: 0;
}

.page-card__image {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* No image (page_card.html): a dead screen, "NO SIGNAL" over scanlines. */
.page-card__image--empty {
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background:
    repeating-linear-gradient(to bottom, transparent 0 3px, rgba(57, 255, 122, 0.05) 3px 4px),
    radial-gradient(ellipse at center, #142014 0%, var(--placeholder-bg-color) 75%);

  &:lang(sr)::before {
    content: "NEMA SIGNALA" / "";
  }

  &::before {
    content: "NO SIGNAL" / "";
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--muted-text-color);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
  }
}

.page-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 1rem 1rem;
}

.page-card__title {
  margin: 0;
  font-weight: 600;
  font-size: 1.1rem;
  line-height: inherit;
}

.page-card__date,
.page-card__tags {
  color: var(--muted-text-color);
  font-size: 0.85rem;
}

.page-card__tag + .page-card__tag {
  margin-left: 0.5rem;
}

/* -------------- Microblog tiles (listing/microblog_page_card.html) -------------- */

/* Each a card of its own: a frame around its picture. */
.microblog-page-card {
  position: relative;
  display: block;
  aspect-ratio: 1;
  box-sizing: border-box;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background-color: var(--home-section-bg-color);
  color: #fff;
}

.microblog-page-card:hover,
.microblog-page-card:focus-visible {
  border-color: var(--accent-dim);
  outline: none;
}

.microblog-page-card:focus-visible {
  box-shadow: inset 0 0 0 2px var(--link-color);
}

.microblog-page-card__media--empty {
  background-color: var(--placeholder-bg-color);
}

.microblog-page-card__media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.microblog-page-card__badges {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.microblog-page-card__caption {
  position: absolute;
  inset: auto 10px 10px;
  margin: 0;
  padding: 0.5rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  font-size: 0.85rem;
  font-weight: inherit;
  line-height: inherit;
  opacity: 0;
  transition: opacity 0.15s;
}

.microblog-page-card:hover .microblog-page-card__caption,
.microblog-page-card:focus-visible .microblog-page-card__caption {
  opacity: 1;
}

/* -------------- Pages (blog posts, projects, microblog posts) -------------- */

.page-meta {
  color: var(--muted-text-color);
  font-size: 0.9rem;
}

.page-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A post's or project's title, date and tags: off the header, and ruled off from what follows. */
.blog-post > header,
.project-page > header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--border-color);
}

.blog-post > header > *,
.project-page > header > *,
.page-header__aside > * {
  margin: 0;
}

/* The date and tags, under the title; beside it, on its right, where there's room. */
.page-header__aside {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .blog-post > header,
  .project-page > header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
  }

  .page-header__aside {
    flex-shrink: 0;
    max-width: 40%;
    align-items: flex-end;
    text-align: right;
  }

  .page-header__aside .page-tags {
    justify-content: flex-end;
  }
}

/* Content's headings: room above, to start a part of their own. */
.content h2 {
  margin: 2.5rem 0 1rem;
}

.content h3,
.content h4 {
  margin: 2rem 0 0.75rem;
}

/* The "back to top" button goes back to it (back-to-top.ts): its top clear of the sticky header. */
.toc {
  scroll-margin-top: calc(var(--header-height) + 1rem);
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0;
}

.toc__list {
  margin: 0;
  padding-left: 1.25rem;
}

.toc__list a:hover,
.toc__list a:focus-visible {
  text-decoration: underline;
}

.microblog-post {
  max-width: 720px;
  margin: 0 auto;
}

/* Its comments (comments/comments.html), under it: as wide. */
.microblog-post ~ .comments {
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
}

.microblog-post__caption {
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: inherit;
}

/* -------------- Share links (common/share.html, share.ts) -------------- */

/*
 * Under the title, with the date and tags: small square outlined icons in a row, wrapping on phones; on the right with
 * them where they're beside the title. Where the browser has a share sheet, just its button and the copy one.
 */
.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
}

.share[hidden] {
  display: none;
}

.page-header__aside .share {
  margin: 0;
}

@media (min-width: 768px) {
  .page-header__aside .share {
    justify-content: flex-end;
  }
}

/* How the copy went, beside the buttons; empty otherwise. */
.share__status {
  color: var(--muted-text-color);
  font-size: 0.85rem;
}

.share__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* A finger's size, on phones. */
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--button-border-color);
  border-radius: 0;
  background: none;
  color: var(--light-text-color);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
}

.share__button[hidden] {
  display: none;
}

.share__button:hover,
.share__button:focus-visible {
  background-color: var(--hover-surface-color);
  color: var(--link-color);
}

/* -------------- Follow page's feed (follow/follow_page.html) -------------- */

/* The footer's feed link lands on it: its top clear of the sticky header. */
.follow-feed {
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.follow-feed__readers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* As the share links' buttons: */
.follow-feed__reader {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--button-border-color);
  color: var(--light-text-color);
  font-size: 0.85rem;
  text-decoration: none;
}

.follow-feed__reader:hover,
.follow-feed__reader:focus-visible {
  background-color: var(--hover-surface-color);
  color: var(--link-color);
}

.follow-feed__note,
.follow-feed__formats {
  color: var(--muted-text-color);
  font-size: 0.9rem;
}

/* -------------- Aligned paragraphs in rich text (wagtail_admin/text_alignment.py) -------------- */

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

.align-justify {
  text-align: justify;
  /* Narrow screens would stretch the spaces too wide otherwise (by <html lang>): */
  hyphens: auto;
}

/* -------------- Copyable text in rich text (wagtail_admin/copyable.py, copyable.ts) -------------- */

/*
 * Outlined, as a terminal's prompt, with its copy button inside, after it. Without scripts, just the outline: selected
 * by hand. Long values (addresses) break anywhere rather than overflow on phones.
 */
.copyable {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.05rem 0.15rem 0.05rem 0.45rem;
  border: 1px solid var(--button-border-color);
  border-radius: 4px;
  background-color: var(--placeholder-bg-color);
  color: var(--light-text-color);
  overflow-wrap: anywhere;
  vertical-align: baseline;
}

.copyable__button {
  flex-shrink: 0;
  padding: 0.15rem 0.35rem;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--muted-text-color);
  line-height: 1;
  cursor: pointer;
}

.copyable__button:hover,
.copyable__button:focus-visible {
  background-color: var(--hover-surface-color);
  color: var(--link-color);
}

/* -------------- Back to top (common/main_layout.html, back-to-top.ts) -------------- */

/*
 * A small square at the screen's bottom right, lit on hover as the stories' buttons are. Under the header and the
 * navigation menu (z-index 10). What it shows is here: its name is its aria-label.
 */
.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--accent-dim);
  border-radius: 0;
  background-color: rgba(10, 12, 10, 0.75);
  color: var(--light-text-color);
  font-family: Hack, monospace;
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;

  &::before {
    content: "\2191" / "";
  }

  &:hover,
  &:focus-visible {
    border-color: var(--link-color);
    color: var(--link-color);
    box-shadow: 0 0 8px var(--accent-dim);
  }

  &[hidden] {
    display: none;
  }

  @media (min-width: 768px) {
    right: 1.5rem;
    bottom: 1.5rem;
  }
}

/* -------------- Rich text (blocks/content_block.py's ParagraphRichTextBlock) -------------- */

/* Aligned paragraphs (wagtail_admin/text_alignment.py): */
.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

.align-justify {
  text-align: justify;
}

/*
 * The home page's blocks (home_page.html: its content's, then its sections): 2rem apart, as its sections are. Its text
 * lines up with the header's logo and the frames' edges.
 */
.home-page main > :is(.hero-section, .frame) {
  margin-block: 2rem;
}

/* The first after the hidden title (without a hero) right under main's padding, as a first child is: */
.home-page main > .visually-hidden:first-child + * {
  margin-top: 0;
}

/* -------------- Error pages (errors/error_page.html: 404.html, errors/server_error.html, 500.html) -------------- */

/*
 * A frame, off the header as every page's first thing is: the image or icon beside the text, above it on phones. The
 * icon in the links' colour, lit as the frame's edges are on hover.
 */
.error-page__body {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem;

  @media (max-width: 575px) {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
  }
}

.error-page__visual {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  width: min(12rem, 40vw);
}

.error-page__icon,
.error-page__image {
  width: 100%;
  height: auto;
  max-height: 12rem;
  object-fit: contain;
}

.error-page__icon {
  color: var(--link-color);
  filter: drop-shadow(0 0 12px var(--accent-dim));
}

.error-page__text h1 {
  margin-top: 0;
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.5rem 0 0;

  & a::before {
    content: "$ " / "";
    color: var(--muted-text-color);
  }
}

/* -------------- Callouts (blocks/callout_block.html): boxed in their kind's colour (colors.css) -------------- */

.callout {
  --callout-color: var(--info-color);
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--callout-color) 45%, transparent);
  border-left-width: 4px;
  border-left-color: var(--callout-color);
  background-color: color-mix(in srgb, var(--callout-color) 8%, transparent);
}

.callout--warning {
  --callout-color: var(--warning-color);
}

.callout--danger {
  --callout-color: var(--danger-color);
}

.callout__heading {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

.callout__icon,
.callout__kind {
  color: var(--callout-color);
}

.callout__kind {
  font-family: Hack, monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.callout__text > :first-child {
  margin-top: 0;
}

.callout__text > :last-child {
  margin-bottom: 0;
}

/* -------------- Tables (blocks/table_block.html): scrolled sideways when wider than the page -------------- */

.table-block {
  margin: 1.5rem 0;
  overflow-x: auto;
  /* Room for the scrollbar, which phones draw over the content rather than beside it. */
  padding-bottom: 0.75rem;

  & table {
    border-collapse: collapse;
    min-width: 100%;
  }

  & caption {
    margin-bottom: 0.5rem;
    color: var(--muted-text-color);
    text-align: left;
  }

  /* Wide enough for a short value ("10 mA") on one line: a wide table scrolls rather than squeezes its columns. */
  & th,
  & td {
    min-width: 10ch;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
  }

  & th {
    font-family: Hack, monospace;
    color: var(--light-text-color);
    background-color: var(--placeholder-bg-color);
  }
}

/* -------------- Collapsible sections (blocks/collapsible_block.html): a <details>, its title opening it -------------- */

.collapsible {
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

.collapsible__title {
  padding: 1rem;
  cursor: pointer;
  font-weight: bold;

  &:hover,
  &:focus-visible {
    color: var(--link-color);
  }
}

.collapsible[open] > .collapsible__title {
  border-bottom: 1px solid var(--border-color);
  color: var(--link-color);
}

.collapsible__content {
  padding: 1rem;

  & > :first-child {
    margin-top: 0;
  }

  & > :last-child {
    margin-bottom: 0;
  }
}

/* -------------- Page links (blocks/page_link_block.html), as documents' (hosted-file.css) -------------- */

.page-link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0;
}

.page-link-card:hover {
  background-color: var(--hover-surface-color);
}

.page-link-card:has(.page-link-card__link:focus-visible) {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

/* The title's link covers the card, so all of it opens the page. */
.page-link-card__link {
  color: inherit;
  text-decoration: none;
}

.page-link-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.page-link-card__link:focus-visible {
  outline: none;
}

.page-link-card--unavailable,
.page-link-card--unavailable:hover {
  background-color: transparent;
  border-style: dashed;
  opacity: 0.7;
}

.page-link-card__image {
  flex: none;
  width: 80px;
  height: 80px;
  border-radius: 0;
  object-fit: cover;
}

.page-link-card__image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--placeholder-bg-color);
  font-size: 1.5rem;
}

.page-link-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.page-link-card__title {
  font-weight: 600;
}

.page-link-card__summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-link-card__meta {
  color: var(--muted-text-color);
  font-size: 0.85rem;
}

.page-link-card__tag {
  margin-left: 0.5rem;
}

/* -------------- Terminal look: headings, frames, noise -------------- */

/*
 * The big headings in polished metal (Bungee's letters, the gradient clipped to them, a line at a time), but for the
 * small ones over cards and tiles, which the gradient would blur; and content's smaller ones, as its H2s.
 */
:is(h1, h2):not(.page-card__title, .microblog-page-card__caption, .microblog-post__caption, .listing__group-title),
main :is(h3, h4)[id^="s-"] {
  font-family: Bungee, Hack, monospace;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--light-text-color);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  :is(h1, h2):not(.page-card__title, .microblog-page-card__caption, .microblog-post__caption, .listing__group-title),
  main :is(h3, h4)[id^="s-"] {
    background-image: var(--chrome-gradient);
    background-size: 100% 1lh;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(1px 1px 0 #000);
  }
}

/* The page's title (blog posts, projects, listings, contact, custom and share pages): a prompt before it, a lit bar under it. */
main h1:not(.microblog-post__caption, .visually-hidden, .hero h1)::before {
  content: "> " / "";
  font-family: Hack, monospace;
  color: var(--link-color);
}

main h1:not(.microblog-post__caption, .visually-hidden, .hero h1)::after {
  content: "";
  display: block;
  width: 4rem;
  height: 2px;
  margin-top: 0.4rem;
  background-color: var(--accent-dim);
}

/*
 * Content's headings (blocks/content_block.py's ContentRichTextBlock, anchored #s-...): "##", "###" or "####" before
 * them, as in Markdown; their link (a chain) after them, then a dashed rule to the edge.
 */
main :is(h2, h3, h4)[id^="s-"] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

main :is(h2, h3, h4)[id^="s-"]::before {
  font-family: Hack, monospace;
  color: var(--link-color);
}

main h2[id^="s-"]::before {
  content: "##" / "";
}

main h3[id^="s-"]::before {
  content: "###" / "";
}

main h4[id^="s-"]::before {
  content: "####" / "";
}

main :is(h2, h3, h4)[id^="s-"]::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--border-color);
}

/* Its own color, not the gradient its heading's text is clipped to: */
.heading-link {
  font-size: 0.5em;
  color: var(--muted-text-color);
}

.heading-link:hover,
.heading-link:focus-visible {
  color: var(--link-color);
}

.home-section__title::before {
  content: "$ " / "";
  font-family: Hack, monospace;
  color: var(--link-color);
}

/* The hero's heading, after a prompt as the pages' titles are. */
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4.5vw, 3rem);

  &::before {
    content: "> " / "";
    font-family: Hack, monospace;
    color: var(--link-color);
  }
}

.listing__search input,
.navmenu__search input {
  caret-color: var(--link-color);
}

.navmenu__search::before {
  content: ">" / "";
  position: absolute;
  top: 50%;
  left: 0.6rem;
  color: var(--link-color);
  transform: translateY(-50%);
  pointer-events: none;
}

.navmenu__search input {
  padding-left: 1.6rem;
}

.listing__search input:focus,
.navmenu__search input:focus {
  border-color: var(--link-color);
  outline: none;
  box-shadow: 0 0 8px var(--accent-dim);
}

/* Faint scanlines over the whole screen, taking no clicks. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.25) 2px,
    rgba(0, 0, 0, 0.25) 3px
  );
  opacity: 0.35;
  pointer-events: none;
}

/* Not over what's shared (share pages, content_page.html): seen as it was uploaded. */
body.as-uploaded::before {
  content: none;
}

/*
 * Frames (blocks/media_items_block.html, audio_block.html): a terminal window around images, videos, stories and
 * audio, its title bar a line of text, its label from data-frame-label, three square "buttons" at its right.
 */
.frame {
  --frame-bar-height: 1.75rem;
  --frame-button-color: var(--muted-text-color);

  position: relative;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  background-color: var(--placeholder-bg-color);
}

.frame::before {
  content: "\2500[ " attr(data-frame-label) " ]" / "";
  display: block;
  height: var(--frame-bar-height);
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background:
    linear-gradient(var(--frame-button-color) 0 0) right 0.75rem center / 8px 8px no-repeat,
    linear-gradient(var(--frame-button-color) 0 0) right calc(0.75rem + 14px) center / 8px 8px no-repeat,
    linear-gradient(var(--frame-button-color) 0 0) right calc(0.75rem + 28px) center / 8px 8px no-repeat,
    #0d140d;
  color: var(--muted-text-color);
  font-size: 0.75rem;
  line-height: var(--frame-bar-height);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.frame:hover,
.frame:focus-within {
  --frame-button-color: var(--link-color);

  border-color: var(--accent-dim);
}

.frame:hover::before,
.frame:focus-within::before {
  color: var(--link-color);
}

/* In a frame, its edges and space around are the frame's. */
.frame .media-item,
.frame .hosted-file,
.frame .hosted-file-video,
.frame .hosted-file-embed {
  margin: 0;
  border: 0;
}

/* Off the bar and the frame's bottom edge. */
.frame .media-item {
  padding: 0.75rem 0;
}

/* Audio's player off the frame's edges, as pictures are off its bar and bottom. */
.frame .hosted-file__audio {
  width: calc(100% - 1.5rem);
  margin: 0.75rem;
}

/* Untitled (no data-frame-label): a bar with only its squares. */
.frame:not([data-frame-label])::before {
  content: "";
}

/* The bars of pastes and hosted files (paste.css, hosted-file.css), as a frame's. */
.paste__toolbar,
.hosted-file__bar {
  background-color: #0d140d;
}

/* -------------- Noise and lit edges -------------- */

.home-section,
.toc {
  position: relative;
}

.page-card:hover,
.page-link-card:hover,
.microblog-page-card:hover {
  border-color: var(--accent-dim);
}

.page-card:hover .page-card__title {
  color: var(--link-color);
}

/* A faint grain of white noise over cards, panels, the hero and frames' bars; a burst of static on hover. */
.page-card::after,
.home-section::after,
.page-link-card::after,
.toc::after,
.microblog-page-card::after,
.hero::after,
.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background-image: var(--noise);
  opacity: 0.03;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Over the bar only: not over a video as it plays. */
.frame::after {
  bottom: auto;
  height: var(--frame-bar-height);
}

.page-card:hover::after,
.page-link-card:hover::after,
.microblog-page-card:hover::after,
.frame:hover::after {
  animation: static-hover 0.4s steps(1);
}

@keyframes static-hover {
  0% {
    opacity: 0.2;
    background-position: 13px 41px;
  }

  33% {
    opacity: 0.12;
    background-position: -29px 7px;
  }

  66% {
    opacity: 0.18;
    background-position: 47px -31px;
  }

  100% {
    opacity: 0.03;
  }
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

/* No flicker or blinking for those who asked for less motion (sped up to a flicker by the rule at the top otherwise). */
@media (prefers-reduced-motion: reduce) {
  .page-card::after,
  .page-link-card::after,
  .microblog-page-card::after,
  .frame::after,
  .header__logo-text::after {
    animation: none !important;
  }
}
