/* ==========================================================================
   members-style.css — shared components for the "Community" area
   (community competitions and community groups).

   Layered on top of the site's own style.css, which the pages now load from the
   site root (the old local copy was removed when the community area joined the
   site's shared header). Colours reuse the Volant Poetry palette: the purple
   brand accent and the muted brown used for secondary text. The header wordmark
   deliberately borrows the site nav's own look from poems.html — logo.png, Inter
   600, brand purple, glowing .logo-highlight — so the community pages are
   visually indistinguishable from the rest of the site up top. Night reading is
   driven by theme.js, which sets data-theme="dark" on the <html> element, so
   every surface here is declared for both themes.
   ========================================================================== */

:root {
  /* The tap target for both menu buttons. 44px is the smallest comfortably
     hittable size on a phone, and it is declared once here so the open toggle
     and the overlay's close cannot drift apart. */
  --mi-toggle-box: 44px;
  /* The bar's height on a desktop: poems.html's 10px padding above and below its
     1.6rem Playfair wordmark, whose 1.6 line-height makes a 41px line box, so
     10 + 41 + 10 = 61px. Not a magic number -- it is what .mi-nav__bar's padding
     and .mi-nav__logo-text produce, written down so the page lays out correctly
     before members-ui.js has measured anything. The phone breakpoints override it
     with the 60px and 44px poems.html declares for those widths. */
  --mi-bar-h: calc(61px + env(safe-area-inset-top, 0px));
  --mi-purple: #4b2aad;
  --mi-purple-dark: #3a1f85;
  --mi-purple-soft: #f1ecfd;
  --mi-gold: #b8860b;
  --mi-gold-bright: #daa520;
  --mi-ink: #1a1a1a;
  --mi-muted: #6f6357;
  --mi-line: #e6e0d8;
  --mi-surface: #ffffff;
  --mi-page: #faf8f5;
  --mi-danger: #b3261e;
  --mi-success: #1f6f43;
  --mi-radius: 14px;
  --mi-shadow: 0 1px 2px rgba(26, 26, 26, .05), 0 8px 24px rgba(26, 26, 26, .06);
  --mi-shadow-lg: 0 12px 40px rgba(26, 26, 26, .16);
}

[data-theme="dark"] {
  --mi-purple: #a78bfa;
  --mi-purple-dark: #c4b5fd;
  --mi-purple-soft: #241f3d;
  --mi-gold: #e0b64a;
  --mi-gold-bright: #f0cd6b;
  --mi-ink: #ece7e0;
  --mi-muted: #a89f94;
  --mi-line: #3a352e;
  --mi-surface: #1c1a17;
  --mi-page: #141210;
  --mi-danger: #f2b8b5;
  --mi-success: #7fd1a5;
  --mi-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --mi-shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
}

body.mi-body {
  background: var(--mi-page);
  color: var(--mi-ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  /* Enough room for the fixed bar plus a gap, so nothing on the page starts
     level with the bar's bottom edge and reads as cut in half on a phone.
     --mi-bar-h is 72px here (index.html's 1rem padding around its 40px logo) and
     is overridden to 60px/44px at the phone breakpoints. It is a variable rather
     than a literal so members-ui.js can measure the real bar and rewrite it,
     which keeps this offset from ever disagreeing with the bar. --mi-bar-gap is
     the breathing room below it. */
  --mi-bar-gap: 1.5rem;
  padding-top: calc(var(--mi-bar-h) + var(--mi-bar-gap));
  line-height: 1.6;
}

.mi-wrap { max-width: 1140px; margin: 0 auto; padding: 0 1.1rem 4rem; }
.mi-wrap--narrow { max-width: 820px; }

/* ---------- typography ---------- */

.mi-page-head { margin: 0 0 1.6rem; }
.mi-page-head h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin: 0 0 .35rem;
  color: var(--mi-purple);
}
[data-theme="dark"] .mi-page-head h1 { color: var(--mi-purple-dark); }
.mi-page-head p { margin: 0; color: var(--mi-muted); max-width: 62ch; }

.mi-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  margin: 2rem 0 .9rem;
  color: var(--mi-ink);
}

/* ---------- layout helpers ---------- */

.mi-grid { display: grid; gap: 1.1rem; }
.mi-grid--cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.mi-grid--stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.mi-stack { display: flex; flex-direction: column; gap: 1rem; }
.mi-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.mi-row--between { justify-content: space-between; }
.mi-spacer { flex: 1 1 auto; }

/* ---------- card ---------- */

.mi-card {
  background: var(--mi-surface);
  border: 1px solid var(--mi-line);
  border-radius: var(--mi-radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--mi-shadow);
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.mi-card h2, .mi-card h3 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 1.2rem; }
.mi-card a { color: var(--mi-purple); text-decoration: none; }
[data-theme="dark"] .mi-card a { color: var(--mi-purple-dark); }
.mi-card a:hover { text-decoration: underline; }
.mi-card__title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.22rem; line-height: 1.3; }
.mi-card__meta { color: var(--mi-muted); font-size: .86rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.mi-card__excerpt {
  color: var(--mi-ink);
  font-size: .95rem;
  margin: 0;
  /* Poetry line breaks are meaningful, so they are preserved rather than collapsed. */
  white-space: pre-wrap;
  font-family: 'Playfair Display', Georgia, serif;
}
.mi-card--feature { border-color: var(--mi-gold); }
.mi-card--muted { opacity: .72; }

/* ---------- badge ---------- */

.mi-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .22rem .55rem;
  border-radius: 999px;
  background: var(--mi-purple-soft);
  color: var(--mi-purple);
  border: 1px solid transparent;
  white-space: nowrap;
}
[data-theme="dark"] .mi-badge { color: var(--mi-purple-dark); }
.mi-badge--gold { background: #fdf3d7; color: #7a5b00; }
[data-theme="dark"] .mi-badge--gold { background: #3d3312; color: var(--mi-gold-bright); }
.mi-badge--open { background: #e4f4ea; color: var(--mi-success); }
[data-theme="dark"] .mi-badge--open { background: #17301f; color: var(--mi-success); }
.mi-badge--closed { background: #f1ece7; color: var(--mi-muted); }
[data-theme="dark"] .mi-badge--closed { background: #2a2621; color: var(--mi-muted); }
.mi-badge--danger { background: #fdeceb; color: var(--mi-danger); }
[data-theme="dark"] .mi-badge--danger { background: #3a1c1a; color: var(--mi-danger); }

/* ---------- stat ---------- */

.mi-stat {
  background: var(--mi-surface);
  border: 1px solid var(--mi-line);
  border-radius: var(--mi-radius);
  padding: .85rem 1rem;
  text-align: center;
}
.mi-stat__value { font-family: 'Playfair Display', Georgia, serif; font-size: 1.5rem; color: var(--mi-purple); }
[data-theme="dark"] .mi-stat__value { color: var(--mi-purple-dark); }
.mi-stat__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mi-muted); }

/* ---------- buttons ---------- */

.mi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  padding: .58rem 1.05rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--mi-purple);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.mi-btn:hover { transform: translateY(-1px); text-decoration: none; }
.mi-btn:active { transform: translateY(0); }
.mi-btn:disabled, .mi-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.mi-btn--ghost { background: transparent; color: var(--mi-purple); border-color: currentColor; }
[data-theme="dark"] .mi-btn--ghost { color: var(--mi-purple-dark); }
.mi-btn--gold { background: var(--mi-gold); color: #fff; }
.mi-btn--danger { background: var(--mi-danger); color: #fff; }
.mi-btn--quiet { background: var(--mi-purple-soft); color: var(--mi-purple); }
[data-theme="dark"] .mi-btn--quiet { color: var(--mi-purple-dark); }
.mi-btn--sm { font-size: .8rem; padding: .35rem .75rem; }
.mi-btn--block { width: 100%; }

.mi-btn[data-busy="true"] { position: relative; color: transparent !important; }
.mi-btn[data-busy="true"]::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1em; height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #fff;
  animation: mi-spin .7s linear infinite;
}
@keyframes mi-spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */

.mi-field { display: flex; flex-direction: column; gap: .3rem; }
.mi-field label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--mi-muted); }
.mi-field input, .mi-field textarea, .mi-field select {
  font: inherit;
  padding: .6rem .7rem;
  border-radius: 10px;
  border: 1px solid var(--mi-line);
  background: var(--mi-surface);
  color: var(--mi-ink);
  width: 100%;
}
.mi-field textarea { min-height: 110px; resize: vertical; }
.mi-field input:focus, .mi-field textarea:focus, .mi-field select:focus {
  outline: 2px solid var(--mi-purple);
  outline-offset: 1px;
}
.mi-field__hint { font-size: .78rem; color: var(--mi-muted); }
.mi-form { display: grid; gap: 1rem; }
.mi-form--two { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- alert / empty / loading ---------- */

.mi-alert {
  border-radius: 10px;
  padding: .7rem .9rem;
  font-size: .9rem;
  border: 1px solid;
  margin: 0 0 1rem;
}
.mi-alert--error { background: #fdeceb; border-color: #f3c4c1; color: var(--mi-danger); }
.mi-alert--ok { background: #e4f4ea; border-color: #b6ddc6; color: var(--mi-success); }
[data-theme="dark"] .mi-alert--error { background: #3a1c1a; border-color: #5e2a26; }
[data-theme="dark"] .mi-alert--ok { background: #17301f; border-color: #27512f; }
.mi-alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }

.mi-empty { text-align: center; color: var(--mi-muted); padding: 2.4rem 1rem; }
.mi-loading { text-align: center; color: var(--mi-muted); padding: 2.4rem 1rem; }

/* ---------- tabs ---------- */

.mi-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin: 0 0 1.3rem; border-bottom: 1px solid var(--mi-line); }
.mi-tab {
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--mi-muted);
  padding: .55rem .8rem;
  cursor: pointer;
}
.mi-tab[aria-selected="true"] { color: var(--mi-purple); border-bottom-color: var(--mi-purple); }
[data-theme="dark"] .mi-tab[aria-selected="true"] { color: var(--mi-purple-dark); border-bottom-color: var(--mi-purple-dark); }

/* ---------- avatar ---------- */

.mi-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--mi-purple-soft);
  flex: 0 0 auto;
}
.mi-avatar--lg { width: 68px; height: 68px; }
/* Inline size, for an avatar sitting in a text row (a comment, a member row).
   .mi-avatar is 38px on its own, which is too tall beside 0.9rem text. */
.mi-avatar--sm { width: 26px; height: 26px; font-size: .68rem; }

/* Initials disc: the fallback for a member with no uploaded avatar, or a
   broken one. Colours are assigned from the name by members-ui.js. */
.mi-avatar--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: .82rem;
  line-height: 1;
  letter-spacing: .02em;
  user-select: none;
}

/* ---------- rank medallion ---------- */

.mi-rank {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  background: var(--mi-purple-soft);
  color: var(--mi-purple);
  flex: 0 0 auto;
}
[data-theme="dark"] .mi-rank { color: var(--mi-purple-dark); }
.mi-rank--1 { background: #fdf0cd; color: #8a6500; }
.mi-rank--2 { background: #eef0f2; color: #5c636b; }
.mi-rank--3 { background: #f6e7d8; color: #8a5a2b; }

/* ---------- leaderboard ---------- */

.mi-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.mi-board__row {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  background: var(--mi-surface);
  border: 1px solid var(--mi-line);
  border-radius: var(--mi-radius);
  padding: .85rem 1rem;
}
.mi-board__row--winner { border-color: var(--mi-gold); }
.mi-board__body { flex: 1 1 auto; min-width: 0; }
.mi-board__title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.05rem; margin: 0; }
.mi-board__votes { font-weight: 700; color: var(--mi-purple); white-space: nowrap; }
[data-theme="dark"] .mi-board__votes { color: var(--mi-purple-dark); }

/* ---------- feed ---------- */

.mi-post { border-bottom: 1px solid var(--mi-line); padding: 1.1rem 0; }
.mi-post:last-child { border-bottom: 0; }
.mi-post__head { display: flex; gap: .65rem; align-items: center; margin-bottom: .5rem; }
/* The author link is an avatar now, not a name: the community area shows no
   usernames anywhere. It gets a focus ring instead of an underline, and the
   ring is what a keyboard user actually needs here. */
.mi-author-link {
  display: inline-flex;
  align-items: center;
  border-radius: 50%;
  line-height: 0;
  flex: 0 0 auto;
}
.mi-author-link:hover .mi-avatar,
.mi-author-link:focus-visible .mi-avatar { box-shadow: 0 0 0 2px var(--mi-purple); }
.mi-author-link:focus-visible { outline: 2px solid var(--mi-purple); outline-offset: 2px; }
.mi-post__when { font-size: .78rem; color: var(--mi-muted); }
.mi-post__actions { display: flex; gap: .5rem; align-items: center; margin-top: .7rem; flex-wrap: wrap; }
.mi-like {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  background: none;
  border: 1px solid var(--mi-line);
  border-radius: 999px;
  color: var(--mi-muted);
  padding: .3rem .7rem;
  cursor: pointer;
}
.mi-like.liked { background: var(--mi-purple-soft); color: var(--mi-purple); border-color: transparent; }
[data-theme="dark"] .mi-like.liked { color: var(--mi-purple-dark); }

.mi-comments { margin-top: .8rem; padding-left: .8rem; border-left: 2px solid var(--mi-line); display: flex; flex-direction: column; gap: .6rem; }
.mi-comment { font-size: .92rem; }

/* ---------- prize table ---------- */

.mi-prizes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.mi-prize { display: flex; gap: .7rem; align-items: baseline; }
.mi-prize__place { font-weight: 700; color: var(--mi-gold); min-width: 1.6rem; }

/* ---------- dialog ---------- */

.mi-dialog {
  border: 0;
  border-radius: var(--mi-radius);
  padding: 0;
  max-width: 560px;
  width: calc(100% - 2rem);
  background: var(--mi-surface);
  color: var(--mi-ink);
  box-shadow: var(--mi-shadow-lg);
}
.mi-dialog::backdrop { background: rgba(20, 18, 16, .55); }
.mi-dialog__body { padding: 1.3rem 1.4rem; display: grid; gap: 1rem; }
.mi-dialog__title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.3rem; margin: 0; }

/* ---------- toast ---------- */

.mi-toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%) translateY(140%);
  background: var(--mi-ink);
  color: var(--mi-page);
  padding: .7rem 1.1rem;
  border-radius: 999px;
  box-shadow: var(--mi-shadow-lg);
  font-size: .9rem;
  z-index: 9000;
  transition: transform .25s ease;
  max-width: min(90vw, 460px);
  text-align: center;
}
.mi-toast.show { transform: translateX(-50%) translateY(0); }
.mi-toast--error { background: var(--mi-danger); color: #fff; }

/* ---------- nav ---------- */

.mi-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1200;
  background: var(--mi-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
/* Full-bleed bar with poems.html's own metrics: 1200px of content, centred, with
   the items spread edge to edge. The safe-area insets keep the logo off the notch
   and the drawer off the home indicator.

   The padding is poems.html's `nav { padding: 10px 20px }`. No height is written
   down: the bar is padding + its tallest item, and on a desktop that is the 1.6rem
   Playfair wordmark's line box, so 10 + 41 + 10 = 61px -- exactly what poems.html
   computes from the same padding around the same wordmark. Change the padding or
   the logo and both bars move together, which is the point. */
.mi-nav__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  /* poems.html: nav { padding: 10px 20px }. Preserve the same full-width edges,
     and only add safe-area insets without reordering them. The order is
     top/right/bottom/left; adding env(safe-area-inset-right) to right and
     env(safe-area-inset-left) to left keeps the bar length full like poems.html. */
  padding: 10px max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  box-sizing: border-box;
  position: relative;
}
/* The logo is poems.html's, at poems.html's sizes, on every screen.

   Desktop: a 37px image with an 8px gap, then the wordmark in Playfair Display
   700 at 1.6rem. The image is not what sets the height here -- the wordmark's line
   box is taller -- which is why the wordmark is never hidden, and why removing it
   would silently shorten the bar.

   768px and down: 28px image, .5rem gap, 1.1rem wordmark.
   480px and down: 22px image, .4rem gap, 1.1rem wordmark.

   Declared in full rather than inherited from style.css so stylesheet order cannot
   undo it, and so the dark theme can still repaint it. */
.mi-nav__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--mi-purple);
  flex-shrink: 0;
  min-width: fit-content;
}
.mi-nav__logo-img {
  width: 37px;
  height: 37px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  border-radius: 0;
}
.mi-nav__logo-text {
  /* Never display:none. See the note above: this line box is what makes the bar
     61px on a desktop, and hiding it would shorten the header. */
  display: inline-block;
  font-family: 'Playfair Display', 'Inter', serif;
  font-size: 1.6rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--mi-purple);
}
.mi-nav__logo-text .logo-highlight {
  color: #fff;
  text-shadow:
    0 0 2px var(--mi-purple),
    0 0 4px var(--mi-purple),
    0 0 6px var(--mi-purple);
}
[data-theme="dark"] .mi-nav__logo,
[data-theme="dark"] .mi-nav__logo-text { color: #a78bfa; }
.mi-nav__links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
  /* No wrapping. The bar's height is padding plus the logo, and a second row of
     links would quietly make it taller than the homepage's -- which is the one
     thing these rules exist to prevent. */
  flex-wrap: nowrap;
}
.mi-nav__links a {
  text-decoration: none;
  color: var(--mi-ink);
  font-weight: 500;
  font-size: .95rem;
  transition: color .2s;
}
.mi-nav__links a:hover,
.mi-nav__links a[aria-current="page"] { color: var(--mi-purple); }
[data-theme="dark"] .mi-nav__links a:hover,
[data-theme="dark"] .mi-nav__links a[aria-current="page"] { color: var(--mi-purple-dark); }
.mi-nav__right {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: auto;
}
/* One control shape for both menu buttons. The open toggle and the overlay's
   close are the same gesture in the same corner of the screen, so they are
   declared once and are genuinely the same size: same box, same glyph, same
   hover. They used to be declared separately at 1.5rem and 2.2rem, and the
   mismatch read as a rendering fault rather than a choice. */
.mi-nav__toggle,
.mi-overlay-menu__close {
  width: var(--mi-toggle-box);
  height: var(--mi-toggle-box);
  min-width: var(--mi-toggle-box);
  min-height: var(--mi-toggle-box);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--mi-ink);
  background: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: color .2s, background-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.mi-nav__toggle { display: none; }
.mi-nav__toggle:hover,
.mi-overlay-menu__close:hover {
  color: var(--mi-purple);
  background: var(--mi-purple-soft);
}
[data-theme="dark"] .mi-nav__toggle:hover,
[data-theme="dark"] .mi-overlay-menu__close:hover { color: var(--mi-purple-dark); }
.mi-nav__toggle:focus-visible,
.mi-overlay-menu__close:focus-visible {
  outline: 2px solid var(--mi-purple);
  outline-offset: 2px;
}

/* ---------- signed-in identity ---------- */

/* Empty until members-ui.js resolves the session, then either the member's
   stored avatar and name or the sign-in link. */
.mi-nav__identity {
  display: flex;
  align-items: center;
}
.mi-nav__me {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--mi-ink);
  font-weight: 600;
  font-size: .92rem;
  max-width: 190px;
}
.mi-nav__me:hover { color: var(--mi-purple); }
[data-theme="dark"] .mi-nav__me { color: var(--mi-ink); }
[data-theme="dark"] .mi-nav__me:hover { color: var(--mi-purple-dark); }
.mi-nav__me .mi-avatar {
  width: 30px;
  height: 30px;
  font-size: .7rem;
}
.mi-nav__signin {
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  color: var(--mi-purple);
  white-space: nowrap;
}
[data-theme="dark"] .mi-nav__signin { color: var(--mi-purple-dark); }
.mi-nav__signin:hover { text-decoration: underline; }

/* ---------- phone overlay menu (poems.html's overlay-menu) ---------- */

/* The full-screen phone menu. Same contract as poems.html's .overlay-menu.

   It used to carry `display: none` here and `display: flex` on .open, which is why
   it never slid: a display change and a transform change in the same frame give
   the transform nothing to animate from, so the panel snapped in, and on the way
   out display:none applied at once and the slide-away was never seen at all.

   So the panel is always laid out -- it is position:fixed, so that costs nothing --
   and visibility, opacity, transform and pointer-events do the work. visibility
   also takes its links out of the tab order while it is closed, and the delayed
   visibility change lets the slide-out finish before the panel disappears. */
.mi-overlay-menu {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: rgba(255, 255, 255, .98);
  backdrop-filter: blur(6px);
  z-index: 9999;
  flex-direction: column;
  align-items: stretch;
  padding: 70px 32px 40px;
  transform: translateX(100%);
  visibility: hidden;
  opacity: 0;
  /* pointer-events is what stops a closed, still-present panel from swallowing the
     taps meant for the page underneath. */
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, visibility 0s .3s;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
[data-theme="dark"] .mi-overlay-menu { background: rgba(28, 26, 23, .98); }
.mi-overlay-menu.open {
  transform: translateX(0);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity .3s ease, transform .3s ease, visibility 0s 0s;
}
.mi-overlay-menu > a {
  font-size: 1.5rem;
  font-weight: 400;
  text-decoration: none;
  color: var(--mi-purple);
  padding: 14px 0;
  border-bottom: 1px solid rgba(75, 42, 173, .10);
  transition: .2s;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  text-align: left;
  width: 100%;
}
[data-theme="dark"] .mi-overlay-menu > a { color: var(--mi-purple-dark); }
.mi-overlay-menu > a:hover {
  color: #2d1a6b;
  padding-left: 8px;
  border-bottom-color: var(--mi-purple);
}
.mi-overlay-menu > a[aria-current="page"] { color: var(--mi-ink); }
.mi-overlay-menu__row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1.25rem;
}
.mi-overlay-menu__row .night-toggle .theme-label { display: inline; }
.mi-nav__identity--overlay {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mi-line);
}
.mi-nav__identity--overlay .mi-nav__me .mi-avatar {
  width: 38px;
  height: 38px;
  font-size: .82rem;
}
.mi-nav__identity--overlay .mi-nav__signin { font-size: 1.1rem; }

.night-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font: inherit;
  font-size: .82rem;
  background: none;
  border: 1px solid var(--mi-line);
  border-radius: 999px;
  color: var(--mi-muted);
  padding: .3rem .7rem;
  cursor: pointer;
}
.mi-nav__toggle:hover .theme-label { color: var(--mi-ink); }

@media (max-width: 768px) {
  /* Phone bar: poems.html's own numbers, so the header is the same height on the
     community pages as on the reading pages -- 60px here, 44px under 480px. The
     height lives in ONE variable because the bar and the body's offset were
     separate literals, and when they drifted the first line of text slid up
     underneath the fixed bar. --mi-bar-gap is the breathing room below it.
     members-ui.js then measures the real bar and rewrites --mi-bar-h, so the
     offset cannot disagree with the bar however the phone is set up. */
  :root { --mi-bar-h: calc(60px + env(safe-area-inset-top, 0px)); }
  /* body.mi-body's padding-top already reads --mi-bar-h, so only the variable is
     overridden here. */
  /* The overlay is a full-screen menu, so the page behind it must not scroll. */
  body.mi-nav-open { overflow: hidden; }
  .mi-nav__bar {
    /* poems.html at 768px uses height: 60px !important on nav. Mirror that height
       exactly so the bar is the same length/size from top to bottom, while
       still allowing safe-area insets to breathe at the top. */
    height: 60px;
    min-height: 60px;
    padding: env(safe-area-inset-top, 0px) 1.2rem 0;
    gap: 12px;
    flex-wrap: nowrap;
  }
  /* poems.html's phone logo: a 28px image, .5rem gap, and the same 1.1rem
     wordmark it uses. The bar itself is a fixed 60px, so the logo is sized to fit
     inside that rather than to define it. */
  .mi-nav__logo { gap: .5rem; }
  .mi-nav__logo-text { font-size: 1.1rem; }
  .mi-nav__logo-text .logo-highlight {
    color: #ffffff;
    text-shadow:
      0 0 2px #4b2aad,
      0 0 4px #4b2aad,
      0 0 6px #4b2aad;
  }
  .mi-nav__logo-img { width: 28px; height: 28px; }
  /* Sits above the overlay so it stays tappable and closes the menu again. */
  .mi-nav__toggle {
    display: flex;
    position: relative;
    z-index: 10000;
  }
  /* The links live in the overlay on a phone, exactly as in poems.html, so the
     bar keeps only the logo and the toggle and the row is hidden here. */
  .mi-nav__links { display: none; }
  .mi-nav__right { margin-left: auto; }
  .mi-overlay-menu {
    padding: 65px 24px calc(30px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .mi-overlay-menu__close { top: max(14px, env(safe-area-inset-top, 0px)); right: max(14px, env(safe-area-inset-right, 0px)); }
  .mi-overlay-menu > a { min-height: 44px; }

  /* --- page content, sized for the phone --- */

  /* auto-fill's floor is a hard minimum: on a 320px screen the 1.1rem gutters
     leave less than 290px, so a single card column would overflow. min() lets
     the track shrink to whatever the screen actually has. */
  .mi-wrap { padding: 0 1rem 3rem; }
  .mi-grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); }
  .mi-grid--stats { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
  .mi-form--two { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
  /* Long titles and unbroken words must wrap, not push the page wide. */
  .mi-wrap, .mi-card, .mi-board__row, .mi-post, .mi-dialog__body { overflow-wrap: break-word; }

  /* 44px touch targets for anything tappable. */
  .mi-btn { min-height: 44px; padding: .58rem 1.15rem; }
  .mi-btn--sm { min-height: 38px; }
  .mi-like { min-height: 44px; padding: .45rem .85rem; }
  .mi-tab { min-height: 44px; padding: .55rem .8rem; }
  .mi-field input, .mi-field textarea, .mi-field select { min-height: 44px; }

  /* A long form has to scroll inside the dialog rather than run off the screen. */
  .mi-dialog { max-height: 88vh; max-height: 88dvh; overflow-y: auto; }
  .mi-toast { bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 480px) {
  :root { --mi-bar-h: calc(44px + env(safe-area-inset-top, 0px)); }
  /* index.html steps the wordmark down to 1.1rem here but leaves the image at
     30px, so the image is no longer overridden. */
  .mi-nav__logo-text { font-size: 1.1rem; }
  /* poems.html's 480px step: a 22px image and a .4rem gap. */
  .mi-nav__logo-img { width: 22px; height: 22px; }
  .mi-nav__logo { gap: .4rem; }
  /* poems.html's 480px step for the menu sheet itself: tighter gutters, and the
     links and the ✕ shrink with them so a long list still fits without the top
     item hiding under the close button. */
  .mi-overlay-menu { padding: 60px 20px calc(30px + env(safe-area-inset-bottom, 0px)); }
  .mi-overlay-menu > a { font-size: 1.3rem; padding: 12px 0; }
  .mi-overlay-menu__close { font-size: 1.3rem; }
  .mi-nav__bar {
    height: 44px;
    min-height: 44px;
    padding: env(safe-area-inset-top, 0px) 0.8rem 0;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
  .mi-card { padding: .95rem 1rem; }
  .mi-dialog__body { padding: 1.1rem 1rem; }
  .mi-tabs { gap: .15rem; }
}

/* The last two steps of index.html's own logo ladder, so the wordmark shrinks on
   a narrow phone exactly as it does on the homepage instead of overflowing. */
@media (min-width: 769px) {
  /* poems.html's only two breakpoints are 768px and 480px, so there is no 400px
     or 380px step here either -- matching it at every width it defines is the
     whole point, and inventing extra steps is how two bars drift apart again. */
  .mi-nav__logo { margin-right: 20px; }
  /* The overlay is a phone affordance; on a desktop the links are in the bar. */
  .mi-overlay-menu { display: none !important; }
}

/* ---------- search and filter toolbar ---------- */

.mi-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1.2rem;
}
.mi-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}
.mi-search input {
  width: 100%;
  min-height: 44px;
  padding: .55rem 2.4rem .55rem .9rem;
  font: inherit;
  font-size: .95rem;
  color: var(--mi-ink);
  background: var(--mi-surface);
  border: 1px solid var(--mi-line);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}
.mi-search input::-webkit-search-cancel-button { display: none; }
.mi-search input:focus-visible {
  outline: 2px solid var(--mi-purple);
  outline-offset: 1px;
  border-color: var(--mi-purple);
}
/* The clear button sits inside the field, so the padding above keeps the typed
   text from running underneath it. */
.mi-search__clear {
  position: absolute;
  top: 50%;
  right: .3rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--mi-muted);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.mi-search__clear:hover { color: var(--mi-ink); background: var(--mi-purple-soft); }
.mi-search__clear:focus-visible { outline: 2px solid var(--mi-purple); outline-offset: 1px; }

.mi-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  font-size: .92rem;
  color: var(--mi-ink);
  cursor: pointer;
  user-select: none;
}
.mi-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--mi-purple);
  cursor: pointer;
}
.mi-toggle:focus-within {
  outline: 2px solid var(--mi-purple);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Available to screen readers, invisible on screen. Used for labels that would
   otherwise be visual noise, like the search box's. */
.mi-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- load more ---------- */

.mi-loadmore {
  display: flex;
  justify-content: center;
  margin-top: 1.6rem;
}

/* ---------- reduced motion ---------- */

/* Everything above animates on a short transition, and the busy spinner on a
  saving button runs forever. Vestibular disorders make both genuinely
  unpleasant, and the OS-level setting that asks for this is one tap away in the
  same place as the text size.
*/
@media (prefers-reduced-motion: reduce) {
  .mi-body *,
  .mi-body *::before,
  .mi-body *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .mi-btn[data-busy="true"]::after {
    /* Stopped, not hidden: the ring is the only signal that a save is still in
       flight, so it stays on screen as a static shape rather than vanishing and
       leaving the button looking idle while it is busy. */
    animation: none !important;
  }
}
