/* The Community landing, in MySpell's own style (myspell.css does the boxes and buttons). v3: a hero, faces, pictures, motion.
   No inline styles anywhere (CSP): colours come from classes, motion from .cm-motion / .cm-in set by community.js. */
.ms-logo-my, .ms-logo-spell { white-space: nowrap; }
.cm-body .ms-logo { font-size: 26px; }
.cm-body { overflow-x: hidden; --cm-news: #ffb26b; --cm-patch: #9fd36b; --cm-roadmap: #a98bf5; --cm-other: #8fd8ff; }

/* ---------- the hero ---------- */
.cm-hero { position: relative; margin: 0; padding: 104px 16px 40px; min-height: 340px; display: flex; align-items: flex-end; isolation: isolate;
  background: #0c0a0b url("art/community/plaza.webp") center 35% / cover no-repeat; border-bottom: 1px solid var(--line-2); }
.cm-hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(12, 10, 11, .92) 0%, rgba(12, 10, 11, .66) 45%, rgba(12, 10, 11, .25) 100%), linear-gradient(0deg, #0c0a0b 0%, rgba(12, 10, 11, 0) 40%); }
.cm-hero::after { content: ""; position: absolute; left: -8%; bottom: -30%; width: 55%; height: 90%; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 106, 31, .28), rgba(255, 106, 31, 0) 65%); animation: cm-ember 5s ease-in-out infinite alternate; }
.cm-hero-in { width: 100%; max-width: 1068px; margin: 0 auto; }
.cm-kicker { margin: 0 0 6px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ember-2, #ffb26b); }
.cm-hero h1 { margin: 0; font: 400 clamp(36px, 6.4vw, 68px)/1.02 var(--serif); letter-spacing: -.01em; max-width: 14em; }
.cm-hero h1 em { color: var(--ember-2, #ffb26b); }
.cm-welcome { margin: 10px 0 0; max-width: 34em; color: var(--ink-2); font-size: clamp(15px, 2vw, 18px); }
.cm-live-pill { display: inline-flex; align-items: center; gap: 8px; margin: 14px 0 0; padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(12, 10, 11, .6); font-size: 14px; color: var(--ink-2); }
.cm-live-pill b { color: var(--ink); }
.cm-hero-btns { margin: 16px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.cm-pulse { position: relative; flex: none; width: 9px; height: 9px; border-radius: 50%; background: #5fd37a; box-shadow: 0 0 8px #5fd37a; }
.cm-pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #5fd37a; opacity: 0; animation: cm-ping 2.2s ease-out infinite; }
@keyframes cm-ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes cm-ember { from { opacity: .55; transform: scale(1); } to { opacity: 1; transform: scale(1.08); } }

.cm-body .ms-bar { margin-top: 0; border-radius: 0; border-top: 0; box-sizing: border-box; }
.cm-body .ms-main { border-radius: 0 0 10px 10px; }

/* ---------- Dev Corner: cards with a picture and a coloured tag ---------- */
.cm-dev { border-color: rgba(255, 106, 31, .4); background: linear-gradient(rgba(255, 106, 31, .08), rgba(255, 106, 31, .01)); }
.cm-dev-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.cm-dev-item { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(0, 0, 0, .25);
  transition: transform .25s, border-color .25s, box-shadow .25s; }
.cm-dev-item:hover { transform: translateY(-3px); border-color: var(--ember); box-shadow: 0 10px 26px rgba(0, 0, 0, .45); }
.cm-dev-pic { display: block; aspect-ratio: 16 / 7; background: #151112; overflow: hidden; }
.cm-dev-img, .cm-dev-art { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.cm-dev-item:hover .cm-dev-img, .cm-dev-item:hover .cm-dev-art { transform: scale(1.05); }
.cm-art-news { background: url("art/community/news.webp") center / cover; }
.cm-art-patch { background: url("art/community/patch.webp") center / cover; }
.cm-art-roadmap { background: url("art/community/roadmap.webp") center / cover; }
.cm-art-other { background: url("art/community/general.webp") center / cover; }
.cm-dev-body { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.cm-dev-lead { grid-column: 1 / -1; }
.cm-dev-lead .cm-dev-pic { aspect-ratio: 16 / 6; }
.cm-dev-lead h3 { font: 400 clamp(24px, 3.4vw, 34px)/1.12 var(--serif); margin: 2px 0; }
@media (min-width: 760px) {
  .cm-dev-lead { flex-direction: row; }
  .cm-dev-lead .cm-dev-pic { flex: 0 0 46%; aspect-ratio: auto; min-height: 220px; }
  .cm-dev-lead .cm-dev-body { padding: 16px 20px; justify-content: center; }
}
.cm-dev-item h3 { font-size: 17px; margin: 2px 0; line-height: 1.25; }
.cm-dev-item h3 a { color: var(--ink); text-decoration: none; }
.cm-dev-item h3 a:hover { color: var(--ember-2); }
.cm-dev-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; font-size: 12px; color: var(--ink-3); }
.cm-dev-text { color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; margin: 2px 0; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cm-dev-lead .cm-dev-text { -webkit-line-clamp: 5; line-clamp: 5; font-size: 15px; }
.cm-dev-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: auto 0 0; padding-top: 6px; font-size: 13px; }
.cm-read { margin-left: auto; color: var(--ember-2); text-decoration: none; font-weight: 600; }
.cm-read:hover { text-decoration: underline; }
.cm-more { margin: 12px 0 0; font-size: 13px; color: var(--ink-3); }
.cm-tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #150d08; background: var(--cm-other); }
.cm-tag.cm-b-news { background: var(--cm-news); }
.cm-tag.cm-b-patch { background: var(--cm-patch); }
.cm-tag.cm-b-roadmap { background: var(--cm-roadmap); }

/* ---------- columns, feed ---------- */
.cm-cols { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .cm-cols { grid-template-columns: minmax(0, 1fr); } }
.cm-main, .cm-side { min-width: 0; }

.cm-feed-list, .cm-pin-list, .cm-can, .cm-here { list-style: none; margin: 0; padding: 0; }
.cm-feed-item { position: relative; display: flex; gap: 12px; align-items: center; padding: 9px 8px; margin: 0 -8px; border-radius: 8px; border-bottom: 1px solid var(--line);
  font-size: 14px; overflow-wrap: anywhere; transition: background .2s; }
.cm-feed-item:hover { background: rgba(255, 255, 255, .03); }
.cm-feed-item:last-child { border-bottom: 0; }
.cm-line { flex: 1; min-width: 0; line-height: 1.45; }
.cm-line a { color: var(--ember-2); text-decoration: none; }
.cm-line a:hover { text-decoration: underline; text-underline-offset: 2px; }
.cm-when { display: inline-block; margin-left: 4px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.cm-thumb { flex: none; display: block; width: 88px; height: 56px; border-radius: 6px; overflow: hidden; background: #0c0a0b; border: 1px solid var(--line-2); }
.cm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-solved { color: #7fe08f; font-weight: 600; font-size: 12px; }
.cm-new { background: linear-gradient(90deg, rgba(255, 106, 31, .13), rgba(255, 106, 31, 0) 70%); box-shadow: inset 3px 0 0 var(--ember); }
.cm-new .cm-when::after { content: " · new"; color: var(--ember-2); font-weight: 600; }

.cm-who { position: relative; flex: none; display: inline-flex; }
.cm-ev { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; line-height: 1;
  color: #150d08; background: #b9ada0; border: 2px solid var(--bg-2, #151112); }
.cm-ev-solo { position: static; width: 34px; height: 34px; font-size: 16px; border-width: 0; }
.cm-ev-thread { background: #ffb26b; } .cm-ev-reply { background: #8fd8ff; } .cm-ev-page, .cm-ev-page-new { background: #c3a2ff; }
.cm-ev-shot { background: #ff8aa8; } .cm-ev-solved { background: #5fd37a; } .cm-ev-badge { background: #ffd54a; }

.cm-bubble { flex: none; display: inline-flex; border-radius: 50%; }
.cm-face { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line-2); background: #0c0a0b; transition: transform .2s, border-color .2s; }
.cm-sm .cm-face { width: 24px; height: 24px; }
.cm-letter { display: inline-flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 700; background: #3a2f2b; }
.cm-bubble:hover .cm-face { border-color: var(--ember-2); transform: scale(1.08); }
.cm-staff { padding: 0 6px; border-radius: 999px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #1b1326; background: #d6a548; }
.cm-pin-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.cm-pin-list li:last-child { border: 0; }
.cm-pin-list a { text-decoration: none; color: var(--ember-2); }
.cm-pin-list a:hover { text-decoration: underline; }

/* ---------- Here now ---------- */
.cm-count { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; font-size: 16px; color: var(--ink-2); }
.cm-count b { color: var(--ink); font-size: 22px; font-family: var(--serif); font-weight: 400; }
.cm-here { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cm-live { position: relative; }
.cm-live::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #5fd37a; border: 2px solid var(--bg-2, #151112); }
.cm-nums { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.cm-nums b { color: var(--ink-2); }
.cm-join-link { color: var(--ember-2); }

.cm-cta p { margin: 0 0 8px; color: var(--ink-2); }
.cm-can { display: grid; gap: 7px; margin-top: 12px; font-size: 14px; }
.cm-can li { display: flex; gap: 10px; align-items: baseline; }
.cm-can li > span:first-child { flex: none; width: 22px; text-align: center; }
.cm-can b { color: var(--ink); }

/* ---------- empty states ---------- */
.cm-empty { color: var(--ink-3); margin: 0; }
.cm-empty-big { text-align: center; padding: 22px 12px; border: 1px dashed var(--line-2); border-radius: 10px; }
.cm-empty-big p { margin: 6px 0; color: var(--ink-2); }
.cm-empty-ico { display: block; font-size: 34px; margin-bottom: 4px; animation: cm-bob 3s ease-in-out infinite; }
@keyframes cm-bob { 50% { transform: translateY(-4px); } }

/* ---------- Spellpage cards, each in its OWN theme and accent ---------- */
.cm-pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cm-pc-grid-big { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.cm-pc { --ac: #ff6a1f; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 0 10px 14px; overflow: hidden;
  text-decoration: none; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--ac) 55%, transparent); background: var(--ms-panel, #1d1819); color: var(--ms-ink, var(--ink));
  transition: transform .25s, box-shadow .25s; }
.cm-pc:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0, 0, 0, .45), 0 0 0 1px var(--ac); }
.cm-pc-banner { align-self: stretch; margin: 0 -10px; height: 48px; background: var(--ms-bg, #121a10); border-bottom: 3px solid var(--ac); overflow: hidden; position: relative; }
.cm-pc-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, color-mix(in srgb, var(--ac) 45%, transparent), transparent 70%); }
.cm-pc-big .cm-pc-banner { height: 82px; }
.cm-pc-banner-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-pc-pic { position: relative; z-index: 1; width: 64px; height: 64px; margin-top: -30px; border-radius: 50%; object-fit: cover; background: #0c0a0b; border: 3px solid var(--ac); }
.cm-pc-name { font-weight: 700; overflow-wrap: anywhere; margin-top: 4px; }
.cm-pc-handle { font-size: 12px; color: var(--ac); }
.cm-pc-line { font-size: 13px; color: var(--ms-ink-2, var(--ink-2)); overflow-wrap: anywhere; }
.cm-pc[data-theme="parchment"] .cm-pc-handle { filter: brightness(.6); }
.cm-ac-ember { --ac: #ff6a1f; } .cm-ac-gold { --ac: #d6a548; } .cm-ac-moss { --ac: #9fd36b; } .cm-ac-jade { --ac: #3fbf9a; }
.cm-ac-frost { --ac: #8fd8ff; } .cm-ac-violet { --ac: #8d62f2; } .cm-ac-rose { --ac: #e86a8a; } .cm-ac-bone { --ac: #efe6da; }

/* ---------- compact Spellpage rows in the sidebar (each in its own theme + accent) ---------- */
.cm-pr { --ac: #ff6a1f; display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 8px; min-width: 0; text-decoration: none; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--ac) 50%, transparent); border-left: 4px solid var(--ac); background: var(--ms-panel, #1d1819); color: var(--ms-ink, var(--ink));
  transition: transform .2s, box-shadow .2s; }
.cm-pr:hover { transform: translateX(3px); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.cm-pr-pic { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #0c0a0b; border: 2px solid var(--ac); }
.cm-pr-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cm-pr-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-pr-line { font-size: 12px; color: var(--ms-ink-2, var(--ink-2)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-pr .ms-npc { align-self: flex-start; font-size: 10px; }
.cm-pr-label { margin: 10px 0 5px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.cm-pr-label:first-of-type { margin-top: 0; }

/* ---------- boards as tiles ---------- */
.cm-board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 10px; }
.cm-board { --tc: var(--cm-other); display: flex; gap: 12px; align-items: flex-start; padding: 12px; text-decoration: none; border: 1px solid var(--line-2); border-left: 3px solid var(--tc);
  border-radius: 10px; background: var(--ms-panel, #1d1819); color: var(--ink); transition: transform .2s, border-color .2s, box-shadow .2s; }
.cm-board.cm-b-news { --tc: var(--cm-news); } .cm-board.cm-b-patch { --tc: var(--cm-patch); } .cm-board.cm-b-roadmap { --tc: var(--cm-roadmap); }
.cm-board:hover { transform: translateY(-3px); border-color: var(--tc); box-shadow: 0 8px 22px rgba(0, 0, 0, .4); }
.cm-board-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font-size: 24px; background: color-mix(in srgb, var(--tc) 18%, #0c0a0b); }
.cm-board-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cm-board-desc { font-size: 13px; color: var(--ink-2); }
.cm-board-stat { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cm-chip { padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 22%, transparent); color: var(--ink); font-size: 12px; }
.cm-board-last { font-size: 12px; color: var(--ink-3); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- gentle motion (only when community.js has switched it on) ---------- */
.cm-motion .cm-rv { opacity: 0; transform: translateY(16px); transition: opacity .6s ease var(--d, 0ms), transform .6s ease var(--d, 0ms), border-color .25s, box-shadow .25s; }
.cm-motion .cm-rv.cm-in { opacity: 1; transform: none; }
.cm-motion .cm-dev-item.cm-in:hover, .cm-motion .cm-pc.cm-in:hover, .cm-motion .cm-board.cm-in:hover { transform: translateY(-3px); transition-delay: 0s; }
@media (prefers-reduced-motion: reduce) {
  .cm-hero::after, .cm-pulse::after, .cm-empty-ico { animation: none; }
  .cm-rv, .cm-dev-item, .cm-pc, .cm-board, .cm-face { transition: none !important; opacity: 1 !important; transform: none !important; }
}

/* ---------- phones: nothing may be wider than the screen ---------- */
.cm-dev-item, .cm-feed-item > span { min-width: 0; }
@media (max-width: 820px) {
  .cm-hero { padding: 88px 16px 28px; min-height: 300px; }
  .cm-hero::before { background: linear-gradient(0deg, rgba(12, 10, 11, .94) 8%, rgba(12, 10, 11, .55) 100%); }
  .cm-body .ms-search input { width: 100%; max-width: none; } .cm-body .ms-search { margin-left: 0; flex: 1 1 100%; } .cm-body .ms-tag { flex: 1 1 100%; }
  .cm-body .ms-me { flex: 1 1 100%; }
}
@media (max-width: 520px) {
  .cm-body .ms-main { padding: 12px 10px; }
  .cm-body .ms-box { padding: 12px; } .cm-body .ms-box h2 { margin: -12px -12px 10px; padding: 7px 12px; }
  .cm-thumb { width: 64px; height: 44px; }
  .cm-dev-item:not(.cm-dev-lead) .cm-dev-text { -webkit-line-clamp: 2; line-clamp: 2; }
  .cm-dev-item:not(.cm-dev-lead) .cm-dev-pic { aspect-ratio: 16 / 6; }
  .cm-pc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .cm-pc-grid-big { grid-template-columns: minmax(0, 1fr); }
  .cm-board-grid { grid-template-columns: minmax(0, 1fr); }
  .cm-hero-btns .ms-btn { flex: 1 1 auto; text-align: center; }
}
