/* ==========================================================================
   ribbit.ing
   Restrained and neutral, in the manner of a good developer tool: greys carry
   the layout, panels are drawn with a 1px border, hierarchy comes from type
   size and thin rules. Open Sans throughout.

   Colour is only ever information (Cyberdream):
     blue   #5ea1ff  links
     green  #5eff6c  ".ing", online, added
     yellow #f1ff5e  updated, warnings
     red    #ff6e5e  removed, offline
     orange #ffbd5e  JavaScript language dot
   The primary button is near-white, not coloured.
   JetBrains Mono only for literal data (versions, filenames).
   ========================================================================== */

:root {
  color-scheme: dark;

  --chrome: #131517;
  --bg: #16181a;
  --surface: #1a1c1f;
  --surface-2: #222529;
  --line: #2e3237;
  --line-strong: #4a4f58;
  --edge: #2a2d32;

  --text: #ececee;
  --text-soft: #b4b8bf;
  --muted: #868c96;
  --faint: #5f656f;

  --blue: #5ea1ff;
  --blue-hover: #86b8ff;
  --green: #5eff6c;
  --yellow: #f1ff5e;
  --red: #ff6e5e;
  --orange: #ffbd5e;
  --on-accent: #121315;

  --sans: "Open Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --sidebar-w: 15rem;
  --measure: 68ch;
  --r-btn: 6px;
  --r-card: 8px;
}

/* ==========================================================================
   BASE
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

body {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-soft);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  color: var(--blue-hover);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Links inside running text stay underlined so they don't rely on colour alone. */
p:not(.actions) a,
.steps a,
.server-only a {
  text-decoration: underline;
  text-decoration-color: rgba(94, 161, 255, 0.4);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
p:not(.actions) a:hover,
.steps a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.84em;
}

code {
  color: var(--text);
  background-color: var(--surface-2);
  padding: 0.1em 0.38em;
  border-radius: 4px;
}

::selection {
  background-color: #3a4a63;
  color: #fff;
}

.is-hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.82rem;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 50;
  padding: 0.45rem 0.8rem;
  background: var(--text);
  color: var(--on-accent);
  border-radius: var(--r-btn);
}

.skip:focus {
  top: 1rem;
}

/* Live status colour, set by js/status.js on [data-status-state]. */
.dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background-color: currentColor;
}

[data-status-state] {
  color: var(--muted);
}
[data-status-state="online"] {
  color: var(--green);
}
[data-status-state="warning"] {
  color: var(--yellow);
}
[data-status-state="offline"] {
  color: var(--red);
}

/* ==========================================================================
   WORDMARK — shared with the server address so they read as one lettering
   ========================================================================== */
.brand,
.addr {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand {
  white-space: nowrap;
}
.brand-name {
  color: var(--text);
}
.brand-tld {
  color: var(--green);
}

/* ==========================================================================
   SIDEBAR — fixed, full height, a shade darker than the page
   ========================================================================== */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.75rem 1rem;
  background-color: var(--chrome);
  border-right: 1px solid var(--edge);
  overflow-y: auto;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.6rem;
}

.sidebar-brand {
  font-size: 1.15rem;
  line-height: 1;
}
.sidebar-brand:hover {
  text-decoration: none;
}

.menu-toggle {
  display: none;
}

.tree {
  margin-top: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

.tree ul {
  list-style: none;
}

.tree a {
  display: block;
  margin: 1px 0;
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-btn);
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.35;
}

.tree a:hover {
  color: var(--text);
  background-color: var(--surface-2);
  text-decoration: none;
}
.tree a[aria-current] {
  color: var(--text);
  background-color: var(--surface-2);
  font-weight: 600;
}

/* Group labels ("Projects", "Minecraft Server"): small and quiet. */
.tree .tree-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
}
.tree .tree-head[aria-current] {
  color: var(--text);
}

.tree-head-status {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tree-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.tree-status [data-status-count] {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

/* Nested list (modpack > changes / mods / releases) */
.tree ul ul a {
  padding-left: 1.4rem;
  font-size: 0.82rem;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1.5rem 0.6rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.9rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.sidebar-foot a {
  color: var(--muted);
}
.sidebar-foot a:hover {
  color: var(--text);
}
.sidebar-build {
  font-family: var(--mono);
  font-size: 0.66rem;
  overflow-wrap: anywhere;
  opacity: 0.8;
}

.env-tag {
  color: var(--on-accent);
  background-color: var(--yellow);
  border-radius: 4px;
  padding: 0.05rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ==========================================================================
   MAIN
   ========================================================================== */
.main {
  margin-left: var(--sidebar-w);
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  max-width: calc(var(--sidebar-w) + 60rem);
}

/* Site notice: the expiring bar at the top of every page (see notice_routes.py). */
.notice {
  --c: var(--blue);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  padding: 0.6rem 0.5rem 0.6rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  box-shadow: inset 3px 0 0 var(--c);
  color: var(--text);
  font-size: 0.86rem;
}

.notice[hidden] {
  display: none;
}
.notice-success {
  --c: var(--green);
}
.notice-warning {
  --c: var(--yellow);
}
.notice-danger {
  --c: var(--red);
}

.notice-dot {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--c);
}
.notice-text {
  flex: 1;
  min-width: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.notice-text a {
  color: var(--c);
  font-weight: 600;
  white-space: nowrap;
}

.notice-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--r-btn);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.notice-close:hover {
  color: var(--text);
  background-color: var(--surface-2);
}

/* Every page opens with a title, a one-line description and a rule. */
.page-head {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--edge);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.page-lede {
  margin-top: 0.4rem;
  max-width: var(--measure);
  font-size: 0.95rem;
  color: var(--muted);
}

.page-foot {
  margin-top: 2.5rem;
  color: var(--muted);
}

.block {
  margin-top: 2.75rem;
}

.block-title,
.repo-section {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

/* A section heading with a small link at its right ("All repositories"). */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.section-head > h2 {
  margin-bottom: 0;
}

.pill-link {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}
.pill-link:hover {
  color: var(--text);
}

.block-note {
  margin-top: 1rem;
  color: var(--muted);
  max-width: var(--measure);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.btn,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.btn {
  background-color: var(--text);
  color: var(--on-accent);
}
.btn:hover {
  background-color: #ffffff;
  color: var(--on-accent);
  text-decoration: none;
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-secondary:hover {
  background-color: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.actions > .muted {
  margin-left: 0.4rem;
  font-size: 0.8rem;
}

.link-btn {
  color: var(--blue);
}
.link-btn:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

.tag {
  display: inline-block;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: 0.15em;
}

.chg {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}
.chg::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background-color: currentColor;
}
.chg-added {
  color: var(--green);
}
.chg-updated {
  color: var(--yellow);
}
.chg-removed {
  color: var(--red);
}

/* The one container shape: page-toned, drawn by a border. */
.tile {
  padding: 1.1rem 1.25rem;
  background-color: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
}

/* Label-over-value figures in one bordered row (server stats, modpack facts). */
.host,
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background-color: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
}

.host > div,
.facts > div {
  padding: 0.8rem 1rem;
  border-left: 1px solid var(--edge);
}
.host > div:first-child,
.facts > div:first-child {
  border-left: 0;
}

.host dt,
.facts dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.host dd,
.facts dd {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.host dd .of {
  display: block;
  margin-top: 0.05rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

/* ==========================================================================
   PROJECTS (/) — a featured repository, then pinned repositories
   ========================================================================== */
.repo-section-wrap {
  margin-top: 2rem;
}

.repo-card {
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.25rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  scroll-margin-top: 1.5rem;
}

.repo-card:target {
  border-color: var(--blue);
}

.repo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  min-width: 0;
}
.repo-icon {
  flex: 0 0 auto;
  color: var(--muted);
}

.repo-name {
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.repo-name:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

.repo-badge {
  margin-left: auto;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}

.repo-focus {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.repo-desc {
  margin-top: 0.55rem;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.6;
  flex: 1;
}

.repo-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 1.1rem;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--edge);
  color: var(--muted);
  font-size: 0.76rem;
}

.repo-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
}
.repo-lang::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  background-color: var(--muted);
}
.repo-lang.lang-python::before {
  background-color: var(--yellow);
}
.repo-lang.lang-javascript::before {
  background-color: var(--orange);
}
.repo-stack {
  min-width: 0;
}

/* Featured: the same card, given room. */
.repo-feature {
  padding: 1.4rem 1.5rem 1.2rem;
}
.repo-feature .repo-name {
  font-size: 1.15rem;
}
.repo-feature .repo-icon {
  width: 18px;
  height: 18px;
}
.repo-desc-lg {
  font-size: 0.92rem;
  max-width: var(--measure);
}

.repo-highlights {
  list-style: none;
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 1.75rem;
  font-size: 0.85rem;
}

.repo-highlights li {
  position: relative;
  padding-left: 1rem;
}
.repo-highlights li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.7em;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background-color: var(--muted);
}

.repo-feature .repo-foot {
  margin-top: 1.2rem;
}
.repo-link {
  margin-left: auto;
}

.repo-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

/* ==========================================================================
   MINECRAFT SERVER (/minecraft)
   ========================================================================== */
.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.server-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.server-players {
  color: var(--muted);
  margin-left: 0.3rem;
}
.server-players span {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

/* Address and actions share a row under the description. */
.join-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 1.25rem;
}
.join-row .actions {
  margin-top: 0;
}

.server-addr {
  display: grid;
  gap: 0.35rem;
  border-inline-end: 1px solid var(--line);
  width: fit-content;
  padding-inline-end: 2%;
}
.join-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.join-label .muted {
  margin-left: 0.4rem;
  color: var(--faint);
}

/* The address as a copy field. */
.addr {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  font-size: 1rem;
  text-align: left;
}

.addr:hover {
  border-color: var(--line-strong);
}
.addr-sub {
  color: var(--text-soft);
}
.addr-name {
  color: var(--text);
}
.addr-tld {
  color: var(--green);
}
.addr-copy {
  margin-left: 0.6rem;
  color: var(--muted);
}
.addr:hover .addr-copy {
  color: var(--text);
}
.addr.is-copied {
  border-color: var(--green);
}
.addr.is-copied .addr-copy {
  color: var(--green);
}

.live {
  display: grid;
  gap: 0.75rem;
}

/* The game's server-list row, drawn as Minecraft draws it. */
.motd-card {
  padding: 1rem 1.15rem;
  background-color: #0e0f10;
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
}

.motd-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}
.motd-title {
  color: var(--text);
  font-weight: 600;
}
.motd-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.motd {
  margin-top: 0.25rem;
  color: #aaaaaa;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.motd.is-empty::before {
  content: "The server didn't respond this time.";
  color: var(--muted);
}

/* A real sequence, so it's numbered: plain numerals, no boxes. */
.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 1.1rem;
  max-width: 44rem;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr);
  column-gap: 0.6rem;
}

.steps li::before {
  content: counter(step) ".";
  grid-row: 1 / span 2;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
}

.steps h3 {
  grid-column: 2;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
}
.steps p {
  grid-column: 2;
  font-size: 0.88rem;
}

.pack-release {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.pack-num {
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.facts {
  margin-top: 1rem;
}

.pack-changes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  margin-top: 1rem;
  font-size: 0.86rem;
}

/* ==========================================================================
   RESOURCE & SHADER PACKS
   ========================================================================== */
.rp-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
  margin-top: 2rem;
}

.rp {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
  padding: 1.4rem 1.5rem;
  background-color: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  scroll-margin-top: 1.5rem;
}

.rp-icon {
  width: 6rem;
  height: 6rem;
  border-radius: var(--r-btn);
  object-fit: cover;
  background-color: var(--surface-2);
}
.rp-icon.is-pixel {
  image-rendering: pixelated;
} /* keep pixel art crisp when scaled */

.rp-name {
  font-size: 1.05rem;
  font-weight: 600;
}
.rp-desc {
  margin-top: 0.3rem;
  max-width: var(--measure);
}

.rp-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-top: 1rem;
}
.rp-facts dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.rp-facts dd {
  color: var(--text);
  font-weight: 600;
}

.rp .actions {
  margin-top: 1.25rem;
}
.rp-source {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ==========================================================================
   CHANGELOG (/changelog) and MARKDOWN PREVIEW (/markdown-preview)
   ========================================================================== */
/* Entries read as one continuous document, not cards: the date sits in a margin
   column (and stays in view while you read a long entry), a rule separates entries. */
.entries {
  list-style: none;
  max-width: 54rem;
}

.entry {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  column-gap: 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--edge);
  scroll-margin-top: 1.5rem;
}

.entry:first-child {
  border-top: 0;
}
.entries .entry:last-child {
  padding-bottom: 0;
}

.entry-date {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  padding-top: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.entry-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* Markdown output. Headings inside an entry sit below the entry title. */
.prose {
  margin-top: 0.7rem;
  max-width: var(--measure);
  overflow-wrap: anywhere;
}
.prose > * + * {
  margin-top: 0.8rem;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin-top: 1.3rem;
  color: var(--text);
  font-weight: 600;
}
.prose h1 {
  font-size: 1.1rem;
}
.prose h2 {
  font-size: 1rem;
}
.prose h3 {
  font-size: 0.95rem;
}
.prose h4,
.prose h5,
.prose h6 {
  font-size: 0.9rem;
  color: var(--text-soft);
}
.prose > :first-child {
  margin-top: 0;
}
.prose strong {
  color: var(--text);
  font-weight: 600;
}
.prose a {
  text-decoration: underline;
  text-decoration-color: rgba(94, 161, 255, 0.4);
  text-underline-offset: 0.2em;
}
.prose a:hover {
  text-decoration-color: currentColor;
}
.prose del {
  color: var(--muted);
}
.prose ul,
.prose ol {
  padding-left: 1.3rem;
}
.prose li + li {
  margin-top: 0.3rem;
}
.prose li::marker {
  color: var(--muted);
}
.prose li > input[type="checkbox"] {
  margin-right: 0.45rem;
  accent-color: var(--blue);
}
.prose blockquote {
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--line-strong);
  color: var(--text-soft);
}
.prose pre {
  padding: 0.85rem 1rem;
  background-color: #0e0f10;
  border: 1px solid var(--edge);
  border-radius: var(--r-btn);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}
.prose pre code {
  padding: 0;
  background: none;
  color: var(--text-soft);
  font-size: inherit;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.4rem 0;
}
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-btn);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.prose th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0 1rem 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.prose td {
  padding: 0.45rem 1rem 0.45rem 0;
  border-bottom: 1px solid var(--edge);
}

/* Preview tool: editor beside the rendered entry. */
.mdp {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  margin-top: 2rem;
}
/* The preview column is narrow: date above the title, as on phones. */
.mdp .entry {
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
}
.mdp .entry-date {
  position: static;
  padding: 0 0 0.25rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.field-label {
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
}
.field-label .muted {
  font-weight: 400;
}

.input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background-color: var(--chrome);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.input:focus {
  outline: none;
  border-color: var(--blue);
}
.input.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.mdp-source {
  min-height: 24rem;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
}

.mdp-oneline {
  grid-column: 2;
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.mdp-oneline .input {
  min-width: 0;
}
.mdp-oneline .btn-secondary {
  flex: 0 0 auto;
}

/* ==========================================================================
   NARROW
   ========================================================================== */
@media (max-width: 1000px) {
  .mdp {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .entry {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.6rem 0;
  }
  .entry-date {
    position: static;
    padding: 0 0 0.25rem;
  }
  .repo-grid,
  .repo-highlights {
    grid-template-columns: minmax(0, 1fr);
  }
  .repo-feature {
    padding: 1.2rem 1.25rem 1rem;
  }
  .repo-badge {
    flex-basis: 100%;
    width: fit-content;
    max-width: max-content;
    margin-left: 0;
  }
  .repo-link {
    margin-left: 0;
  }
  .rp {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    padding: 1.15rem;
  }
  .rp-icon {
    width: 4rem;
    height: 4rem;
  }

  /* Figures go 2 × 2. */
  .host,
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .host > div:nth-child(3),
  .facts > div:nth-child(3) {
    border-left: 0;
  }
  .host > div:nth-child(n + 3),
  .facts > div:nth-child(n + 3) {
    border-top: 1px solid var(--edge);
  }
}

/* Sidebar becomes a top bar with a menu. */
@media (max-width: 860px) {
  .sidebar {
    position: sticky;
    inset: auto;
    top: 0;
    width: auto;
    max-height: 100vh;
    padding: 0.75rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--edge);
  }

  .sidebar-top {
    padding: 0;
  }

  .menu-toggle {
    display: inline-block;
    color: var(--text);
    border: 1px solid var(--line);
    padding: 0.3rem 0.75rem;
    border-radius: var(--r-btn);
    font-size: 0.82rem;
    font-weight: 600;
  }

  .menu-toggle[aria-expanded="true"] {
    background-color: var(--surface-2);
  }

  .tree,
  .sidebar-foot {
    display: none;
  }
  .sidebar.is-open .tree {
    display: grid;
    margin-top: 1.25rem;
  }
  .sidebar.is-open .sidebar-foot {
    display: flex;
    padding-top: 1.5rem;
  }

  .main {
    margin-left: 0;
    padding-top: 1.75rem;
  }
}

@media (max-width: 520px) {
  .page-title {
    font-size: 1.5rem;
  }
  .join-row {
    display: grid;
  }
  .actions .btn,
  .actions .btn-secondary {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media print {
  .sidebar {
    display: none;
  }
  .main {
    margin-left: 0;
  }
}
