/* ==========================================================================
   MOTD colours.

   The palette Minecraft uses was designed for white text on a near-black
   chat background. Several of its colours are unreadable on white · §f white
   and §e yellow are the obvious ones, but §b aqua and §a green are almost as
   bad · so light mode gets its OWN values rather than the same hex codes at a
   different opacity. They keep the hue (a player recognising "the green bit"
   still sees green) while carrying enough contrast to be read.

   Class names come from src/motd.js and nowhere else. That module emits only
   the literal names below; nothing here may be driven by MOTD content.
   ========================================================================== */

.motd-rich {
  /* Dark theme = the in-game palette, unchanged. This is what the owner sees
     in their own client, and matching it is the point. */
  --mc-black: #000000;
  --mc-dark-blue: #3f48cc;      /* raised from #0000aa: pure blue on near-black is illegible */
  --mc-dark-green: #00aa00;
  --mc-dark-aqua: #00aaaa;
  --mc-dark-red: #d4342a;       /* raised from #aa0000 for the same reason */
  --mc-dark-purple: #b14ec4;    /* raised from #aa00aa */
  --mc-gold: #ffaa00;
  --mc-gray: #aaaaaa;
  --mc-dark-gray: #7c848f;      /* raised from #555555, which vanished into the panel */
  --mc-blue: #5555ff;
  --mc-green: #55ff55;
  --mc-aqua: #55ffff;
  --mc-red: #ff5555;
  --mc-light-purple: #ff55ff;
  --mc-yellow: #ffff55;
  --mc-white: #ffffff;

  /* An owner's hex colour, set by src/motd.js as an inline custom property.
     The fallback is the body colour, so a token with no usable hex is never
     invisible. */
  --mh: currentColor;

  display: inline;
  overflow-wrap: anywhere;
}

/* Light mode. Same hues, re-picked for contrast on a white panel. The bright
   end of the palette moves furthest, because that is where the problem is. */
:root[data-theme="light"] .motd-rich {
  --mc-black: #14181d;
  --mc-dark-blue: #1d2fa8;
  --mc-dark-green: #14671b;
  --mc-dark-aqua: #0d6b70;
  --mc-dark-red: #a51b13;
  --mc-dark-purple: #7d1f8f;
  --mc-gold: #8a5a00;
  --mc-gray: #5c646f;
  --mc-dark-gray: #3d444d;
  --mc-blue: #2436c4;
  --mc-green: #1a7a24;          /* #55ff55 is invisible on white */
  --mc-aqua: #0f7a80;
  --mc-red: #c02a20;
  --mc-light-purple: #a8299f;
  --mc-yellow: #7a5c00;         /* yellow on white is the worst case; goes near-brown */
  --mc-white: #2b3138;          /* "white" text has to become dark or it disappears */
}

.motd-rich .m { color: inherit; }

.motd-rich .mc-black { color: var(--mc-black); }
.motd-rich .mc-dark-blue { color: var(--mc-dark-blue); }
.motd-rich .mc-dark-green { color: var(--mc-dark-green); }
.motd-rich .mc-dark-aqua { color: var(--mc-dark-aqua); }
.motd-rich .mc-dark-red { color: var(--mc-dark-red); }
.motd-rich .mc-dark-purple { color: var(--mc-dark-purple); }
.motd-rich .mc-gold { color: var(--mc-gold); }
.motd-rich .mc-gray { color: var(--mc-gray); }
.motd-rich .mc-dark-gray { color: var(--mc-dark-gray); }
.motd-rich .mc-blue { color: var(--mc-blue); }
.motd-rich .mc-green { color: var(--mc-green); }
.motd-rich .mc-aqua { color: var(--mc-aqua); }
.motd-rich .mc-red { color: var(--mc-red); }
.motd-rich .mc-light-purple { color: var(--mc-light-purple); }
.motd-rich .mc-yellow { color: var(--mc-yellow); }
.motd-rich .mc-white { color: var(--mc-white); }

.motd-rich .mc-hex { color: var(--mh); }

.motd-rich .mb { font-weight: 700; }
.motd-rich .mi { font-style: italic; }
/* &n (underline) is parsed and carried through as .mu, but deliberately NOT
   drawn as an underline on the web.

   In-game an underline is just an underline. Here, MOTDs render inside the
   listing's own <a>, where underline is the browser's universal signal for "this
   is a link" · so an owner who writes &n produces a line that looks like a
   hyperlink to somewhere else, and on hover the real link underline lands on top
   of it. That is the "underline on the server name" report, and it is worse than
   cosmetic: it invites a click on text that is not separately clickable.

   Kept as a weight change instead. The owner's intent was emphasis, emphasis is
   what they get, and nothing competes with the link affordance. Strikethrough
   stays literal: it means "this is cancelled" and carries no link meaning. */
.motd-rich .mu { font-weight: 700; }
.motd-rich .ms { text-decoration: line-through; }

/* §k obfuscated. STATIC by design · see the note in src/motd.js. A blur plus a
   flat block colour reads as "hidden text" without a single animation frame,
   costs nothing on a page listing twenty servers, and does not fight the
   prefers-reduced-motion setting because there is no motion to reduce. */
.motd-rich .mo {
  filter: blur(0.28em);
  opacity: .8;
  user-select: none;
}

/* A MOTD inside a card or a table row must never introduce a second line and
   push the layout around. Callers that need one line pass singleLine to
   renderMotd(); this is the belt to that pair of braces. */
.motd-1line .motd-rich,
.motd-1line .motd-rich br { display: inline; }
.motd-1line .motd-rich br { content: " "; }

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