/* Insula — the city itself: the night scene, the miliarium, frescoes, tabernae, the bronze automata,
   the album of public notices, wax tablets, and the overlays of the 3D city. */

/* ---------- hero: the insula in the afternoon sun, the inscription floating over the open sky ---------- */

.cityhero {
  position: relative;
  height: clamp(640px, 90vh, 860px);
  margin: -8px calc(50% - 50vw) 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 45% 55% at 78% 18%, rgba(255, 236, 190, 0.95), transparent 70%),
    linear-gradient(180deg, #f7f0e2 0%, #f1e4ca 55%, #e8d4ae 100%);
  border-bottom: 1px solid var(--line);
}

.sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.sun {
  position: absolute;
  top: 10%;
  right: 22%;
  width: clamp(56px, 7vw, 96px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fff8e2, #f4d995 60%, #e2b866);
  box-shadow: 0 0 60px rgba(244, 217, 149, 0.85), 0 0 160px rgba(226, 184, 102, 0.5);
}

.cloud {
  position: absolute;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.85);
  filter: blur(1px);
  box-shadow: 40px -10px 0 6px rgba(255, 252, 244, 0.8), 90px 2px 0 -2px rgba(255, 252, 244, 0.75);
  animation: drift linear infinite;
}

.cloud--a {
  top: 14%;
  width: 120px;
  animation-duration: 90s;
  animation-delay: -30s;
}

.cloud--b {
  top: 26%;
  width: 90px;
  opacity: 0.7;
  animation-duration: 130s;
  animation-delay: -80s;
}

@keyframes drift {
  from {
    left: -20%;
  }
  to {
    left: 110%;
  }
}

.birds {
  position: absolute;
  top: 20%;
  left: -8%;
  display: flex;
  gap: 10px;
  animation: fly 34s linear infinite;
  animation-delay: -6s;
}

.birds i {
  width: 16px;
  height: 7px;
  border: 2px solid #5c5245;
  border-bottom: 0;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  animation: flap 0.6s ease-in-out infinite alternate;
}

.birds i:nth-child(2) {
  translate: 0 -8px;
  animation-delay: 0.2s;
}

.birds i:nth-child(3) {
  translate: 0 5px;
  animation-delay: 0.35s;
}

@keyframes fly {
  0% {
    left: -8%;
    top: 24%;
  }
  70%,
  100% {
    left: 108%;
    top: 8%;
  }
}

@keyframes flap {
  to {
    scale: 1 0.4;
  }
}

.scene {
  position: absolute;
  inset: auto 0 0;
  height: 62%;
}

.scene svg {
  display: block;
  width: 100%;
  height: 100%;
}

.scene .lamp-flicker {
  animation: lamp 4s steps(1) infinite;
}

@keyframes lamp {
  0%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 0.7;
  }
  44% {
    opacity: 0.2;
  }
}

.street {
  position: absolute;
  inset: auto 0 0;
  height: 12px;
  background: repeating-linear-gradient(90deg, #6b6457 0 38px, #574f43 38px 40px);
}

/* the inscription and the milestone, laid over the scene */
.sidewalk {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(0, 1fr);
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px var(--gutter) 90px;
}

.plaque {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 18px;
  padding: clamp(24px, 3.2vw, 40px) clamp(24px, 3.6vw, 44px);
  border: 1px solid var(--aurum);
  background: rgba(251, 248, 242, 0.86);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 6px rgba(251, 248, 242, 0.9), inset 0 0 0 7px rgba(201, 163, 90, 0.55), 0 30px 60px -30px rgba(60, 40, 14, 0.55);
  animation: rise 700ms var(--soft) both;
}

.plaque::before,
.plaque::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 22px;
  height: 46px;
  translate: 0 -50%;
  background: var(--aurum);
}

.plaque::before {
  left: -22px;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.plaque::after {
  right: -22px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.plaque h1 {
  color: var(--nox);
  font-size: clamp(2.4rem, 5vw, 4.4rem);
}

/* the second half of the headline in a painter's gold italic */
.plaque h1 em {
  display: block;
  margin-top: 6px;
  color: var(--aurum-ink);
  font: italic 600 1.02em/1 var(--font-latin);
  letter-spacing: 0;
  text-transform: none;
}

.plaque .latin {
  color: var(--aurum-ink);
  font-size: 1.35rem;
}

.lede {
  max-width: 54ch;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* a marble milestone standing on the street, carved with the page's parts */
.miliarium {
  position: absolute;
  right: max(var(--gutter), calc((100vw - 1280px) / 2 + var(--gutter)));
  bottom: 12px;
  display: grid;
  width: 250px;
  padding: 0 16px 14px;
  border-radius: 46% 46% 4px 4px / 22px 22px 4px 4px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 18%, transparent 70%, rgba(0, 0, 0, 0.24)),
    linear-gradient(180deg, #ece3d3, #f6f0e4 30%, #d8cdb9);
  color: #2a241b;
  box-shadow: 0 24px 40px -24px rgba(40, 28, 12, 0.6);
}

.miliarium-cap {
  padding: 20px 0 10px;
  border-bottom: 2px solid rgba(42, 36, 27, 0.2);
  text-align: center;
  font: 400 1.1rem/1 var(--font-carve);
  letter-spacing: 0.32em;
  color: #6b4f22;
}

.mile {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr);
  grid-template-areas: 'n name' 'n what';
  align-items: center;
  column-gap: 6px;
  min-height: 50px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px solid rgba(42, 36, 27, 0.15);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 160ms;
}

.mile:hover {
  background: rgba(201, 163, 90, 0.2);
}

.mile b {
  grid-area: n;
  font: 400 1.35rem/1 var(--font-carve);
  color: #7c5a1e;
}

.mile span {
  grid-area: name;
  font: 400 0.98rem/1.1 var(--font-carve);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mile small {
  grid-area: what;
  color: #5c5245;
  font-size: 0.8rem;
}

.miliarium-base {
  position: absolute;
  left: -10px;
  right: -10px;
  bottom: -12px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, #c9bea9, #a39883);
}

/* ---------- the frieze of providers ---------- */

.frieze {
  position: relative;
  margin: 0 calc(50% - 50vw);
  padding: 18px 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  /* a band of tesserae above and below */
  background:
    repeating-linear-gradient(90deg, #b5583a 0 8px, #efe7d8 8px 10px, #2b2116 10px 18px, #efe7d8 18px 20px) top / 100% 6px no-repeat,
    repeating-linear-gradient(90deg, #2b2116 0 8px, #efe7d8 8px 10px, #c9a35a 10px 18px, #efe7d8 18px 20px) bottom / 100% 6px no-repeat,
    var(--surface);
  -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.frieze--empty {
  height: 74px;
}

.frieze-track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: procession 60s linear infinite;
}

.frieze:hover .frieze-track {
  animation-play-state: paused;
}

@keyframes procession {
  to {
    transform: translateX(-50%);
  }
}

.frieze-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  white-space: nowrap;
}

.frieze-item b {
  font: 400 1rem/1 var(--font-carve);
  letter-spacing: 0.06em;
}

.frieze-item small {
  color: var(--ink-faint);
  font: 500 0.75rem/1 var(--font-mono);
}

@media (max-width: 960px) {
  .cityhero {
    height: auto;
  }

  .scene {
    position: relative;
    height: 300px;
  }

  .sidewalk {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    padding: 24px var(--gutter) 40px;
  }

  .miliarium {
    position: relative;
    right: auto;
    bottom: auto;
    justify-self: center;
    width: min(100%, 320px);
  }

  .plaque::before,
  .plaque::after {
    display: none;
  }
}

/* ---------- chapters, numbered on plaques ---------- */


.chapter {
  margin-top: clamp(96px, 13vw, 160px);
  scroll-margin-top: 84px;
}

.chapter-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(14px, 3vw, 30px);
  max-width: 960px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.chapter-head > div {
  display: grid;
  gap: 10px;
}

.chapter-head .muted {
  max-width: 62ch;
}

/* a square stone plaque with a gold numeral */
.plate {
  display: grid;
  place-items: center;
  width: clamp(70px, 8vw, 96px);
  aspect-ratio: 1;
  border: 1px solid var(--aurum);
  background: linear-gradient(160deg, #fdfbf7, #efe7d8);
  box-shadow: inset 0 0 0 5px #fbf8f2, inset 0 0 0 6px rgba(201, 163, 90, 0.55);
  color: var(--aurum-ink);
  font: 400 clamp(1.8rem, 3.4vw, 2.6rem) / 1 var(--font-carve);
}

/* ---------- I. Forum: three panels of a Pompeian wall ---------- */

.wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 18px;
  border: 1px solid var(--line);
  background: #2b241b;
  box-shadow: var(--shadow);
}

/* Fourth Style: a field of colour, a thin gold frame inside it, and a black dado underneath */
.fresco {
  --field: #5c2416;
  --text: var(--marmor);
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 100%;
  padding: 30px 26px 66px;
  background:
    linear-gradient(180deg, transparent calc(100% - 44px), #0b0a08 calc(100% - 44px)),
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(255, 255, 255, 0.05), transparent 70%),
    var(--field);
  color: var(--text);
  box-shadow: inset 0 0 0 12px var(--field), inset 0 0 0 13px rgba(201, 163, 90, 0.55);
}

.fresco + .fresco {
  border-left: 10px solid #0b0a08;
}

.fresco--ochre {
  --field: #8a6a2e;
  --text: #17130b;
}

.fresco--black {
  --field: #18150f;
}

.fresco-n {
  font: 400 2.4rem/1 var(--font-carve);
  color: var(--aurum);
}

.fresco--ochre .fresco-n {
  color: #2a1e0a;
}

.fresco-head {
  font: 400 clamp(1.5rem, 2.4vw, 2rem) / 1.1 var(--font-carve);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fresco p {
  font-size: 0.98rem;
  line-height: 1.55;
  opacity: 0.92;
}

.fresco-foot {
  position: absolute;
  left: 26px;
  bottom: 14px;
  color: var(--aurum);
  font: 500 0.74rem/1.3 var(--font-mono);
}

/* the diff, on a scrap of papyrus */
.scroll {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 90, 40, 0.08) 0 1px, transparent 1px 7px),
    #e9dcbc;
  color: #2a1f12;
}

.scroll code {
  position: relative;
  display: block;
  padding: 5px 8px 5px 22px;
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.scroll code::before {
  position: absolute;
  left: 7px;
  font-weight: 700;
}

.scroll .del {
  color: #7a3a24;
  text-decoration: line-through rgba(181, 88, 58, 0.7) 2px;
}

.scroll .del::before {
  content: '−';
}

.scroll .add {
  background: rgba(127, 163, 107, 0.25);
  font-weight: 600;
}

.scroll .add::before {
  content: '+';
}

/* struck-out words, painted */
.nopes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nopes span {
  padding: 5px 10px 3px;
  border: 2px solid currentColor;
  font: 400 0.95rem/1 var(--font-carve);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: line-through 2px;
}

.nopes span:nth-child(2) {
  rotate: -2deg;
}

.slip {
  display: grid;
  gap: 7px;
  padding: 14px 14px 16px;
  border: 1px solid rgba(201, 163, 90, 0.35);
  background: #0f0d0a;
  font-family: var(--font-mono);
}

.slip-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.74rem;
}

.slip-back {
  margin: 2px -6px 0;
  padding: 5px 6px;
  background: rgba(127, 163, 107, 0.18);
  color: #cfe0c3;
  font-weight: 600;
}

.slip-foot {
  text-align: center;
  color: var(--saxum);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- II. Tabernae: the ground floor of the insula ---------- */

.agent-st {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.agent-st-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 36px;
}

.shop {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  padding-bottom: 28px;
}

/* basalt paving in front of each shop, with the kerb */
.shop::after {
  content: '';
  position: absolute;
  inset: 350px 0 0;
  z-index: -1;
  border-bottom: 10px solid #b9ab93;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.03) 0 22%, transparent 23%) 0 0 / 52px 40px,
    radial-gradient(circle at 70% 60%, rgba(0, 0, 0, 0.35) 0 2px, transparent 3px) 0 0 / 26px 20px,
    #5c564b;
}

.shop-face {
  position: relative;
  display: block;
  width: 100%;
  height: 350px;
  padding: 0;
  border: 0;
  border-left: 8px solid #b9ab93;
  background:
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(90, 60, 20, 0.08) 30px 31px),
    linear-gradient(180deg, #ece0c8, #dfcfb0);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: filter 300ms, box-shadow 300ms;
}

.shop:last-child .shop-face {
  border-right: 8px solid #b9ab93;
}

/* the floor above: a shuttered window and the wooden balcony (pergula) */
.shop-upper {
  position: absolute;
  inset: 0 0 auto;
  height: 104px;
  border-bottom: 4px solid #b9ab93;
}

.shop-upper .shutter {
  position: absolute;
  top: 24px;
  width: 22px;
  height: 46px;
  background: repeating-linear-gradient(0deg, #8a9a6a 0 5px, #6f7f54 5px 7px);
}

.shop-upper .shutter:nth-child(1) {
  left: calc(50% - 44px);
}

.shop-upper .shutter:nth-child(2) {
  left: calc(50% + 22px);
}

/* the lit window between the shutters */
.shop-upper::before {
  content: '';
  position: absolute;
  top: 24px;
  left: calc(50% - 22px);
  width: 44px;
  height: 46px;
  background: #2b2116;
  opacity: 1;
}

.shop-upper .pergula {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8px;
  height: 18px;
  border-top: 4px solid #6b4a26;
  border-bottom: 4px solid #6b4a26;
  background: repeating-linear-gradient(90deg, #6b4a26 0 3px, transparent 3px 14px);
}

/* the shop's name, painted in terracotta on a whitewashed band (a dipinto) */
.shop-sign {
  position: absolute;
  top: 116px;
  left: 50%;
  translate: -50% 0;
  padding: 7px 16px 5px;
  border: 1px solid #c9bda8;
  background: linear-gradient(180deg, #fdfbf7, #f1e9da);
  box-shadow: 0 6px 12px -8px rgba(40, 28, 12, 0.5);
  white-space: nowrap;
}

.neon {
  display: block;
  color: #8e3a22;
  font: 400 clamp(1rem, 1.6vw, 1.3rem) / 1 var(--font-carve);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* the arched opening of the taberna */
.shop-arch {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 166px;
  bottom: 0;
  overflow: hidden;
  border: 8px solid #cfc4b1;
  border-bottom: 0;
  border-radius: 50% 50% 0 0 / 34% 34% 0 0;
  background: #1b140c;
  box-shadow: inset 0 0 0 2px #a99c86;
}

.shop-window {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 55%, rgba(217, 182, 110, 0.55), transparent 75%),
    linear-gradient(180deg, #2a1f13, #17110a);
  transition: filter 400ms;
}

/* a shelf of amphorae on the back wall */
.shop-shelf {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 30%;
  display: flex;
  justify-content: space-around;
  padding-bottom: 3px;
  border-bottom: 3px solid #4a3220;
}

.shop-shelf i {
  width: 10px;
  height: 22px;
  border-radius: 40% 40% 46% 46% / 26% 26% 70% 70%;
  background: linear-gradient(90deg, #6e3320, var(--terracotta) 50%, #5d2a1a);
}

.shop-window .bot {
  position: absolute;
  left: 50%;
  bottom: 30px;
  z-index: 1;
  translate: -50% 0;
  --bs: 8px;
}

/* the masonry counter with two jars set into it */
.shop-desk {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  height: 36px;
  padding-top: 7px;
  border-top: 4px solid #8f877a;
  background: linear-gradient(180deg, #5b5446, #3f392f);
}

.shop-desk i {
  width: 22px;
  height: 9px;
  border-radius: 50%;
  background: #120f0b;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 0 3px #6e3320;
}

.shop--busy .shop-window {
  animation: hearth 2.4s ease-in-out infinite alternate;
}

@keyframes hearth {
  to {
    filter: brightness(1.25) saturate(1.1);
  }
}

/* the shop's numeral, cut into the keystone */
.shop-no {
  position: absolute;
  top: 156px;
  left: 50%;
  z-index: 1;
  translate: -50% 0;
  min-width: 34px;
  padding: 4px 6px 2px;
  border: 1px solid var(--aurum);
  background: #fbf8f2;
  color: var(--aurum-ink);
  font: 400 0.82rem/1 var(--font-carve);
  text-align: center;
}

/* a painted wooden board outside the door */
.aframe {
  position: relative;
  display: grid;
  gap: 6px;
  width: min(86%, 300px);
  margin-top: 24px;
  padding: 14px 18px;
  border: 1px solid var(--aurum-dark);
  border-radius: 2px;
  background: linear-gradient(180deg, #2b2116, #1f180f);
  color: var(--marmor);
  --ink-faint: #b9b0a1;
  --ink-soft: #d9d0c0;
  --aurum-ink: var(--aurum);
  box-shadow: 0 14px 18px -10px #000;
}

.aframe::before,
.aframe::after {
  content: '';
  position: absolute;
  bottom: -24px;
  width: 5px;
  height: 22px;
  background: #3a2a18;
}

.aframe::before {
  left: 16%;
}

.aframe::after {
  right: 16%;
}

.aframe-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-faint);
  font: 600 0.8rem/1.2 var(--font-body);
}

/* an oil lamp: lit when the shop is open */
.aframe-status i {
  width: 9px;
  height: 9px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

.shop--busy .aframe-status i {
  background: var(--aurum);
  box-shadow: 0 0 10px var(--aurum);
  animation: blink 1.2s steps(2) infinite;
}

.shop--unknown .aframe-status i {
  background: var(--saxum);
  box-shadow: none;
}

.aframe-name {
  font: 400 1.2rem/1.15 var(--font-carve);
  letter-spacing: 0.04em;
}

.aframe-name small {
  color: var(--ink-faint);
  font: 600 0.82rem/1 var(--font-body);
  letter-spacing: 0;
}

.aframe-craft {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.aframe-go {
  color: var(--aurum);
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.92rem;
  text-decoration: none;
}

.shop-face:hover .shop-window,
.shop-face:focus-visible .shop-window {
  filter: brightness(1.2);
}

.agent-st--hood .shop:not(.is-selected) .shop-face {
  filter: saturate(0.55) opacity(0.75);
}

.agent-st--hood .shop.is-selected .shop-face {
  box-shadow: inset 0 0 0 2px var(--aurum), 0 0 40px -14px var(--aurum);
}

/* ---------- the bronze automata ---------- */

.bot {
  --bs: 9px;
  position: relative;
  width: 10em;
  height: 12em;
  font-size: var(--bs);
}

.bot--big {
  --bs: 15px;
}

/* the bust: shoulders and drapery */
.bot-body {
  position: absolute;
  left: 1em;
  bottom: 0;
  width: 8em;
  height: 4.4em;
  border-radius: 3.2em 3.2em 0.4em 0.4em;
  background: #6b5d48;
}

/* a bronze head with a riveted seam, eyes lit like lamps */
.bot-head {
  position: absolute;
  left: 1.5em;
  bottom: 3.7em;
  z-index: 1;
  width: 7em;
  height: 6.2em;
  border-radius: 2.4em 2.4em 2em 2em;
  background: linear-gradient(150deg, #e2c27a, #b58a3e 45%, #7a5a26);
  box-shadow: inset -0.4em -0.5em 0.9em rgba(40, 24, 6, 0.45), inset 0.3em 0.3em 0.6em rgba(255, 240, 200, 0.35);
  animation: bot-idle 7s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -2.3s);
  transform-origin: 50% 100%;
}

/* the face plate */
.bot-head::before {
  content: '';
  position: absolute;
  inset: 1.5em 1em 1em;
  border-radius: 1.2em 1.2em 1.6em 1.6em;
  background: linear-gradient(180deg, #2a1f10, #3b2c15);
}

/* rivets along the crown */
.bot-head::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0.45em;
  width: 0.45em;
  height: 0.45em;
  translate: -50% 0;
  border-radius: 50%;
  background: #f0d48c;
  box-shadow: -1.4em 0.3em 0 #f0d48c, 1.4em 0.3em 0 #f0d48c;
}

@keyframes bot-idle {
  50% {
    transform: rotate(-2.5deg) translateY(-0.15em);
  }
}

.bot-eye {
  position: absolute;
  top: 2.7em;
  z-index: 1;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d6, var(--aurum-hover) 60%);
  box-shadow: 0 0 0.6em var(--aurum-hover), 0 0 1.3em rgba(217, 182, 110, 0.7);
  animation: bot-blink 6s infinite;
}

.bot-eye--l {
  left: 1.9em;
}

.bot-eye--r {
  right: 1.9em;
}

@keyframes bot-blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  97% {
    transform: scaleY(0.1);
  }
}

.bot-mouth {
  position: absolute;
  left: 50%;
  bottom: 1.7em;
  z-index: 1;
  width: 2em;
  height: 0.3em;
  translate: -50% 0;
  border-radius: 0.2em;
  background: var(--aurum-hover);
  opacity: 0.8;
}

.bot-hat,
.bot-prop {
  position: absolute;
  z-index: 2;
}

/* Cato: a senator's toga with the broad purple stripe, a scroll in hand, a stern brow */
.bot--cato .bot-body {
  background:
    linear-gradient(115deg, transparent 0 42%, #5b2a5f 42% 52%, transparent 52%),
    linear-gradient(90deg, #cfc6b5, var(--marmor) 50%, #bdb3a0);
}

.bot--cato .bot-hat {
  left: 2.6em;
  bottom: 8.35em;
  width: 4.8em;
  height: 0.4em;
  border-radius: 0.2em;
  background: #3b2c15;
  box-shadow: 0 0 0 0.05em rgba(0, 0, 0, 0.2);
  rotate: -4deg;
}

.bot--cato .bot-prop {
  right: -0.6em;
  bottom: 1.4em;
  width: 3.6em;
  height: 1.3em;
  border-radius: 0.65em;
  background: linear-gradient(180deg, #f1e4c2, #c9b48a);
  rotate: -28deg;
}

.bot--cato .bot-prop::before,
.bot--cato .bot-prop::after {
  content: '';
  position: absolute;
  top: -0.2em;
  width: 0.5em;
  height: 1.7em;
  border-radius: 0.2em;
  background: #6b4a26;
}

.bot--cato .bot-prop::before {
  left: -0.3em;
}

.bot--cato .bot-prop::after {
  right: -0.3em;
}

/* Ovid: a red tunic, a laurel wreath, stylus and wax tablet */
.bot--ovid .bot-body {
  background: linear-gradient(90deg, #7e3a24, var(--terracotta) 50%, #6e3320);
}

.bot--ovid .bot-hat {
  left: 1.1em;
  bottom: 8.6em;
  width: 7.8em;
  height: 1.4em;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background:
    radial-gradient(ellipse 0.55em 0.9em at 12% 70%, #6f8a3c 98%, transparent) ,
    radial-gradient(ellipse 0.55em 0.9em at 28% 40%, #7f9a48 98%, transparent),
    radial-gradient(ellipse 0.55em 0.9em at 44% 25%, #6f8a3c 98%, transparent),
    radial-gradient(ellipse 0.55em 0.9em at 60% 25%, #7f9a48 98%, transparent),
    radial-gradient(ellipse 0.55em 0.9em at 76% 40%, #6f8a3c 98%, transparent),
    radial-gradient(ellipse 0.55em 0.9em at 90% 70%, #7f9a48 98%, transparent);
}

.bot--ovid .bot-prop {
  right: -0.4em;
  bottom: 1.2em;
  width: 2.8em;
  height: 3.4em;
  border: 0.35em solid #6b4a26;
  border-radius: 0.2em;
  background: #1a140c;
  rotate: 10deg;
}

.bot--ovid .bot-prop::after {
  content: '';
  position: absolute;
  left: 0.3em;
  top: -1.6em;
  width: 0.3em;
  height: 3em;
  border-radius: 0.15em;
  background: linear-gradient(180deg, #d9b66e, #8a6a2e);
  rotate: 24deg;
}

/* Vitruvius: a felt pileus, a leather apron, dividers */
.bot--vitruvius .bot-body {
  background:
    linear-gradient(90deg, transparent 0 30%, #5a3a1e 30% 70%, transparent 70%),
    linear-gradient(90deg, #5e5440, #7a6d55 50%, #574d3a);
}

.bot--vitruvius .bot-hat {
  left: 2.2em;
  bottom: 8.2em;
  width: 5.6em;
  height: 3em;
  border-radius: 50% 50% 0.6em 0.6em / 90% 90% 0.6em 0.6em;
  background: linear-gradient(90deg, #7a5f34, #9b7a43 50%, #6d542c);
}

.bot--vitruvius .bot-prop {
  right: 0;
  bottom: 1.2em;
  width: 3em;
  height: 4em;
}

.bot--vitruvius .bot-prop::before,
.bot--vitruvius .bot-prop::after {
  content: '';
  position: absolute;
  top: 0.4em;
  left: 50%;
  width: 0.35em;
  height: 3.6em;
  border-radius: 0.2em;
  background: linear-gradient(180deg, #ecd496, #9e7e40);
  transform-origin: 50% 0;
}

.bot--vitruvius .bot-prop::before {
  rotate: 18deg;
}

.bot--vitruvius .bot-prop::after {
  rotate: -18deg;
}

/* ---------- III. Acta Diurna: the whitewashed album ---------- */

.board {
  display: grid;
  gap: 2px;
  max-width: 900px;
  padding: clamp(18px, 3vw, 30px) clamp(18px, 3.4vw, 36px);
}

.board.album {
  border: 10px solid #2b2116;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.4), transparent 60%),
    linear-gradient(180deg, #ece4d3, #ddd2bc);
  color: #241a10;
  box-shadow: 0 30px 60px -34px rgba(40, 28, 12, 0.55), inset 0 0 30px rgba(120, 90, 50, 0.18);
}

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 3px double rgba(36, 26, 16, 0.4);
  font: 400 1.4rem/1 var(--font-carve);
  letter-spacing: 0.24em;
  color: #8e3a22;
}

.board-clock {
  color: #4a3a28;
  font: italic 500 1rem/1 var(--font-latin);
  letter-spacing: 0;
}

.board-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(36, 26, 16, 0.14);
}

.board-label {
  font: 400 0.98rem/1.2 var(--font-carve);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.board-value {
  color: #8e3a22;
  font: 700 1.3rem/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.numeral {
  color: #6b5a44;
  font: 400 0.8rem/1 var(--font-carve);
  letter-spacing: 0.08em;
}

.board-wait {
  padding: 22px 0;
  color: #5c4c38;
  font: italic 500 1.1rem/1 var(--font-latin);
}

.board-foot {
  padding-top: 12px;
  color: #6b5a44;
  font: 500 0.72rem/1 var(--font-mono);
}

.city-foot {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: clamp(96px, 12vw, 150px);
  text-align: center;
}

.foot-plaque {
  padding: 10px 26px 8px;
  border: 1px solid var(--aurum);
  color: var(--aurum-ink);
  font: 400 1rem/1 var(--font-carve);
  letter-spacing: 0.3em;
  box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 5px rgba(201, 163, 90, 0.5);
}

.city-foot p {
  color: var(--ink-faint);
  font-size: 0.9rem;
}

/* ---------- Tabernae page ---------- */

.hood-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: clamp(20px, 5vw, 60px);
  margin: 18px 0 clamp(32px, 5vw, 48px);
}

.hood-intro {
  display: grid;
  gap: 14px;
}

/* a street inscription on a column */
.corner-sign {
  position: relative;
  width: 200px;
  height: 230px;
}

.corner-pole {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 46px;
  height: 100%;
  translate: -50% 0;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 3px, transparent 3px 9px),
    linear-gradient(90deg, #b9b0a1, var(--marmor) 50%, #a9a091);
}

.corner-plate {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  padding: 9px 16px 7px;
  border: 1px solid var(--aurum);
  background: #fbf8f2;
  color: var(--aurum-ink);
  font: 400 1rem/1 var(--font-carve);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: inset 0 0 0 3px #fbf8f2, inset 0 0 0 4px rgba(201, 163, 90, 0.5), 0 10px 18px -10px rgba(40, 28, 12, 0.5);
}

.corner-plate--a {
  top: 20px;
}

.corner-plate--b {
  top: 74px;
  font-size: 0.74rem;
  color: var(--nox);
}

.street-ticker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-soft);
  font: italic 500 1.02rem/1.3 var(--font-latin);
}

.ticker-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aurum);
  animation: blink 1.6s steps(2) infinite;
}

.workshop {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3vw, 32px);
  margin-top: clamp(40px, 6vw, 64px);
  scroll-margin-top: 84px;
}

.tenant {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 22px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--surface);
  box-shadow: var(--shadow), var(--frame);
}

/* the automaton framed in its niche, like a portrait bust */
.tenant-window {
  position: relative;
  display: grid;
  place-items: end center;
  align-self: start;
  aspect-ratio: 0.82;
  overflow: hidden;
  border: 8px solid #6e6656;
  border-bottom-width: 14px;
  border-radius: 50% 50% 2px 2px / 30% 30% 2px 2px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 55%, rgba(217, 182, 110, 0.45), transparent 75%),
    linear-gradient(180deg, #2a1f13, #120d07);
}

.tenant-window .bot {
  --bs: 13px;
}

.tenant-copy {
  display: grid;
  align-content: start;
  gap: 12px;
}

.tenant-name {
  color: var(--nox);
  font-size: clamp(2.6rem, 5.4vw, 3.8rem);
}

.tenant-shop {
  margin-top: -6px;
  color: var(--aurum-ink);
  font: italic 500 1.15rem/1.3 var(--font-latin);
}

.lamp {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font: 600 0.84rem/1 var(--font-body);
}

.lamp i {
  width: 9px;
  height: 9px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--saxum);
}

.lamp--open i {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

.lamp--busy i {
  background: var(--aurum);
  box-shadow: 0 0 8px var(--aurum);
  animation: blink 1.2s steps(2) infinite;
}

.lamp--unknown i {
  animation: blink 900ms steps(2) infinite;
}

.tenant-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tenant-lists h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 700 1rem/1.2 var(--font-body);
}

.tenant-lists div:first-child .icon {
  color: var(--ok);
}

.tenant-lists div:last-child .icon {
  color: var(--terracotta);
}

.tenant-lists ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* The brief is written on a wax tablet: a wooden frame round a field of dark wax, sealed at the bottom. */
.docket {
  --surface-2: #1a150e;
  --line-strong: #4a3a26;
  --ink: var(--marmor);
  --ink-soft: #d9d0c0;
  --ink-faint: #b9b0a1;
  --aurum-ink: var(--aurum);
  color: var(--ink);
  position: relative;
  display: grid;
  gap: 16px;
  padding: 26px clamp(18px, 3vw, 28px) 30px;
  border: 14px solid transparent;
  border-image: linear-gradient(135deg, #6b4a26, #8a6234 40%, #5a3d1f) 1;
  background:
    repeating-linear-gradient(170deg, transparent 0 7px, rgba(0, 0, 0, 0.12) 7px 8px),
    #15110b;
  box-shadow: 0 30px 40px -24px #000;
}

.docket-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #4a3a26;
}

.docket-title {
  color: var(--marmor);
  font: 400 1.5rem/1 var(--font-carve);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.docket-no {
  color: var(--aurum);
  font: 500 0.85rem/1 var(--font-mono);
}

.docket-to {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px dashed #4a3a26;
}

.docket-to span {
  color: var(--ink-faint);
  font: 400 0.72rem/1.3 var(--font-carve);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.docket-to b {
  color: var(--aurum);
  font: italic 600 1.2rem/1.2 var(--font-latin);
}

.docket .input,
.docket .textarea {
  border-color: #3d3020;
  background: #0f0c08;
  font-family: var(--font-body);
}

.docket-budget {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.docket-amount {
  min-width: 4.5ch;
  color: var(--aurum);
  font: 400 1.6rem/1 var(--font-carve);
  text-align: right;
}

.docket-send {
  justify-self: start;
}

/* the wax seal where the barcode used to be */
.docket-barcode {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-top: -8px;
  border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 40% 35%, #c96a48, var(--terracotta) 55%, #7a3520);
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.18), 0 6px 10px -4px #000;
}

.docket-barcode::before {
  content: 'I';
  color: rgba(40, 14, 6, 0.55);
  font: 400 1.6rem/1 var(--font-carve);
}

.docket-fee:empty {
  display: none;
}

/* ---------- your briefs, as tesserae (tokens) ---------- */

.orders {
  margin-top: clamp(48px, 7vw, 88px);
  scroll-margin-top: 84px;
}

.tickets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 14px;
}

.ticket {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 88px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 200ms var(--soft), border-color 200ms;
}

.ticket:hover {
  transform: translateY(-2px);
  border-color: var(--aurum-dark);
}

.ticket-stub {
  align-self: stretch;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  min-width: 72px;
  padding: 0 12px;
  border-right: 1px dashed var(--line-strong);
  background: var(--surface-2);
  color: var(--aurum-ink);
}

.ticket-stub b {
  font: 400 1.5rem/1 var(--font-carve);
}

.ticket-stub span {
  color: var(--ink-faint);
  font: 400 0.68rem/1 var(--font-carve);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ticket--working .ticket-stub,
.ticket--queued .ticket-stub {
  animation: stub-glow 1.6s ease-in-out infinite alternate;
}

@keyframes stub-glow {
  to {
    background: rgba(201, 163, 90, 0.14);
  }
}

.ticket-body {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 16px;
}

.ticket-body b {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.3;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ticket-body small {
  color: var(--ink-faint);
  font-size: 0.82rem;
  font-weight: 600;
}

.ticket-note {
  font-style: italic;
}

/* a status stamped like a seal impression */
.pstamp {
  --c: var(--saxum);
  justify-self: end;
  margin-right: 14px;
  padding: 5px 9px 3px;
  border: 2px solid var(--c);
  border-radius: 3px;
  color: var(--c);
  font: 400 0.72rem/1 var(--font-carve);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  rotate: -6deg;
}

.pstamp--queued {
  --c: #4a6aa8;
}

.pstamp--working {
  --c: var(--aurum-dark);
}

.pstamp--delivered {
  --c: var(--ok);
}

.pstamp--declined,
.pstamp--failed {
  --c: var(--terracotta);
}

.pstamp--cancelled {
  --c: var(--saxum);
}

dialog.clay-dialog:has(.order-dialog) {
  width: 100%;
  max-width: min(94vw, 760px);
}

.order-dialog {
  max-height: 86vh;
  overflow-y: auto;
}

.order-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.order-top .pstamp {
  margin: 0;
  rotate: -3deg;
}

.order-brief summary {
  cursor: pointer;
  font-weight: 700;
}

.order-brief p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  white-space: pre-wrap;
}

.deliverable {
  max-height: 52vh;
  padding: 16px 18px;
  overflow: auto;
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Domus: residency ---------- */

.resident {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

/* a laurel ring that closes when you are a Resident */
.resident-badge {
  display: grid;
  place-items: center;
  width: 108px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px dashed var(--line-strong);
  color: var(--saxum);
  font: 400 0.82rem/1 var(--font-carve);
  letter-spacing: 0.16em;
}

.resident.is-resident .resident-badge {
  border: 3px double var(--aurum);
  color: var(--aurum-ink);
  box-shadow: 0 0 24px rgba(201, 163, 90, 0.25);
}

.resident-copy {
  display: grid;
  gap: 8px;
}

.resident-bar {
  height: 10px;
  padding: 2px;
  border-radius: 999px;
  background: var(--surface-sunk);
}

.resident-bar > i {
  display: block;
  width: var(--p);
  min-width: 6px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--aurum-dark), var(--aurum-hover));
}

/* ---------- Aerarium: paying with ETH or the coin ---------- */

.asset-tabs {
  justify-self: start;
  margin-bottom: 4px;
}

.asset-bonus {
  margin-left: 4px;
  padding: 2px 5px 1px;
  border-radius: 3px;
  background: var(--ok);
  color: #0f1a0a;
  font: 700 0.66rem/1 var(--font-mono);
}

/* ---------- a free taberna in the row ---------- */

.shop--lot .lot-face {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  width: 100%;
  height: 350px;
  border-left: 8px solid #b9ab93;
  background:
    linear-gradient(180deg, transparent 0 104px, #b9ab93 104px 108px, transparent 108px),
    linear-gradient(180deg, #e3d6bd, #d6c6a6);
  color: var(--ink-faint);
  text-align: center;
  text-decoration: none;
}

/* "LOCANTUR" painted in red, the way Pompeii advertised rooms to let */
.lot-sign {
  padding: 8px 16px 6px;
  border: 1px solid #c9bda8;
  background: linear-gradient(180deg, #fdfbf7, #f1e9da);
  color: #8e3a22;
  font: 400 1.3rem/1 var(--font-carve);
  letter-spacing: 0.16em;
  box-shadow: 0 6px 12px -6px #000;
}

.lot-copy {
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ---------- Locatio: renting a taberna ---------- */

.rent-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.rent-steps li {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 16px 18px 16px 56px;
  border: 1px solid var(--line);
  background: var(--surface);
  counter-increment: step;
}

.rent-steps li:first-child {
  border-radius: var(--r) 0 0 var(--r);
}

.rent-steps li:last-child {
  border-radius: 0 var(--r) var(--r) 0;
}

.rent-steps li::before {
  content: counter(step, upper-roman);
  position: absolute;
  left: 16px;
  top: 15px;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--aurum);
  color: var(--aurum-ink);
  font: 400 0.9rem/1 var(--font-carve);
}

.rent-steps b {
  font-weight: 700;
}

.rent-steps span {
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.rent-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.rent-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.rent-form .btn {
  justify-self: start;
}

.api-box {
  display: grid;
  gap: 10px;
}

.api-box .code-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rent-shop {
  display: grid;
  gap: 8px;
}

.rent-shop-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rent-shop-top .pstamp {
  margin: 0;
}

.stake-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--aurum-dark);
  border-radius: var(--r-s);
  overflow-wrap: anywhere;
}

.stake-box .btn {
  justify-self: start;
}

/* ---------- Urbs: the 3D city, full screen, with overlays ---------- */

.city-stage {
  position: fixed;
  inset: var(--top, 64px) 0 0 0;
  z-index: 5;
  overflow: hidden;
  background: #efe4cf;
}

.city-canvas {
  position: absolute;
  inset: 0;
}

.city-canvas canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}

.city-canvas canvas:active {
  cursor: grabbing;
}

.city-hud,
.city-feed,
.city-panel,
.dir-chip,
.city-hint {
  border: 1px solid var(--line-strong);
  background: rgba(251, 248, 242, 0.9);
  backdrop-filter: blur(8px);
}

.city-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 360px);
  padding: 6px;
  border-radius: var(--r);
}

.hud-name,
.hud-stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 5px;
  border-radius: var(--r-s);
  font: 600 0.82rem/1 var(--font-body);
}

.hud-name {
  border: 1px solid var(--aurum);
  color: var(--aurum-ink);
  font: 400 0.8rem/1 var(--font-carve);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--aurum);
  box-shadow: 0 0 8px var(--aurum);
  animation: blink 1.6s steps(2) infinite;
}

.hud-stat {
  color: var(--ink-soft);
}

.hud-clock {
  color: var(--aurum-ink);
}

.city-feed {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: min(320px, calc(100% - 28px));
  max-height: 46%;
  overflow: hidden;
  border-radius: var(--r);
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--aurum-ink);
  font: 400 0.8rem/1 var(--font-carve);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.feed-head .icon {
  rotate: -90deg;
  transition: rotate 200ms;
}

.city-feed.is-collapsed .feed-head .icon {
  rotate: 90deg;
}

.city-feed.is-collapsed .feed-list {
  display: none;
}

.feed-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
}

.feed-list li {
  display: grid;
  grid-template-columns: 4.6em minmax(0, 1fr);
  gap: 8px;
  padding: 6px 6px 5px;
  border-radius: var(--r-s);
  font-size: 0.88rem;
  line-height: 1.35;
}

.feed-list li:first-child {
  background: rgba(201, 163, 90, 0.14);
}

.feed-list time {
  color: var(--ink-faint);
  font: 500 0.72rem/1.6 var(--font-mono);
}

.city-panel {
  position: absolute;
  top: 70px;
  left: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
  width: min(360px, calc(100% - 28px));
  max-height: calc(100% - 70px - var(--dock-h) - 90px);
  padding: 20px;
  overflow-y: auto;
  border-radius: var(--r-l);
  box-shadow: var(--frame);
  animation: pop 260ms var(--snap) both;
}

.panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.panel-name {
  color: var(--nox);
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.panel-portrait {
  display: grid;
  place-items: end center;
  height: 160px;
  overflow: hidden;
  border: 6px solid #6e6656;
  border-bottom-width: 12px;
  border-radius: 50% 50% 2px 2px / 30% 30% 2px 2px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 55%, rgba(217, 182, 110, 0.45), transparent 75%),
    linear-gradient(180deg, #2a1f13, #120d07);
}

.panel-portrait .bot {
  --bs: 10px;
}

.panel-quote {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 3px solid var(--aurum);
  background: rgba(201, 163, 90, 0.06);
  font-size: 0.94rem;
}

.panel-quote span {
  color: var(--ink-faint);
  font: 400 0.68rem/1.3 var(--font-carve);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-books {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 12px;
  border-radius: var(--r-s);
  background: #e6ddcb;
  color: #241a10;
}

.panel-books div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(36, 26, 16, 0.15);
  font-size: 0.86rem;
}

.panel-books dt {
  font: 400 0.8rem/1.3 var(--font-carve);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-books dd {
  margin: 0;
  color: #8e3a22;
  font-weight: 700;
}

.panel-agents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.city-directory {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(var(--dock-h) + 28px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.dir-chip {
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-s);
  color: var(--ink);
  font: 600 0.84rem/1 var(--font-body);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
  transition: border-color 160ms;
}

.dir-chip:hover {
  border-color: var(--aurum);
  color: var(--ink);
}

.dir-chip--agent {
  border-color: var(--aurum);
  color: var(--aurum-ink);
  font-family: var(--font-carve);
  letter-spacing: 0.08em;
}

.city-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--dock-h) + 80px + env(safe-area-inset-bottom));
  translate: -50% 0;
  padding: 7px 14px 6px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  white-space: nowrap;
  pointer-events: none;
  animation: hint-fade 9s forwards;
}

@keyframes hint-fade {
  80% {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.city-tags {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tag-pin {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  will-change: transform;
}

.tag-name {
  position: absolute;
  bottom: 0;
  left: 0;
  translate: -50% 0;
  padding: 4px 9px 2px;
  border: 1px solid var(--aurum);
  border-radius: 2px;
  background: rgba(251, 248, 242, 0.94);
  color: var(--aurum-ink);
  font: 400 0.74rem/1 var(--font-carve);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* speech on a scrap of papyrus */
.tag-say {
  position: absolute;
  bottom: 26px;
  left: 0;
  translate: -50% 0;
  width: max-content;
  max-width: 210px;
  padding: 7px 11px 6px;
  border-radius: 3px;
  background: #fbf3df;
  color: #241a10;
  box-shadow: 0 6px 14px -8px rgba(40, 28, 12, 0.5);
  font: italic 600 0.92rem/1.25 var(--font-latin);
  opacity: 0;
  transform: translateY(6px) scale(0.9);
  transition: opacity 200ms, transform 200ms var(--snap);
}

.tag-say::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  translate: -50% 0;
  rotate: 45deg;
  background: inherit;
}

.tag-pin.is-saying .tag-say {
  opacity: 1;
  transform: none;
}

/* the flat map, for browsers without WebGL */
.city-flat {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
}

.city-svg {
  width: 100%;
  height: 100%;
  min-width: 720px;
}

.city-svg .road { fill: #2a251c; }
.city-svg .lot { fill: #1a1712; stroke: #0d0c0a; stroke-width: 0.5; }
.city-svg .park { fill: #1d2416; }
.city-svg .lane { fill: none; stroke: rgba(201, 163, 90, 0.25); stroke-dasharray: 3 6; stroke-width: 1; }
.city-svg .win { fill: #d9b66e; opacity: 0.8; }
.city-svg .win.cool { fill: #efe7d8; }
.city-svg .win.blink { animation: blink 3s steps(2) infinite; }
.city-svg .antenna { stroke: #5a5040; stroke-width: 1.5; }
.city-svg .antenna.thick { stroke-width: 2.5; }
.city-svg .beacon { fill: #d9b66e; }
.city-svg .clock { fill: #efe7d8; }
.city-svg .clock-hand { stroke: #17130b; stroke-width: 1.5; }
.city-svg .car.head,
.city-svg .car.tail { fill: #d9b66e; }
.city-svg .bot-shell { fill: #c9a35a; }
.city-svg .bot-face { fill: #2a1f10; }
.city-svg .bot-led,
.city-svg .spark { fill: #fff1c4; }
.city-svg .sign { fill: #17140f; stroke: #9e7e40; }
.city-svg .sign-line { fill: none; stroke: #9e7e40; stroke-width: 0.6; }
.city-svg .sign-text { fill: #c9a35a; font: 400 8.5px var(--font-carve); text-anchor: middle; letter-spacing: 0.12em; }
.city-svg .sign-sub { fill: #c9c0b0; font: 600 6.5px var(--font-body); text-anchor: middle; }
.city-svg .sign-pole { stroke: #8f877a; stroke-width: 1.5; }
.city-svg .lm .lift { transition: transform 250ms; }
.city-svg .lm:hover .lift { transform: translateY(-4px); }
.city-svg .lot-fence { fill: #1f1b15; stroke: #b5583a; stroke-dasharray: 3 3; stroke-width: 0.8; }
.city-svg .rent { fill: #e9e1d0; }
.city-svg .rent-text { fill: #8e3a22; font: 400 5px var(--font-carve); text-anchor: middle; }

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

@media (max-width: 960px) {
  .wall,
  .sidewalk,
  .workshop {
    grid-template-columns: minmax(0, 1fr);
  }

  .fresco + .fresco {
    border-left: 0;
    border-top: 10px solid #0b0a08;
  }

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

  .rent-steps li,
  .rent-steps li:first-child,
  .rent-steps li:last-child {
    border-radius: 0;
  }

  .miliarium {
    width: min(100%, 360px);
  }
}

/* the street becomes a row you swipe along */
@media (max-width: 860px) {
  .agent-st {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(84vw, 340px);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .shop {
    scroll-snap-align: center;
  }
}

@media (max-width: 720px) {
  .city-hud {
    max-width: calc(100% - 28px);
  }

  .hud-stat:not(.hud-clock):not(#hud-working) {
    display: none;
  }

  .city-feed {
    top: 60px;
    width: min(260px, calc(100% - 28px));
    max-height: 34%;
  }

  .city-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: calc(var(--dock-h) + 24px + env(safe-area-inset-bottom));
    z-index: 2;
    width: auto;
    max-height: 58%;
  }

  .city-directory {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .dir-chip {
    flex: none;
  }

  .city-hint {
    display: none;
  }
}

@media (max-width: 640px) {
  .hood-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .corner-sign {
    display: none;
  }

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

  .tenant-window {
    width: min(100%, 230px);
    justify-self: center;
  }

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

  .board-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .board-value {
    text-align: left;
  }

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

  .plate {
    width: 62px;
  }

  .plaque::before,
  .plaque::after {
    display: none;
  }
}


/* ---------- the way a job goes: three milestones under the Tabernae title ---------- */

.via {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--surface);
  overflow: hidden;
}

.via li {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
}

.via li + li {
  border-left: 1px dashed var(--line);
}

/* a carved chevron between the steps */
.via li + li::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  width: 12px;
  height: 12px;
  translate: 0 -50%;
  rotate: 45deg;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.via b {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--aurum);
  color: var(--aurum-ink);
  font: 400 1rem/1 var(--font-carve);
}

.via span {
  display: grid;
  gap: 2px;
  color: var(--ink-faint);
  font-size: 0.9rem;
  line-height: 1.4;
}

.via strong {
  color: var(--ink);
  font: 400 1rem/1.2 var(--font-carve);
  letter-spacing: 0.04em;
}

/* ---------- the counter: a live chat across the stone counter ---------- */

.ws-side {
  display: grid;
  gap: clamp(16px, 2.4vw, 24px);
  min-width: 0;
}

.counter {
  display: grid;
  gap: 14px;
  padding: clamp(16px, 2.6vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  /* the marble top of a thermopolium counter */
  background:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(201, 163, 90, 0.12), transparent 70%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow), var(--frame);
}

.counter-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.counter-head h3 {
  margin: 0;
  font: 400 1.2rem/1.2 var(--font-carve);
  letter-spacing: 0.03em;
}

.counter-head p {
  margin: 2px 0 0;
  font-size: 0.88rem;
}

.counter-n {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--aurum);
  color: var(--nox);
  font: 400 1.05rem/1 var(--font-carve);
}

.counter-log {
  display: grid;
  align-content: start;
  gap: 12px;
  max-height: 440px;
  min-height: 150px;
  padding: 4px 4px 4px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.say {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: rise 320ms var(--soft) both;
}

.say p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.say p + p,
.say p + .say-brief,
.say-brief + p {
  margin-top: 10px;
}

.say--you {
  justify-content: flex-end;
}

.say--you p {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--nox);
  color: var(--marmor);
}

.say--agent .say-body {
  max-width: calc(100% - 52px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--neon, var(--aurum));
  border-radius: 16px 16px 16px 4px;
  background: #fffdf8;
}

.say--err p {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(181, 88, 58, 0.1);
  color: var(--terracotta);
}

.bot--tiny {
  --bs: 4px;
  flex: none;
}

.say-cost {
  display: block;
  margin-top: 8px;
  color: var(--ink-faint);
  font: 500 0.72rem/1 var(--font-mono);
}

/* a drafted brief: a little wax tablet inside the reply */
.say-brief {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 12px 14px;
  border: 6px solid #6b4a26;
  border-radius: 6px;
  background: #2b2116;
  color: var(--marmor);
}

.say-brief .eyebrow {
  color: var(--aurum);
}

.say-brief b {
  font: 400 1.02rem/1.25 var(--font-carve);
}

.say-brief p {
  max-height: 160px;
  overflow: auto;
  color: #d9d0c0;
  font-size: 0.9rem;
}

.counter .suggestions {
  margin-top: 10px;
}

.counter-say {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.counter-say .textarea {
  min-height: 46px;
  max-height: 180px;
  resize: none;
}

@media (max-width: 720px) {
  .via {
    grid-template-columns: minmax(0, 1fr);
  }

  .via li + li {
    border-left: 0;
    border-top: 1px dashed var(--line);
  }

  .via li + li::before {
    display: none;
  }

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

  .counter-clear {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .say {
    animation: none;
  }
}

/* ---------- Docs: the Liber Insulae, a book with its contents pinned beside it ---------- */

.topbar-docs {
  gap: 6px;
}

.liber-head {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 18px 0 clamp(28px, 4vw, 44px);
}

.liber-head h1 {
  margin: 0;
}

.liber-body {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.liber-toc {
  position: sticky;
  top: 84px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--surface);
  box-shadow: var(--shadow), var(--frame);
}

.liber-toc-title {
  display: block;
  margin: 0 0 10px 6px;
  color: var(--aurum-ink);
  font: 400 0.8rem/1 var(--font-carve);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.liber-toc ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.liber-toc a {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.94rem;
  line-height: 1.3;
  transition: background 160ms, color 160ms;
}

.liber-toc a b {
  flex: none;
  width: 2.2em;
  color: var(--aurum-ink);
  font: 400 0.82rem/1 var(--font-carve);
}

.liber-toc a:hover,
.liber-toc a[aria-current] {
  background: var(--surface-2);
  color: var(--ink);
}

.liber-toc a[aria-current] {
  box-shadow: inset 3px 0 0 var(--aurum);
}

.liber-text {
  display: grid;
  /* one column that never grows past the page: long code lines scroll inside their own box */
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(36px, 5vw, 56px);
  max-width: 780px;
  min-width: 0;
  font-size: 1.04rem;
  line-height: 1.7;
}

.liber-text section {
  scroll-margin-top: 90px;
}

.liber-text h2 {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}

.liber-text h2 b {
  color: var(--aurum-ink);
  font-weight: 400;
  font-size: 0.8em;
}

.liber-text h3 {
  margin: 26px 0 8px;
  font: 400 1.15rem/1.3 var(--font-carve);
  letter-spacing: 0.03em;
}

.liber-text p {
  margin: 0 0 12px;
}

.liber-text code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  font: 500 0.86em/1.4 var(--font-mono);
  overflow-wrap: anywhere;
}

.liber-points,
.liber-steps {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding-left: 1.3em;
}

.liber-points li::marker {
  color: var(--aurum);
}

.liber-steps li::marker {
  color: var(--aurum-ink);
  font-family: var(--font-carve);
}

.liber-addr {
  word-break: break-all;
}

.liber-facts {
  display: grid;
  gap: 0;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-m, 12px);
  overflow: hidden;
}

.liber-facts div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
}

.liber-facts div + div {
  border-top: 1px solid var(--line);
}

.liber-facts dt {
  color: var(--ink-faint);
  font-weight: 700;
}

.liber-facts dd {
  margin: 0;
  min-width: 0;
}

.liber-code {
  position: relative;
  margin: 0 0 14px;
  border-radius: 12px;
  background: #1c1914;
  color: #efe7d8;
}

.liber-code-lang {
  position: absolute;
  top: 10px;
  left: 14px;
  color: var(--aurum);
  font: 500 0.72rem/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.liber-code .btn {
  position: absolute;
  top: 6px;
  right: 6px;
}

.liber-code pre {
  margin: 0;
  padding: 36px 16px 16px;
  overflow-x: auto;
}

.liber-code code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.84rem;
  overflow-wrap: normal;
  white-space: pre;
}

.liber-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.liber-table [role='row'] {
  display: grid;
  grid-template-columns: 52px minmax(0, 210px) minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  background: var(--surface);
  font-size: 0.95rem;
}

.liber-table [role='row'] + [role='row'] {
  border-top: 1px solid var(--line);
}

.liber-agents {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.liber-agents > div {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--aurum);
  border-radius: 12px;
  background: var(--surface);
}

.liber-agents b {
  font: 400 1.3rem/1.1 var(--font-carve);
  letter-spacing: 0.06em;
}

.liber-agents span {
  color: var(--aurum-ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.liber-agents p {
  margin: 6px 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.liber-faq {
  border-bottom: 1px solid var(--line);
}

.liber-faq summary {
  padding: 14px 0;
  font-weight: 700;
  cursor: pointer;
}

.liber-faq p {
  color: var(--ink-soft);
}

.liber-end {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding-top: 8px;
}

@media (max-width: 900px) {
  .liber-body {
    grid-template-columns: minmax(0, 1fr);
  }

  /* the contents become a strip of chapters that scrolls sideways under the top bar */
  .liber-toc {
    top: 67px;
    z-index: 5;
    padding: 8px;
    margin: 0 calc(var(--gutter) * -1);
    border-radius: 0;
    border-width: 1px 0;
    box-shadow: none;
    background: rgba(251, 248, 242, 0.95);
    backdrop-filter: blur(8px);
  }

  .liber-toc-title {
    display: none;
  }

  .liber-toc ol {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .liber-toc a {
    white-space: nowrap;
    border: 1px solid var(--line);
    font-size: 0.86rem;
  }

  .liber-toc a[aria-current] {
    box-shadow: none;
    border-color: var(--aurum);
  }

  .liber-text section {
    scroll-margin-top: 130px;
  }

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

  .liber-table [role='row'] {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .liber-table [role='row'] > :last-child {
    grid-column: 2;
  }
}

@media (max-width: 520px) {
  .topbar-docs span {
    display: none;
  }

  .liber-facts div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}
