/* A widget (templates/widget.php): all it needs and nothing more, so MXN's own stylesheets can't
   change it. Each of MXN's themes is a set of the values below, copied from MXN's
   public/style.css and themes/*.css (98, XP and 7 after 98.css, XP.css and 7.css, MIT): change one
   there, change it here. Dark mode is MiXiN's, MiXiN alpha's, Frutiger Aero's and Liquid Glass's, as in MXN.
   The window fills the iframe, which is the viewport, so the media queries at the end are the
   iframe's size: a small widget keeps what matters most. */

:root, :root[data-theme="mixin"] {
	--font: system-ui, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--size: 12.5px;
	--text: #1d2b3c;
	--muted: #6b7a8c;
	--link: #1668c9;
	--face: #fff; /* the window, under the head */
	--border: #c6d6e8;
	--frame: none; /* the window's edge as a box-shadow, for 98's raised one */
	--radius: 14px;
	--head-bg: linear-gradient(#e6f0fb, #f6f9fd 75%, #fff);
	--name: #17406f;
	--st-online: #45b03b;
	--st-busy: #e8332a;
	--st-away: #f7a21b;
	--st-offline: #a9b3bf;
	--tile-bg: #fff;
	--tile-radius: 12px;
	--tile-edge: 3px;
	--tile-shadow: 0 1px 3px rgba(28, 62, 110, .18);
	--gloss: linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, .12) 50%, rgba(255, 255, 255, 0) 50%);
	/* Let's chat is the theme's main button; the two beside it its plain one. */
	--button-bg: var(--gloss), linear-gradient(#4a9cf0, #1f7ae0);
	--button-border: 1px solid #1867c0;
	--button-fg: #fff;
	--button-radius: 999px;
	--button-weight: 600;
	--button-shadow: none;
	--button-text-shadow: none;
	--plain-bg: var(--gloss), linear-gradient(#fff, #e9f1fa);
	--plain-border: 1px solid #b4c8de;
	--plain-shadow: none;
	--focus: rgba(31, 122, 224, .35);
	--scene-fg: #fff;
	--scene-shadow: #000;
}
:root[data-theme="mixin"][data-mode="dark"] {
	--text: #e2eaf4;
	--muted: #8fa0b5;
	--link: #6db1ff;
	--face: #151f2c;
	--border: #2a3b52;
	--head-bg: linear-gradient(#1a2b42, #172232 75%, #151f2c);
	--name: #cfe3fb;
	--st-offline: #6c7888;
	--tile-bg: #1f2d40;
	--gloss: linear-gradient(rgba(255, 255, 255, .14), rgba(255, 255, 255, .04) 50%, rgba(255, 255, 255, 0) 50%);
	--button-border: 1px solid #4b9cf0;
	--plain-bg: var(--gloss), linear-gradient(#26364b, #1c2a3b);
	--plain-border: 1px solid #3a4f6a;
	--focus: rgba(77, 155, 255, .4);
}

:root[data-theme="mixin-alpha"] {
	--font: "Segoe UI", Tahoma, Verdana, sans-serif;
	--size: 12px;
	--text: #1e1e1e;
	--muted: #707070;
	--link: #0066cc;
	--border: #a5bcd6;
	--radius: 7px;
	--head-bg: linear-gradient(#d3e5f7, #eef5fc 70%, #fff);
	--name: var(--text);
	--st-online: #41b51b;
	--st-busy: #db2b20;
	--st-away: #f2a516;
	--st-offline: #a6a6a6;
	--tile-radius: 6px;
	--tile-edge: 2px;
	--tile-shadow: inset 0 0 0 1px rgba(255, 255, 255, .9), 0 1px 2px rgba(0, 0, 0, .15);
	--button-bg: linear-gradient(#eaf6fd, #d9f0fc 50%, #bee6fd 50%, #a7d9f5);
	--button-border: 1px solid #3c7fb1;
	--button-fg: #000;
	--button-radius: 3px;
	--plain-bg: linear-gradient(#f2f2f2, #ebebeb 50%, #dddddd 50%, #cfcfcf);
	--plain-border: 1px solid #707070;
}
:root[data-theme="mixin-alpha"][data-mode="dark"] {
	--text: #e4e4e4;
	--muted: #9a9a9a;
	--link: #5aa7ff;
	--face: #1b232d;
	--border: #34475e;
	--head-bg: linear-gradient(#1f3046, #1c2633 70%, #1b232d);
	--st-offline: #7a7a7a;
	--tile-bg: #1b232d;
	--tile-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), 0 1px 2px rgba(0, 0, 0, .4);
	--button-bg: linear-gradient(#2b5679, #25506f 50%, #1d4462 50%, #18405c);
	--button-border: 1px solid #4c8fc4;
	--button-fg: #fff;
	--plain-bg: linear-gradient(#3a4350, #333b47 50%, #2a313b 50%, #252c35);
	--plain-border: 1px solid #56606e;
}

:root[data-theme="98"] {
	--font: "Microsoft Sans Serif", "MS Sans Serif", Tahoma, Arial, sans-serif;
	--size: 11px;
	--text: #000;
	--muted: #555;
	--link: #0000ee;
	--face: silver;
	--border: transparent;
	--frame: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px grey, inset 2px 2px #fff;
	--radius: 0;
	--head-bg: silver;
	--name: #000;
	--st-online: #00a800;
	--st-busy: #d40000;
	--st-away: #e8a800;
	--st-offline: grey;
	--tile-radius: 0;
	--tile-edge: 2px;
	--tile-shadow: none;
	--button-bg: silver;
	--button-border: none;
	--button-fg: #000;
	--button-radius: 0;
	--button-weight: normal;
	--button-shadow: inset -2px -2px #0a0a0a, inset 1px 1px #0a0a0a, inset 2px 2px #fff, inset -3px -3px grey, inset 3px 3px #dfdfdf;
	--plain-bg: silver;
	--plain-border: none;
	--plain-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px grey, inset 2px 2px #dfdfdf;
	--focus: transparent;
}

:root[data-theme="xp"] {
	--font: Tahoma, Verdana, "Segoe UI", sans-serif;
	--size: 11px;
	--text: #000;
	--muted: #5a5a5a;
	--link: #0066cc;
	--face: #ece9d8;
	--border: #0831d9;
	--radius: 3px;
	--head-bg: linear-gradient(#f4f7fe, #d6dff7);
	--name: #000;
	--st-online: #33a325;
	--st-busy: #dd2a1f;
	--st-away: #f4a11a;
	--st-offline: #9a9a9a;
	--tile-radius: 3px;
	--tile-shadow: none;
	--button-bg: linear-gradient(180deg, #fff, #ecebe5 86%, #d8d0c4);
	--button-border: 1px solid #003c74;
	--button-fg: #000;
	--button-radius: 3px;
	--button-weight: normal;
	--button-shadow: inset -1px 1px #cee7ff, inset 1px 2px #98b8ea, inset -2px 2px #bcd4f6, inset 1px -1px #89ade4, inset 2px -2px #89ade4;
	--plain-bg: linear-gradient(180deg, #fff, #ecebe5 86%, #d8d0c4);
	--plain-border: 1px solid #003c74;
	--focus: transparent;
}

:root[data-theme="7"] {
	--font: "Segoe UI", "Noto Sans", Tahoma, sans-serif;
	--size: 12px;
	--text: #000;
	--muted: #6d6d6d;
	--link: #0066cc;
	--border: #8e9fb6;
	--radius: 6px;
	--head-bg: linear-gradient(#fff, #f0f5fb);
	--name: #1e395b;
	--st-online: #41b51b;
	--st-busy: #db2b20;
	--st-away: #f2a516;
	--st-offline: #a6a6a6;
	--tile-radius: 4px;
	--tile-shadow: inset 0 0 0 1px rgba(255, 255, 255, .9), 0 1px 2px rgba(0, 0, 0, .15);
	--button-bg: linear-gradient(#eaf6fd 45%, #bee6fd 45%, #a7d9f5);
	--button-border: 1px solid #3c7fb1;
	--button-fg: #000;
	--button-radius: 3px;
	--button-weight: normal;
	--button-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
	--plain-bg: linear-gradient(#f2f2f2 45%, #ebebeb 45%, #cfcfcf);
	--plain-border: 1px solid #707070;
	--plain-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
	--focus: transparent;
}

:root[data-theme="aero"] {
	--font: Frutiger, "Frutiger Linotype", "Segoe UI", "Myriad Pro", Ubuntu, system-ui, sans-serif;
	--text: #10324a;
	--muted: #4f7287;
	--link: #0675b8;
	--face: linear-gradient(rgba(255, 255, 255, .93), rgba(240, 251, 255, .9));
	--border: rgba(7, 121, 176, .45);
	--radius: 12px;
	--head-bg: linear-gradient(rgba(214, 244, 255, .9), rgba(255, 255, 255, .6));
	--name: #0779b0;
	--st-online: #4cc21c;
	--st-busy: #e8361f;
	--st-away: #f6a512;
	--st-offline: #9fb4c0;
	--tile-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 2px 6px rgba(4, 60, 100, .25);
	--gloss: linear-gradient(rgba(255, 255, 255, .75), rgba(255, 255, 255, .25) 50%, rgba(255, 255, 255, 0) 51%);
	--button-bg: var(--gloss), linear-gradient(#8ee05a, #5fbf2a 50%, #3d9a15);
	--button-border: 1px solid #3a8a16;
	--button-shadow: inset 0 1px rgba(255, 255, 255, .8), 0 1px 2px rgba(4, 60, 100, .15);
	--button-text-shadow: 0 1px 1px rgba(0, 60, 0, .5);
	--plain-bg: var(--gloss), linear-gradient(#e8f8ff, #b9e3f7);
	--plain-border: 1px solid rgba(7, 121, 176, .55);
	--plain-shadow: inset 0 1px rgba(255, 255, 255, .8);
	--focus: rgba(10, 163, 220, .35);
}
:root[data-theme="aero"][data-mode="dark"] {
	--text: #e3f2fa;
	--muted: #8fb3c7;
	--link: #6cd0ff;
	--face: linear-gradient(rgba(14, 34, 52, .94), rgba(9, 26, 42, .92));
	--border: rgba(120, 200, 240, .35);
	--head-bg: linear-gradient(rgba(20, 60, 90, .9), rgba(14, 34, 52, .6));
	--name: #7fd0f5;
	--st-offline: #5f7a8a;
	--tile-bg: #0f2638;
	--tile-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 6px rgba(4, 60, 100, .25);
	--gloss: linear-gradient(rgba(255, 255, 255, .3), rgba(255, 255, 255, .08) 50%, rgba(255, 255, 255, 0) 51%);
	--plain-bg: var(--gloss), linear-gradient(#1d4a66, #12324a);
	--plain-border: 1px solid rgba(120, 200, 240, .4);
}

/* Liquid Glass: a see-through tint, the page round the iframe showing through. A frame's glass
   can't blur that page (its backdrop is its own page), so the embed code puts the iframe in a div
   that does (WIDGET_GLASS in src/Web.php); without it, it's clear glass, unfrosted. The tint is
   strong enough to read over a busy page either way. A song over a scene takes dark mode's
   lighter blue, as MXN's does. */
:root[data-theme="liquid-glass"] {
	--font: system-ui, -apple-system, "SF Pro Text", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--text: #101820;
	--muted: rgba(16, 24, 32, .58);
	--link: #0a5fd0;
	--face: rgba(255, 255, 255, .5);
	--border: rgba(255, 255, 255, .6);
	--frame: inset 0 1px 0 rgba(255, 255, 255, .85);
	--radius: 22px;
	--head-bg: rgba(255, 255, 255, .2);
	--name: #101820;
	--st-online: #30c24a;
	--st-busy: #ff3b30;
	--st-away: #ff9f0a;
	--st-offline: rgba(120, 130, 145, .7);
	--tile-bg: rgba(255, 255, 255, .7);
	--tile-radius: 16px;
	--tile-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 2px 8px rgba(20, 30, 60, .18);
	--button-bg: linear-gradient(rgba(70, 150, 245, .92), rgba(31, 122, 224, .92));
	--button-border: 1px solid rgba(255, 255, 255, .45);
	--button-fg: #fff;
	--button-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 3px 8px rgba(31, 122, 224, .3);
	--button-text-shadow: 0 1px 1px rgba(0, 40, 100, .3);
	--plain-bg: rgba(255, 255, 255, .42);
	--plain-border: 1px solid rgba(255, 255, 255, .7);
	--plain-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
	--focus: rgba(31, 122, 224, .3);
}
:root[data-theme="liquid-glass"][data-mode="dark"] {
	--text: #f2f5fa;
	--muted: rgba(242, 245, 250, .6);
	--link: #6db1ff;
	--face: rgba(22, 26, 36, .6);
	--border: rgba(255, 255, 255, .14);
	--frame: inset 0 1px 0 rgba(255, 255, 255, .28);
	--head-bg: rgba(255, 255, 255, .05);
	--name: #f2f5fa;
	--st-offline: rgba(150, 160, 175, .55);
	--tile-bg: rgba(40, 46, 60, .8);
	--tile-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 2px 8px rgba(0, 0, 0, .3);
	--button-border: 1px solid rgba(255, 255, 255, .25);
	--plain-bg: rgba(255, 255, 255, .1);
	--plain-border: 1px solid rgba(255, 255, 255, .16);
	--plain-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
	--focus: rgba(77, 155, 255, .4);
}
:root[data-theme="liquid-glass"] .scened .media a { color: #6db1ff; }

/* --- The window ------------------------------------------------------------------------- */
* { box-sizing: border-box; }
/* Transparent round the window, so the frame's page shows round its corners. */
html, body { height: 100%; margin: 0; background: transparent; overflow: hidden; }
body { color: var(--text); font: var(--size)/1.35 var(--font); }
p { margin: 0; }
.widget { display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--face); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--frame); }
.widget .off { padding: 12px; color: var(--muted); }

/* Your picture, name, status and messages, on your scene as MXN shows yours. */
.head { flex: 1; min-height: 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--head-bg); }
.head.scened { background-size: cover; background-position: center; }
.head.coloured { border-bottom: 3px solid var(--scene-colour); }
.tile { flex: none; width: 44px; height: 44px; border: var(--tile-edge) solid var(--st-offline); border-radius: var(--tile-radius); background: var(--tile-bg); box-shadow: var(--tile-shadow); overflow: hidden; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.st-NLN { border-color: var(--st-online); }
.st-BSY, .st-PHN { border-color: var(--st-busy); }
.st-AWY, .st-BRB, .st-LUN, .st-IDL { border-color: var(--st-away); }
.text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
/* Too long for the window, a line ends in "..." and shows whole as its tooltip (title). */
.line, .psm, .media { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Or, as its owner chose, the personal message on as many lines as fit (the rest still its tooltip). */
.wrap .psm { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--psm-lines, 3); }
.name { color: var(--name); }
.status, .psm, .media { color: var(--muted); }
.media { font-size: .9em; }
/* A song links to a search for it (its tooltip saying where), as MXN's .np-link: the theme's link colour, underlined. */
.media a, .scened .media a { color: var(--link); text-decoration: underline; }
.scened .text { filter: drop-shadow(0 0 1px var(--scene-shadow)) drop-shadow(0 0 2px var(--scene-shadow)) drop-shadow(0 0 3px var(--scene-shadow)); }
.scened .name, .scened .status, .scened .psm, .scened .media { color: var(--scene-fg); }

/* Let's chat (in MXN, for anyone), then the same chat in MXN's web+msnim handler, and in Messenger. */
.chat-row { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--border); }
.chat, .via { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.chat { flex: 0 1 auto; min-width: 0; height: 24px; padding: 0 14px; border: var(--button-border); border-radius: var(--button-radius); background: var(--button-bg); color: var(--button-fg); box-shadow: var(--button-shadow); text-shadow: var(--button-text-shadow); font-weight: var(--button-weight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.via { flex: none; width: 24px; height: 24px; padding: 0; border: var(--plain-border); border-radius: var(--button-radius); background: var(--plain-bg); box-shadow: var(--plain-shadow); }
.via img { display: block; width: 16px; height: 16px; }
.chat + .via { margin-left: auto; } /* the two at the right, Let's chat alone at the left */
.chat:hover, .via:hover { filter: brightness(1.06); }
.chat:focus-visible, .via:focus-visible { outline: 1px dotted var(--text); outline-offset: -4px; }

/* A wrapped personal message gets the lines a taller widget has room for. */
@media (min-height: 200px) { :root { --psm-lines: 5; } }
@media (min-height: 280px) { :root { --psm-lines: 8; } }
@media (min-height: 400px) { :root { --psm-lines: 14; } }
@media (max-height: 130px) { :root { --psm-lines: 2; } }

/* Small widgets: the least needed goes first. */
@media (max-height: 120px) {
	.media { display: none; }
}
@media (max-height: 95px) {
	.psm, .wrap .psm { display: none; }
	.head { padding: 4px 8px; gap: 8px; }
	.tile { width: 32px; height: 32px; }
	.chat-row { padding: 3px 8px; }
	.chat, .via { height: 20px; }
	.via { width: 20px; }
	.via img { width: 14px; height: 14px; }
}
@media (max-height: 70px) {
	.tile { width: 24px; height: 24px; border-width: 2px; }
}
