/* ==========================================================================
   KORYOS skin for MOVIM — v5 (Nov 2026; v4 layers unchanged, layer C added)
   Built from an exhaustive audit of the pinned build's stylesheets.

   THE THREE MECHANISMS (all verified, none guessed):
   1. Surface vars: RGB triplets on `body`, consumed as rgb()/rgba().
      Movim's color.css loads after us → every declaration needs
      !important (author !important also beats the accent set inline
      by Config/config.js).
   2. THE PALETTE: elements like the Discover button are
      `class="button color green"` → `.color.green { background:
      var(--p-green) }`. The 18 --p-* colors are injected by the Colors
      widget as page-inline styles, NOT defined in any css file.
      Redefining --p-* on body with !important recolors every palette-
      class element in the app: buttons, FAB, presence, bubbles, chips.
   3. Two hardcoded `background: white` rules in form.css escape both
      systems; overridden explicitly.

   Rail: body>nav re-declares the surface vars locally (higher
   specificity wins among !important), so Movim's own rules paint the
   rail dark with paper ink — no structural selector fights.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo:ital,wdth,wght@0,62..125,100..900;1,62..125,100..900&family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* --- 1. Surfaces: Koryos paper & ink (RGB triplets) --- */
body, body.nightmode {
  --movim-background:       239, 233, 218 !important;  /* #EFE9DA paper   */
  --movim-background-main:  250, 247, 238 !important;  /* #FAF7EE cream   */
  --movim-font:              33,  29,  20 !important;  /* #211D14 ink     */
  --movim-element-action:    33,  29,  20 !important;  /* pressed-paper   */
  --movim-gray:             221, 210, 184 !important;  /* #DDD2B8 paper-3 */
  --movim-header-font:      239, 233, 218 !important;
  --movim-accent:           #B8442F !important;
}
@media (prefers-color-scheme: dark) {
  body, body.nightmode {
    --movim-background:       239, 233, 218 !important;
    --movim-background-main:  250, 247, 238 !important;
    --movim-font:              33,  29,  20 !important;
    --movim-element-action:    33,  29,  20 !important;
    --movim-gray:             221, 210, 184 !important;
    --movim-header-font:      239, 233, 218 !important;
    --movim-accent:           #B8442F !important;
  }
}

/* --- 2. THE PALETTE: Movim's 18 --p-* colors → Koryos livery.
       Recolors every `.color.*` / `.button.*` / presence element. --- */
body, body.nightmode {
  --p-red:      #B8442F !important;  /* brand red            */
  --p-dorange:  #E07B57 !important;  /* coral                */
  --p-orange:   #DFAE4B !important;  /* gold                 */
  --p-amber:    #DFAE4B !important;
  --p-yellow:   #DFAE4B !important;
  --p-green:    #6F7A4C !important;  /* olive (online)       */
  --p-lgreen:   #8A9660 !important;
  --p-lime:     #8A9660 !important;
  --p-teal:     #6F7A4C !important;
  --p-cyan:     #BCA478 !important;  /* tan for the blues    */
  --p-lblue:    #BCA478 !important;
  --p-blue:     #BCA478 !important;
  --p-indigo:   #A08A5F !important;
  --p-purple:   #9C3823 !important;  /* brand-ink            */
  --p-dpurple:  #7A2C1B !important;
  --p-pink:     #E07B57 !important;
  --p-gray:     #857B63 !important;  /* warm muted           */
  --p-black:    #211D14 !important;
}

/* --- 3. form.css hardcoded whites → cream --- */
.button:not(.color),
input[type=button]:not(.color) {
  background-color: #FAF7EE !important;
}

/* --- Rail: the one dark surface. Local vars outrank body (specificity
       among equal !important), so Movim's own rules do the painting. --- */
body > nav {
  background-color: #26221A !important;              /* --panel-dark */
  --movim-font:            239, 233, 218 !important; /* paper ink    */
  --movim-background-main:  38,  34,  26 !important; /* dark pills   */
  --movim-element-action:  239, 233, 218 !important; /* light hover  */
}

/* --- Typography: Archivo body/headings, Plex Mono machine text.
       (Icon glyphs keep their own element-level font; untouched.) --- */
body, body input, body textarea, body select, body .button {
  font-family: 'Archivo','Helvetica Neue',Helvetica,Arial,sans-serif !important;
}
body h1, body h2, body h3, body h4 {
  font-family: 'Archivo','Helvetica Neue',Helvetica,Arial,sans-serif !important;
  font-stretch: 112%; font-weight: 800; letter-spacing: -0.01em;
}
body time, body code, body pre, body kbd {
  font-family: 'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace !important;
}


/* ==========================================================================
   LAYER C (v5, Nov 2026) — "field comms" voice: type, shape, livery.
   RULE FOR THIS LAYER: no colour is set here except as rgba(var(--movim-*)),
   so the rail's local vars still repaint everything inside it. This is
   what keeps layer C clear of the v1 cream-on-cream failure: structure
   is touched for FONT, CASE, SPACING and RADIUS only.
   Selectors below are the pinned build's known markup; any that miss
   show up in the Stylus walk (MOVIM-THEME.md step 1) — fix there, not blind.
   ========================================================================== */

/* C1. Paper grain, as on the main site (shows only where body shows). */
body {
  background-image: repeating-linear-gradient(0deg,
    rgba(33,29,20,.02) 0 1px, transparent 1px 4px) !important;
}

/* C2. Rail: livery stripe down its inner edge, and a wordmark on top.
       Delete the ::before block to drop the badge; nothing depends on it. */
body > nav {
  border-right: 3px solid transparent !important;
  border-image: linear-gradient(to bottom, #B8442F 0 40%, #E07B57 40% 70%, #DFAE4B 70% 100%) 1 !important;
}
body > nav::before {
  content: "KORYOS";
  display: block; flex: none;
  padding: 1rem 1.25rem .55rem;
  font-family: 'Archivo','Helvetica Neue',Helvetica,Arial,sans-serif;
  font-weight: 800; font-stretch: 118%; font-size: 1.15rem;
  letter-spacing: -.01em; line-height: 1;
  color: rgb(var(--movim-font));
  background-image: linear-gradient(to right, #B8442F 0 40%, #E07B57 40% 70%, #DFAE4B 70% 100%);
  background-size: 2rem 2px; background-repeat: no-repeat;
  background-position: 1.25rem calc(100% - .1rem);
}

/* C3. Rail entries read like a comms console: mono, caps, tracked. */
body > nav ul.list li p,
body > nav ul.list li p.line {
  font-family: 'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace !important;
  font-size: .78rem !important; font-weight: 500 !important;
  letter-spacing: .12em !important; text-transform: uppercase;
}

/* C4. Section labels ("Chatrooms", "Owners", "Messages"): the site's eyebrow. */
ul.list li.subheader,
ul.list li.subheader p,
ul.list li.subheader content p {
  font-family: 'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace !important;
  font-size: .68rem !important; font-weight: 600 !important;
  letter-spacing: .16em !important; text-transform: uppercase;
  color: rgba(var(--movim-font), .66) !important;  /* >=4.5:1 on paper (b751 sweep) */
}

/* C5. Machine text in lists: second lines (room addresses, last-message
       previews), counters, info/time slots. */
ul.list li p.line + p,
ul.list li span.info,
ul.list li span.counter,
span.counter {
  font-family: 'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace !important;
  letter-spacing: .02em;
}
ul.list li span.info { font-size: .68rem !important; }

/* C6. Tabs, chips, filter pills ("All / Connected / Contacts"): stencil caps. */
ul.tabs li, ul.tabs li a, .chip, .chips li,
ul.list li span.control .button.flat {
  font-family: 'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace !important;
  font-size: .72rem !important; font-weight: 600 !important;
  letter-spacing: .12em !important; text-transform: uppercase;
}

/* C7. Empty states ("Nothing here yet…"): headline in the site's display
       weight, body in mono at a readable ink (the grey-on-cream fix). */
.placeholder h1, .placeholder h2 {
  font-family: 'Archivo','Helvetica Neue',Helvetica,Arial,sans-serif !important;
  font-weight: 800 !important; font-stretch: 118%;
  color: rgba(var(--movim-font), .80) !important;
}
.placeholder h4, .placeholder p {
  font-family: 'IBM Plex Mono',ui-monospace,Menlo,Consolas,monospace !important;
  font-size: .8rem !important; font-weight: 500 !important;
  letter-spacing: .04em; line-height: 1.6 !important;
  color: rgba(var(--movim-font), .70) !important;
}
.placeholder i { opacity: .5; }

/* C8. 80s hardware: squared corners everywhere Movim rounds them.
       (Design intent in MOVIM-THEME.md: 2–3px radii, square avatars.) */
.button, textarea, select, .chip,
input:not([type=checkbox]):not([type=radio]):not([type=range]), .card, dialog, ul.list.card,
ul.list li span.primary.icon.bubble,
ul.list li span.primary.icon.bubble img,
span.icon.bubble, span.icon.bubble img,
.chat .bubble > div, .chat .bubble div.bubble {
  border-radius: 2px !important;
}
.button.action { border-radius: 3px !important; }   /* the FAB */

/* C9. Headings: the site's wordmark stretch (v4 had 112%). */
body h1, body h2, body h3, body h4 { font-stretch: 118%; }
.placeholder h4 { font-stretch: 100%; }

/* C10. Hide the "Universal share button" bookmarklet card on News.
        The bookmarklet is the only javascript: link Movim renders; the
        card is hidden by its link, not by a class that can drift. */
ul.list:has(a[href^="javascript:"]),
.block:has(> ul.list a[href^="javascript:"]),
.card:has(a[href^="javascript:"]) {
  display: none !important;
}
