/*
 * Blogged.my "modern" theme
 * Light and dark colours (automatic, or chosen with the header switch),
 * mobile-first layout, timeline feed.
 * Colours are CSS variables: change them in the two blocks below.
 */

/* ---------- Fonts (stored on this site, in /fonts; SIL Open Font License) ---------- */
@font-face {
  font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(../fonts/figtree-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(../fonts/figtree-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(../fonts/bricolage-grotesque-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(../fonts/bricolage-grotesque-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ---------- Colours ---------- */
:root {
  --navy: #1B2545;
  --navy-2: #26324F;
  --sky: #8DB3FF;          /* highlight on navy */
  --accent: #2459C7;       /* links and buttons on light surfaces */
  --accent-ink: #1A4296;
  --accent-soft: #EAF0FC;
  --bg: #EDF1F7;
  --surface: #FFFFFF;
  --surface-2: #F4F6FA;
  --ink: #131A2A;
  --body: #3B4458;
  --muted: #5B6478;
  --line: #E3E7EE;
  --rail: #D3DAE6;
  --field: #FFFFFF;
  --field-line: #CDD3DE;
  --good-bg: #E8F6EF; --good: #0B6B4F;
  --bad-bg: #FDECEC;  --bad: #B42318;
  --info-bg: #EAF0FC; --info: #1A4296;
  --shadow: 0 1px 2px rgba(29,39,64,.06), 0 8px 24px rgba(29,39,64,.05);
  --shadow-lg: 0 12px 32px rgba(11,18,40,.18);
  --head-bg: var(--navy);
  --head-ink: #FFFFFF;
  --head-muted: #C9D2E3;
  --head-chip: rgba(255,255,255,.12);
  --radius: 18px;
  --radius-sm: 12px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}

/* Dark: automatic (device setting) unless the visitor picked light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #8DB3FF; --accent-ink: #B9CDFF; --accent-soft: #1D2B4A;
    --bg: #0B1020; --surface: #161D30; --surface-2: #1C2438;
    --ink: #E7EBF3; --body: #C3CBDA; --muted: #9BA6BB;
    --line: #243049; --rail: #2A3550;
    --field: #0F1628; --field-line: #33405E;
    --good-bg: #11352A; --good: #7FE0BA;
    --bad-bg: #3A1618;  --bad: #FFA39C;
    --info-bg: #1D2B4A; --info: #B9CDFF;
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset;
    --shadow-lg: 0 12px 32px rgba(0,0,0,.45);
    --head-bg: #141B2D;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #8DB3FF; --accent-ink: #B9CDFF; --accent-soft: #1D2B4A;
  --bg: #0B1020; --surface: #161D30; --surface-2: #1C2438;
  --ink: #E7EBF3; --body: #C3CBDA; --muted: #9BA6BB;
  --line: #243049; --rail: #2A3550;
  --field: #0F1628; --field-line: #33405E;
  --good-bg: #11352A; --good: #7FE0BA;
  --bad-bg: #3A1618;  --bad: #FFA39C;
  --info-bg: #1D2B4A; --info: #B9CDFF;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset;
  --shadow-lg: 0 12px 32px rgba(0,0,0,.45);
  --head-bg: #141B2D;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }
/* Links inside running text are underlined, so they don't rely on colour alone */
.bm-prose p a:not([class]),
.bm-prose dd a:not([class]),
.bm-prose td a:not([class]),
.bm-help a:not([class]),
.bm-check a:not([class]),
.bm-note a:not([class]),
.bm-card > p:not(.tagcloud) a:not([class]),
.bm-empty li a:not([class]),
#pingbox p a:not([class]),
.bm-profile p a:not([class]),
.ping-excerpt a:not([class]) { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.015em; line-height: 1.2; margin: 0; color: var(--ink); }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }
.bm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.is-hidden { display: none !important; }
.bm-hidden-legacy { display: none !important; }   /* kept for the PHP, not shown */
svg { flex-shrink: 0; }

.bm-wrap { width: 100%; max-width: 1192px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.bm-top {
  position: sticky; top: 0; z-index: 50;
  background: var(--head-bg); color: var(--head-ink);
  transition: transform .25s ease, box-shadow .2s ease;
}
.bm-top.is-scrolled { box-shadow: 0 6px 20px rgba(11,18,40,.25); }
.bm-top__row { display: flex; align-items: center; gap: 22px; height: 60px; }
.bm-logo {
  font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -.02em;
  color: #FFFFFF; text-decoration: none; white-space: nowrap;
}
.bm-logo span { color: var(--sky); }
.bm-logo:hover { color: #FFFFFF; text-decoration: none; }
.bm-nav { display: flex; align-self: stretch; gap: 22px; }
.bm-nav a {
  display: flex; align-items: center; padding-top: 3px; border-bottom: 3px solid transparent;
  color: var(--head-muted); font-weight: 500; font-size: 15px; text-decoration: none;
}
.bm-nav a:hover { color: #FFFFFF; }
.bm-nav a[aria-current="page"] { color: #FFFFFF; font-weight: 700; border-bottom-color: var(--sky); }
.bm-spacer { flex: 1; }
.bm-headtools { display: flex; align-items: center; gap: 8px; }

.bm-search { display: flex; align-items: center; gap: 8px; width: 240px; height: 40px; padding: 0 6px 0 14px;
  border-radius: 999px; background: var(--head-chip); color: var(--head-muted); }
.bm-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: #FFFFFF; font-size: 15px; }
.bm-search input::placeholder { color: #AEB9CF; }
.bm-search button { border: 0; background: transparent; color: inherit; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }

.bm-iconbtn {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--head-chip); color: #FFFFFF;
  display: inline-grid; place-items: center; text-decoration: none;
}
.bm-iconbtn:hover { background: rgba(255,255,255,.2); color: #FFFFFF; text-decoration: none; }
.bm-theme .i-sun { display: none; }
:root[data-theme="dark"] .bm-theme .i-sun { display: block; }
:root[data-theme="dark"] .bm-theme .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bm-theme .i-sun { display: block; }
  :root:not([data-theme="light"]) .bm-theme .i-moon { display: none; }
}

.bm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 0;
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.bm-btn:hover { text-decoration: none; filter: brightness(1.06); }
.bm-btn--sky { background: var(--sky); color: var(--navy); }
.bm-btn--sky:hover { color: var(--navy); }
.bm-btn--ghost { background: transparent; color: #FFFFFF; box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); }
.bm-btn--ghost:hover { color: #FFFFFF; }

/* Drop-downs (language, account) use <details> so they work without JS */
.bm-drop { position: relative; }
.bm-drop > summary { list-style: none; cursor: pointer; }
.bm-drop > summary::-webkit-details-marker { display: none; }
.bm-lang > summary {
  height: 40px; padding: 0 12px; border-radius: 999px; background: var(--head-chip); color: #FFFFFF;
  display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600;
}
.bm-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: block; background: var(--sky); box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.bm-pop {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; z-index: 60;
  background: var(--surface); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 8px; border: 1px solid var(--line);
}
.bm-pop__head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.bm-pop__head strong { display: block; font-size: 16px; }
.bm-pop__head span { font-size: 13px; color: var(--muted); }
.bm-pop a.bm-pop__item, .bm-pop button.bm-pop__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px;
  border-radius: 10px; color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none;
  background: transparent; border: 0; text-align: left;
}
.bm-pop a.bm-pop__item:hover, .bm-pop button.bm-pop__item:hover { background: var(--surface-2); }
.bm-pop__label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 6px; }
.bm-seg { display: flex; padding: 3px; margin: 0 8px 6px; border-radius: 12px; background: var(--surface-2); }
.bm-seg button { flex: 1; border: 0; padding: 7px 0; border-radius: 9px; background: transparent; color: var(--body); font-size: 13px; font-weight: 600; }
.bm-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 700; }

/* Language links come from PHP: "Show pings in: <strong>English</strong> | <a>Malay</a> | <a>All</a>" */
.bm-langbox { font-size: 0; display: flex; flex-direction: column; gap: 2px; }
.bm-langbox p { margin: 0; display: contents; }
.bm-langbox a, .bm-langbox strong {
  font-size: 15px; display: flex; align-items: center; min-height: 42px; padding: 0 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.bm-langbox a:hover { background: var(--surface-2); }
.bm-langbox strong { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.bm-langbox strong::after { content: "✓"; margin-left: auto; }
.bm-langbar { font-size: 0; display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.bm-langbar p { display: contents; }
.bm-langbar a, .bm-langbar strong { font-size: 13px; padding: 6px 12px; border-radius: 999px; color: var(--body); font-weight: 600; text-decoration: none; }
.bm-langbar strong { background: var(--navy); color: #FFFFFF; }
:root[data-theme="dark"] .bm-langbar strong { background: var(--sky); color: var(--navy); }

/* Mobile search row (opened from the Search tab) */
.bm-msearch { display: none; padding: 0 16px 12px; }
.bm-msearch.is-open { display: block; }
.bm-msearch form { display: flex; gap: 8px; }
.bm-msearch input { flex: 1; height: 44px; border-radius: 12px; border: 0; padding: 0 14px; font-size: 16px; background: #FFFFFF; color: #131A2A; }
.bm-msearch button { height: 44px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--sky); color: var(--navy); font-weight: 700; }

/* Bottom tab bar (phones) */
.bm-tabbar { display: none; }

/* ---------- Page layout ---------- */
.bm-page { padding: 28px 0 56px; }
.bm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.bm-layout--narrow { grid-template-columns: minmax(0, 760px); justify-content: center; }
.bm-layout--account { grid-template-columns: 220px minmax(0, 1fr); }
.bm-main { min-width: 0; }
.bm-rail { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 84px; }

.bm-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.bm-pagehead h1 { font-size: 28px; font-weight: 800; }
.bm-pagehead .bm-h1 { font-size: 28px; font-weight: 800; margin: 0; }  /* looks like a page title, but is a section heading */
.bm-pagehead p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.bm-pagehead--tl { padding-left: 118px; }
.bm-loader { width: 16px; height: 16px; vertical-align: middle; margin-left: 6px; }

.bm-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.bm-card + .bm-card { margin-top: 20px; }
.bm-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.bm-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.bm-card--navy { background: var(--navy); color: #FFFFFF; }
.bm-card--navy h2 { color: #FFFFFF; }
.bm-card--navy p { color: #C9D2E3; }
:root[data-theme="dark"] .bm-card--navy { background: #1E2842; }
.bm-card__hint { margin: -6px 0 12px; font-size: 13px; color: var(--muted); }
.bm-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #16A37E; box-shadow: 0 0 0 4px rgba(22,163,126,.18); margin-right: 8px; vertical-align: middle; }

/* ---------- Timeline feed ---------- */
.tl { display: flex; flex-direction: column; }
.tl-day { display: grid; grid-template-columns: 76px 28px minmax(0, 1fr); align-items: center; height: 48px; }
.tl-day::before { content: ""; grid-column: 2; justify-self: center; width: 2px; height: 100%; background: var(--rail); }
.tl-day__label { grid-column: 3; display: flex; align-items: center; gap: 12px; padding-left: 14px;
  font-family: var(--display); font-size: 18px; font-weight: 800; color: var(--ink); }
.tl-day__label::after { content: ""; flex: 1; height: 1px; background: var(--rail); }
.tl-item { display: grid; grid-template-columns: 76px 28px minmax(0, 1fr); }
.tl-time { display: flex; flex-direction: column; align-items: flex-end; padding: 22px 12px 0 0; text-align: right; }
.tl-time b { font-size: 15px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.tl-time span { display: none; font-size: 13px; color: var(--muted); line-height: 1.3; }
/* On wide screens the "x hours ago" text sits in the card, where it has room */
.ping-ago::before { content: "\00B7\00A0"; }
.tl-line { position: relative; display: flex; justify-content: center; }
.tl-line::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--rail); }
.tl-dot { position: relative; margin-top: 26px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg); }
.tl-body { padding: 0 0 18px 14px; min-width: 0; }
/* Lists that are not in time order (popular, search by relevance): no timeline */
.tl-item.is-plain { grid-template-columns: minmax(0, 1fr); }
.tl-item.is-plain .tl-time, .tl-item.is-plain .tl-line { display: none; }
.tl-item.is-plain .tl-body { padding-left: 0; }
.tl-item.is-plain .ping-ago { display: inline; }

/* Blog colours (dots and fallback avatars) */
.c0 { --c: #C2255C; } .c1 { --c: #2459C7; } .c2 { --c: #0E7C66; } .c3 { --c: #B45309; }
.c4 { --c: #7C3AED; } .c5 { --c: #0369A1; } .c6 { --c: #BE185D; } .c7 { --c: #4D7C0F; }
.tl-dot[class*=" c"] { background: var(--c); }

.ping-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.ping-meta { display: flex; align-items: center; gap: 12px; }
.ping-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.ping-who { flex: 1; min-width: 0; font-size: 15px; color: var(--muted); line-height: 1.35; }
.ping-who a { font-weight: 600; }
.ping-who a.ping-author { color: var(--ink); font-weight: 700; }
.ping-ago { display: inline; font-size: 13px; color: var(--muted); margin-left: 6px; }
.ping-lang { font-size: 11px; font-weight: 800; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; }
.ping-lang--en { background: #E2E9FF; color: #1E40AF; }
.ping-lang--ms { background: #FFE3EA; color: #8F1D3F; }
:root[data-theme="dark"] .ping-lang--en { background: #1B2A57; color: #B9CDFF; }
:root[data-theme="dark"] .ping-lang--ms { background: #3B1724; color: #FFB3C8; }
.ping-title { font-size: 22px; font-weight: 700; line-height: 1.25; }
.ping-title a { color: var(--ink); }
.ping-title a:hover { color: var(--accent); text-decoration: none; }
.ping-excerpt { margin: 0; font-size: 16px; line-height: 1.6; color: var(--body); overflow-wrap: anywhere; }
.ping-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ping-actions { display: flex; align-items: center; gap: 4px; padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--line); }
.act {
  height: 40px; min-width: 40px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.act:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.act--like { background: var(--good-bg); color: var(--good); }
.act--like:hover { background: var(--good-bg); color: var(--good); filter: brightness(.97); }
.act--flagged { color: var(--bad); }
.act--read { margin-left: auto; background: var(--accent-soft); color: var(--accent-ink); }
.act--read:hover { background: var(--accent-soft); color: var(--accent-ink); }
.act b { font-weight: 700; }
.act img { display: none; } /* old like/dislike images returned by likedislikeupdater.php */

/* Tags (colour picked from the tag name) */
.tag { display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-decoration: none; background: var(--surface-2); color: var(--body); }
.tag:hover { text-decoration: none; filter: brightness(.96); }
.t0 { background: #FFE8D6; color: #8A3A00; } .t1 { background: #E2E9FF; color: #1E40AF; }
.t2 { background: #D8F3EA; color: #0B5E4B; } .t3 { background: #F7E1F4; color: #8A2C7A; }
.t4 { background: #EDE7FF; color: #5B34B8; } .t5 { background: #FFF1C7; color: #6E4A00; }
.t6 { background: #FFE3EA; color: #8F1D3F; } .t7 { background: #E0F2FE; color: #075985; }
:root[data-theme="dark"] .t0 { background: #3A2414; color: #FFC9A1; } :root[data-theme="dark"] .t1 { background: #1B2A57; color: #B9CDFF; }
:root[data-theme="dark"] .t2 { background: #123A30; color: #8DE3C4; } :root[data-theme="dark"] .t3 { background: #3A1A36; color: #F2B5E6; }
:root[data-theme="dark"] .t4 { background: #2A2150; color: #CDBDFF; } :root[data-theme="dark"] .t5 { background: #3A2F10; color: #FFD978; }
:root[data-theme="dark"] .t6 { background: #3B1724; color: #FFB3C8; } :root[data-theme="dark"] .t7 { background: #0F2E44; color: #9FD8FB; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tagcloud a { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--body); font-weight: 600; text-decoration: none; line-height: 1.3; max-width: 100%; }
.tagcloud a:hover { background: var(--accent-soft); color: var(--accent-ink); }
.bm-rail .tagcloud a { font-size: 14px !important; }

/* Page numbers (links built by PHP: <a>, <strong>) */
.bm-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 8px 0 12px; }
.bm-pages--tl { padding-left: 118px; }
.bm-pages a, .bm-pages strong {
  min-width: 42px; height: 42px; padding: 0 12px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--body); font-weight: 600; text-decoration: none; box-shadow: var(--shadow);
}
.bm-pages a:hover { color: var(--accent); }
.bm-pages strong { background: var(--navy); color: #FFFFFF; }
:root[data-theme="dark"] .bm-pages strong { background: var(--sky); color: var(--navy); }

/* Sort options (PHP gives plain text for the current one, a link for the others) */
.bm-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
/* Same look as the Today / Week / Month / Year switch: one rounded bar, the chosen option filled in */
.bm-sort__group { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.bm-sort__opt { display: inline-flex; border-radius: 999px; padding: 9px 16px; background: var(--navy); color: #FFFFFF; font-weight: 600; }
:root[data-theme="dark"] .bm-sort__opt:not(:has(a)) { background: var(--sky); color: var(--navy); }
.bm-sort__opt:has(a) { background: transparent; padding: 0; }
.bm-sort__opt a { display: block; padding: 9px 16px; border-radius: 999px; color: var(--body); font-weight: 600; text-decoration: none; }
.bm-sort__opt a:hover { background: var(--surface-2); text-decoration: none; }
.bm-counter { font-size: 14px; color: var(--muted); margin: 0 0 14px; }

/* Rail boxes */
.bm-list { list-style: none; margin: 0; padding: 0; }
.bm-list li { border-top: 1px solid var(--line); }
.bm-list li:first-child { border-top: 0; }
.bm-list a.bm-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--ink); text-decoration: none; }
.bm-list a.bm-row:hover .bm-row__title { color: var(--accent); }
.bm-row__title { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.35; }
.bm-row__meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.bm-refs li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; }
.bm-refs li a { font-weight: 600; color: var(--ink); }
.bm-refs li span { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Ping box (HTML comes from sidebarpingbox.php) */
#pingbox ul { list-style: none; margin: 0 0 12px; padding: 0; }
#pingbox li { padding: 6px 0; border-top: 1px solid rgba(255,255,255,.12); }
#pingbox li:first-child { border-top: 0; }
#pingbox li a { color: #FFFFFF; font-weight: 600; }
#pingbox p { margin: 0 0 10px; }
#pingbox i a, #pingbox a { color: var(--sky); }
#pingbox .submitbutton { width: 100%; height: 44px; border: 0; border-radius: 12px; background: var(--sky); color: var(--navy); font-weight: 800; font-size: 15px; }
#pingboxLoader { padding: 10px 0; }

/* Popular box (HTML from mainpopularpings.php, loaded into the rail) */
.bm-pop-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); margin: 0 0 8px; list-style: none; }
.bm-pop-tabs li { flex: 1; }
.bm-pop-tabs a { display: block; text-align: center; padding: 6px 4px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--body); text-decoration: none; }
.bm-pop-tabs a.active { background: var(--navy); color: #FFFFFF; }
/* The same switch at the top of the Popular page, a little larger */
.bm-pop-tabs--page { max-width: 460px; margin: 0 0 18px; box-shadow: var(--shadow); background: var(--surface); }
.bm-pop-tabs--page a { padding: 9px 6px; font-size: 14px; }
.bm-pop-tabs--page a:not(.active):hover { background: var(--surface-2); text-decoration: none; }
:root[data-theme="dark"] .bm-pop-tabs a.active { background: var(--sky); color: var(--navy); }
.bm-poplist { list-style: none; margin: 0; padding: 0; counter-reset: pop var(--start, 0); }
.bm-poplist li { counter-increment: pop; display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.bm-poplist li::before { content: counter(pop); flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 15px; background: var(--accent-soft); color: var(--accent-ink); }
.bm-poplist li:first-child { border-top: 0; }
.bm-poplist p { margin: 0; }
.bm-poplist .t { font-size: 15px; font-weight: 600; line-height: 1.35; }
.bm-poplist .t a { color: var(--ink); }
.bm-poplist .m { font-size: 13px; color: var(--muted); }
.bm-poplist .m a { color: var(--muted); font-weight: 600; }
.bm-more { display: inline-block; margin-top: 8px; font-weight: 700; font-size: 14px; }

/* ---------- Forms ---------- */
.bm-form { display: flex; flex-direction: column; gap: 18px; }
.bm-field { display: flex; flex-direction: column; gap: 6px; }
.bm-field > label, .bm-label { font-size: 14px; font-weight: 700; color: var(--body); }
.bm-field .req { color: var(--bad); }
.bm-input, .bm-form input[type=text], .bm-form input[type=password], .bm-form input[type=email], .bm-form input[type=url], .bm-form textarea, .bm-form select {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--field-line);
  background: var(--field); color: var(--ink); font-size: 16px;
}
.bm-form textarea { min-height: 140px; resize: vertical; }
.bm-form input:focus, .bm-form textarea:focus, .bm-form select:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.bm-help { font-size: 13px; color: var(--muted); }
.bm-err { color: var(--bad); font-weight: 600; font-size: 13px; }
.bm-err:empty { display: none; }
.bm-check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; color: var(--body); min-height: 44px; padding-top: 10px; }
.bm-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.bm-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.bm-fieldset legend { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--ink); padding: 0; margin-bottom: 4px; }
.bm-submit { display: inline-flex; align-items: center; justify-content: center; height: 50px; padding: 0 28px; border: 0; border-radius: 12px;
  background: var(--navy); color: #FFFFFF; font-weight: 800; font-size: 16px; }
:root[data-theme="dark"] .bm-submit { background: var(--sky); color: var(--navy); }
.bm-submit:hover { filter: brightness(1.08); }
.bm-submit--block { width: 100%; }
.bm-smallbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 700; font-size: 14px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent); }
.bm-smallbtn:hover { background: var(--accent-soft); }
.bm-smallbtn--solid { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
:root[data-theme="dark"] .bm-smallbtn--solid { color: var(--navy); }
.bm-smallbtn--danger { border-color: transparent; color: var(--bad); }
.bm-smallbtn--danger:hover { background: var(--bad-bg); }
.bm-captcha { border-radius: 8px; background: #FFFFFF; padding: 4px; display: block; margin-bottom: 8px; }
.bm-row-form { display: flex; gap: 10px; }
.bm-row-form > input { flex: 1; }

/* Notices */
.bm-note { border-radius: 14px; padding: 14px 16px; margin: 0 0 18px; font-weight: 600; }
.bm-note h2, .bm-note h3 { font-family: var(--font); font-size: 16px; letter-spacing: 0; margin: 0 0 4px; color: inherit; }
.bm-note p { margin: 0; font-weight: 500; }
.bm-note--ok { background: var(--good-bg); color: var(--good); }
.bm-note--err { background: var(--bad-bg); color: var(--bad); }
.bm-note--info { background: var(--info-bg); color: var(--info); }

/* Account pages */
.bm-subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.bm-subnav__label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 12px 8px; }
.bm-subnav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--body); font-weight: 500; text-decoration: none; }
.bm-subnav a:hover { background: var(--surface); }
.bm-subnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.bm-bloglist { list-style: none; margin: 0; padding: 0; }
.bm-bloglist li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.bm-bloglist li:first-child { border-top: 0; padding-top: 0; }
.bm-bloglist form { display: contents; }
.bm-bloglist .b { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.bm-bloglist .b strong { font-size: 16px; }
.bm-bloglist .b a { font-size: 14px; overflow-wrap: anywhere; }
.bm-bloglist .bm-err { width: 100%; }
.bm-code { display: flex; gap: 8px; margin: 8px 0 16px; }
.bm-code input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px !important; min-height: 40px !important; }
.bm-steps { margin: 0; padding-left: 20px; color: var(--body); }
.bm-steps li { margin-bottom: 4px; }

/* My pings table (loaded into #mypingscontainer) */
.mypingstable { width: 100%; border-collapse: collapse; font-size: 14px; }
.mypingstable th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 8px 8px 0; }
.mypingstable td { padding: 10px 8px 10px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.mypingstable td a { color: var(--ink); }
.mypingstable abbr { text-decoration: none; color: var(--muted); white-space: nowrap; }
.mypingstableSelect { min-height: 36px; border-radius: 8px; border: 1px solid var(--field-line); background: var(--field); color: var(--ink); padding: 0 6px; }
#myping_nav_page { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
#myping_nav_page a, #myping_nav_page strong { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); font-weight: 600; color: var(--body); }
#myping_nav_page strong { background: var(--navy); color: #FFFFFF; }

/* Profile */
.bm-profile { display: flex; gap: 18px; align-items: flex-start; }
.bm-profile img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.bm-profile h1 { font-size: 28px; font-weight: 800; }
.bm-profile dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0; font-size: 15px; }
.bm-profile dt { color: var(--muted); }
.bm-profile dd { margin: 0; }
.bm-profile ul { margin: 6px 0 0; padding-left: 18px; }
.bm-toggle { list-style: none; margin: 10px 0 0; padding: 0; }
.bm-toggle a { font-weight: 700; font-size: 14px; }

/* Prose (help, privacy, terms) */
.bm-prose { font-size: 16px; line-height: 1.7; color: var(--body); }
.bm-prose h2 { font-size: 22px; margin: 28px 0 10px; }
.bm-prose h3 { font-size: 18px; margin: 22px 0 8px; }
.bm-prose h2:first-child, .bm-prose h3:first-child { margin-top: 0; }
.bm-prose ul, .bm-prose ol { padding-left: 22px; }
.bm-prose img { vertical-align: middle; }

/* Search page login */
.bm-empty { text-align: left; }
.bm-empty ul { margin: 6px 0 16px; padding-left: 20px; color: var(--body); }

/* Toast (replaces alert pop-ups) */
.bm-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; z-index: 100;
  background: var(--navy); color: #FFFFFF; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 15px; max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; pointer-events: none; }
.bm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
:root[data-theme="dark"] .bm-toast { background: #2A3552; }

/* Footer */
.bm-foot { border-top: 1px solid var(--line); padding: 24px 0 40px; font-size: 14px; color: var(--muted); }
.bm-foot .bm-wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.bm-foot a { color: var(--muted); }
.bm-foot a:hover { color: var(--ink); }
.bm-foot__copy { margin-right: auto; }

/* Ping bar / leaving page */
.bm-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: var(--head-bg); color: #FFFFFF; }
.bm-bar .bm-logo { font-size: 20px; margin-right: 8px; }
.bm-bar .act { color: #FFFFFF; background: var(--head-chip); height: 36px; font-size: 13px; }
.bm-bar .act:hover { background: rgba(255,255,255,.2); color: #FFFFFF; }
.bm-bar .act--like { background: rgba(127,224,186,.18); color: #BFF0DC; }
.bm-bar .act--flagged { color: #FFB4AE; }
.bm-bar__end { margin-left: auto; color: var(--sky); font-weight: 700; font-size: 14px; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .bm-search { width: 180px; }
  .bm-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; }
}

/* ---------- Phones and small tablets ---------- */
@media (max-width: 860px) {
  body { padding-bottom: 84px; }
  .bm-top__row { height: 56px; gap: 8px; }
  .bm-nav, .bm-search, .bm-top .bm-hide-sm { display: none; }
  .bm-logo { font-size: 22px; }
  .bm-top.is-away { transform: translateY(-100%); }
  .bm-pop { position: fixed; left: 12px; right: 12px; top: 64px; min-width: 0; }
  .bm-btn { height: 36px; padding: 0 14px; }
  .bm-iconbtn { width: 38px; height: 38px; }

  .bm-tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: calc(66px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--head-bg); box-shadow: 0 -1px 0 rgba(255,255,255,.06);
  }
  .bm-tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 12px; font-weight: 600; color: #AEB9CF; text-decoration: none; }
  .bm-tabbar a span { width: 52px; height: 30px; border-radius: 999px; display: grid; place-items: center; }
  .bm-tabbar a[aria-current="page"] { color: #FFFFFF; font-weight: 800; }
  .bm-tabbar a[aria-current="page"] span { background: rgba(141,179,255,.28); }

  .bm-page { padding: 18px 0 32px; }
  .bm-layout, .bm-layout--account { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .bm-rail { position: static; }
  .bm-subnav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .bm-subnav__label { display: none; }
  .bm-subnav a { white-space: nowrap; min-height: 40px; background: var(--surface); box-shadow: var(--shadow); border-radius: 999px; }
  .bm-pagehead--tl, .bm-pages--tl { padding-left: 0; }
  .bm-pagehead h1, .bm-pagehead .bm-h1 { font-size: 24px; }

  /* Timeline slims down: small dot + time above each card */
  .tl-day { grid-template-columns: 18px minmax(0, 1fr); height: 40px; }
  .tl-day::before { grid-column: 1; }
  .tl-day__label { grid-column: 2; padding-left: 10px; font-size: 16px; }
  .tl-item { grid-template-columns: 18px minmax(0, 1fr); grid-template-rows: auto auto; }
  .tl-time { grid-column: 2; grid-row: 1; flex-direction: row; align-items: baseline; gap: 8px; padding: 6px 0 6px 10px; text-align: left; }
  .tl-time span { display: inline; }
  .ping-ago { display: none; }
  .tl-item.is-plain .ping-ago { display: block; margin-left: 0; }
  .tl-item.is-plain .ping-ago::before { content: none; }
  .tl-line { grid-column: 1; grid-row: 1 / span 2; }
  .tl-dot { margin-top: 11px; width: 12px; height: 12px; }
  .tl-body { grid-column: 2; grid-row: 2; padding: 0 0 14px 10px; }
  .tl-item.is-plain .tl-body { grid-column: 1; grid-row: auto; padding: 0 0 14px; }
  .ping-card { padding: 16px; border-radius: 16px; }
  .ping-title { font-size: 19px; }
  .ping-excerpt { font-size: 15px; }
  .act { height: 44px; min-width: 44px; }
  .act--read .act-label { display: none; }
  .bm-row-form { flex-direction: column; }
  .bm-profile { flex-direction: column; }
  .mypingstable thead { display: none; }
  .mypingstable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
  .mypingstable td { border: 0; padding: 0; }
  .mypingstable td:nth-child(2) { grid-column: 1 / -1; }
}

@media (min-width: 861px) {
  .bm-msearch { display: none !important; }
  .bm-show-sm { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bm-top, .bm-toast { transition: none; }
}

/* Old page content (help, privacy, terms) keeps its fieldset/legend markup */
.bm-prose fieldset { border: 0; padding: 0; margin: 0 0 26px; min-width: 0; }
.bm-prose legend { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--ink); padding: 0; margin-bottom: 8px; letter-spacing: -.01em; }
.bm-prose .bullet { margin: 0; padding-left: 20px; }
.bm-prose .bullet li { margin-bottom: 4px; }
.bm-prose .backtop { font-size: 13px; }
.bm-inline-icon { display: inline-flex; vertical-align: -3px; margin: 0 2px; color: var(--ink); }
.bm-prose #helplinks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin-bottom: 18px; }
.bm-prose #helplinks fieldset { background: var(--surface-2); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
@media (max-width: 860px) { .bm-prose #helplinks { grid-template-columns: minmax(0, 1fr); } }
/* Phones: shrink the tag cloud so the most-used tags (up to 250%) stay a sensible size */
@media (max-width: 860px) { .bm-main .tagcloud { font-size: 13px; } }

/* ---- Automatic dark mode: same rules as :root[data-theme="dark"] above ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bm-langbar strong { background: var(--sky); color: var(--navy); }
  :root:not([data-theme="light"]) .bm-card--navy { background: #1E2842; }
  :root:not([data-theme="light"]) .ping-lang--en { background: #1B2A57; color: #B9CDFF; }
  :root:not([data-theme="light"]) .ping-lang--ms { background: #3B1724; color: #FFB3C8; }
  :root:not([data-theme="light"]) .t0 { background: #3A2414; color: #FFC9A1; }
  :root:not([data-theme="light"]) .t1 { background: #1B2A57; color: #B9CDFF; }
  :root:not([data-theme="light"]) .t2 { background: #123A30; color: #8DE3C4; }
  :root:not([data-theme="light"]) .t3 { background: #3A1A36; color: #F2B5E6; }
  :root:not([data-theme="light"]) .t4 { background: #2A2150; color: #CDBDFF; }
  :root:not([data-theme="light"]) .t5 { background: #3A2F10; color: #FFD978; }
  :root:not([data-theme="light"]) .t6 { background: #3B1724; color: #FFB3C8; }
  :root:not([data-theme="light"]) .t7 { background: #0F2E44; color: #9FD8FB; }
  :root:not([data-theme="light"]) .bm-pages strong { background: var(--sky); color: var(--navy); }
  :root:not([data-theme="light"]) .bm-sort__opt:not(:has(a)) { background: var(--sky); color: var(--navy); }
  :root:not([data-theme="light"]) .bm-pop-tabs a.active { background: var(--sky); color: var(--navy); }
  :root:not([data-theme="light"]) .bm-submit { background: var(--sky); color: var(--navy); }
  :root:not([data-theme="light"]) .bm-smallbtn--solid { color: var(--navy); }
  :root:not([data-theme="light"]) .bm-toast { background: #2A3552; }
}
