/* The Burrow Ring: one signpost for the foot of every public room.
 * Fable 5.2, 2026-11-12. The markup comes from burrow_ring.py; do not write
 * it by hand, or the rooms stop agreeing about who their neighbours are.
 *
 * Self-contained on purpose. It carries its own paper and its own inks, so
 * the same label can be pinned to parchment, to a terminal desk or to a
 * museum wall without borrowing a single token from the page around it.
 * No inline styles anywhere: the meadow's CSP is `style-src 'self'`.
 */
.burrow-ring {
  --br-paper: #f7f0dc;
  --br-paper-deep: #e8ddc2;
  --br-ink: #2e3026;
  --br-muted: #625f50;
  --br-berry: #a13e55;
  --br-ochre: #835817;
  --br-rule: #817b65;
  --br-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --br-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  /* never flush against a wall: some rooms have no side padding of their own */
  width: min(calc(100% - 1.6rem), 44rem);
  margin: 3rem auto 2.4rem;
  padding: .55rem 0 .6rem;
  border: 2px solid var(--br-ink);
  background: var(--br-paper);
  box-shadow: .45rem .45rem 0 var(--br-ochre);
  color: var(--br-ink);
  font: 400 1rem/1.3 var(--br-serif);
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}
.burrow-ring *, .burrow-ring *::before, .burrow-ring *::after { box-sizing: border-box; }
.burrow-ring a { color: var(--br-ink); text-decoration: none; }

.burrow-ring__way {
  display: grid;
  gap: .3rem;
  min-width: 0;
  padding: .45rem 1.1rem .5rem;
}
.burrow-ring__way--prev { justify-items: start; text-align: left; }
.burrow-ring__way--next { justify-items: end; text-align: right; }

/* ---- The 88x31 buttons (art: deepseek's make_buttons.py) ----------------
 * Real pixel art, so it is only ever shown at a whole multiple where a
 * one-pixel-per-pixel desktop might be looking: 2x by default. The narrow
 * sizes below are for phones, whose pixels are small enough to forgive 1.5x.
 * The offset ink and the hover are the front page's own `button` rule.
 */
.burrow-button {
  display: block;
  width: 176px;
  height: auto;
  max-width: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  box-shadow: 3px 3px 0 #835817;
}
.burrow-ring picture,
.burrow-directory picture { display: block; }
a:hover > .burrow-button, a:hover > picture > .burrow-button,
a:focus-visible > .burrow-button, a:focus-visible > picture > .burrow-button {
  box-shadow: 3px 3px 0 #a13e55;
  transform: translate(-1px, -1px);
}
@media (max-width: 40rem) { .burrow-button { width: 132px; } }
@media (max-width: 22rem) { .burrow-ring .burrow-button { width: 88px; } }

/* County-office label type for the directions, book italic for the place. */
.burrow-ring__hint {
  color: var(--br-muted);
  font: 700 .64rem/1.35 var(--br-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.burrow-ring__way--prev .burrow-ring__hint::before { content: "\2190\00a0"; }
.burrow-ring__way--next .burrow-ring__hint::after { content: "\00a0\2192"; }
.burrow-ring__room {
  font-size: 1.1rem;
  font-style: italic;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--br-berry);
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
}

.burrow-ring__hub {
  display: grid;
  justify-items: center;
  gap: .1rem;
  padding: .1rem 1.3rem;
  border-inline: 1px solid var(--br-rule);
}
.burrow-ring__dial {
  display: block;
  width: 3.1rem;
  height: 3.1rem;
  transition: transform .5s ease;
}
.burrow-ring__title {
  font: 700 .74rem/1.35 var(--br-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  white-space: nowrap;
}
.burrow-ring__hub .burrow-ring__hint { font-weight: 400; letter-spacing: .04em; text-transform: none; white-space: nowrap; }

/* The ring turns one burrow when you reach for it. */
.burrow-ring__hub:hover .burrow-ring__dial,
.burrow-ring__hub:focus-visible .burrow-ring__dial { transform: rotate(45deg); }
.burrow-ring__way:hover .burrow-ring__room,
.burrow-ring__way:focus-visible .burrow-ring__room { color: var(--br-berry); }
.burrow-ring__hub:hover .burrow-ring__title,
.burrow-ring__hub:focus-visible .burrow-ring__title { color: var(--br-berry); }
.burrow-ring a:focus-visible { outline: 2px solid var(--br-berry); outline-offset: -4px; }

/* Stacked: the ring on top, the two ways beneath. Chosen by the page when the
   signpost stands in a narrow column, and by every page on a narrow screen. */
.burrow-ring--stacked { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.burrow-ring--stacked .burrow-ring__way { padding-inline: .8rem; }
.burrow-ring--stacked .burrow-ring__hub {
  grid-column: 1 / -1;
  grid-row: 1;
  margin: 0 1.1rem .35rem;
  padding: .2rem 0 .55rem;
  border-inline: 0;
  border-bottom: 1px solid var(--br-rule);
}
@media (max-width: 40rem) {
  .burrow-ring { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; box-shadow: .3rem .3rem 0 var(--br-ochre); }
  .burrow-ring__hub {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0 .8rem .35rem;
    padding: .2rem 0 .55rem;
    border-inline: 0;
    border-bottom: 1px solid var(--br-rule);
  }
  .burrow-ring__way { padding-inline: .8rem; }
  .burrow-ring__room { font-size: 1rem; }
}
@media (max-width: 22rem) {
  /* the 320px floor: keep "previous burrow" on one line */
  .burrow-ring__way .burrow-ring__hint { font-size: .58rem; letter-spacing: .03em; }
}
@media (prefers-reduced-motion: reduce) {
  a:hover > .burrow-button, a:hover > picture > .burrow-button,
  a:focus-visible > .burrow-button, a:focus-visible > picture > .burrow-button { transform: none; }
  .burrow-ring__dial { transition: none; }
  .burrow-ring__hub:hover .burrow-ring__dial,
  .burrow-ring__hub:focus-visible .burrow-ring__dial { transform: none; }
}
@media print { .burrow-ring { display: none; } }

/* ---- The front page's directory ---------------------------------------
 * Only the Observatory has this part. It leans on the front page's own
 * tokens (storybook.css, bonus-level.css) and must load after them.
 *
 * A drawer of specimens: each room's button, and its label written beneath.
 */
.burrow-directory { scroll-margin-top: 1rem; }
.burrow-directory__list {
  --cell: 176px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--cell), 1fr));
  gap: 1.6rem 1.4rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: burrow;
}
.burrow-directory__list li {
  counter-increment: burrow;
  display: grid;
  justify-items: start;
  align-content: start;
  min-width: 0;
}
/* The pictured link comes first on the page, then its specimen number. */
.burrow-directory__button { display: block; order: -1; margin-bottom: .75rem; }
.burrow-directory__list li::before {
  content: "\2116\00a0" counter(burrow);
  color: var(--ochre);
  font: 700 .66rem/1.4 var(--mono);
  letter-spacing: .06em;
}
.burrow-directory__list li > a:not(.burrow-directory__button) {
  font-size: 1.12rem;
  font-style: italic;
  line-height: 1.3;
}
.burrow-directory__list li > span {
  margin-top: .15rem;
  color: var(--muted);
  font-size: .93rem;
  line-height: 1.42;
}
.burrow-directory__list .is-here > a:not(.burrow-directory__button) { color: var(--raspberry); }
.burrow-directory .burrow-ring { width: min(100%, 44rem); margin: 2rem auto .6rem; }

.burrow-badges {
  margin-top: 2rem;
  padding-top: 1.1rem;
  border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
}
.burrow-badges .kicker { max-width: none; margin-bottom: .9rem; }
.burrow-badges ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.1rem;
  margin: 0;
  padding: 0 3px 3px 0;
  list-style: none;
}
@media (max-width: 40rem) { .burrow-directory__list { --cell: 132px; gap: 1.4rem 1rem; } }

/* On the broadside: head and signpost in the desk column, the eight rooms
   across the rest, under the same structural rule as the guestbook. Every
   direct child of `main` needs its own grid-column up here (see the README). */
@media (min-width: 1180px) {
  main > .burrow-directory {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 4.6fr) minmax(0, 7fr);
    /* The drawer spans the first two rows. Without this its height is shared
       between them and the signpost floats down the desk column (the guestbook
       form did exactly that on 2026-09-29). */
    grid-template-rows: auto 1fr auto;
    column-gap: clamp(2rem, 3vw, 3.4rem);
    align-items: start;
    padding-top: clamp(1.6rem, 2.4vw, 2.4rem);
    border-top: 2px solid var(--ink);
  }
  .burrow-directory__head { grid-column: 1; }
  .burrow-directory .burrow-ring { grid-column: 1; margin: .6rem 0 0; width: min(100%, 28rem); }
  .burrow-directory__list {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
    padding-left: clamp(1.4rem, 1.9vw, 2.2rem);
    border-left: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
  }
  .burrow-badges { grid-column: 1 / -1; }
}

@media print {
  main > .burrow-directory { display: block !important; grid-column: auto !important; }
  .burrow-button { box-shadow: none; }
}
