/* MEDIPHARM Medical Spotlines v1.7.4.6
 * Canonical host dark-mode compatibility layer.
 *
 * Ownership contract:
 * - Host Theme/Super App owns page-level dark mode and global shell.
 * - Spotlines only styles its own .mmspot-* surfaces.
 * - Canonical host states: html.tvm-dark (sachyhoc.com) and
 *   html.yhlsm-dark (yhoclamsang.net).
 * - No Search Dock state classes are used as theme owners here.
 */

:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-scope,
  .mmspot-widget,
  .mmspot-home-module,
  .mmspot-site-events,
  .mmspot-site-nobel,
  .mmspot-detail-layer
){
  --mms-bg:var(--yhlsm-bg,var(--medipharm-bg,#091521));
  --mms-card:var(--yhlsm-paper,var(--medipharm-paper,#0d1b2b));
  --mms-soft:var(--yhlsm-soft,var(--medipharm-soft,#122438));
  --mms-text:var(--yhlsm-ink,var(--medipharm-ink,#eef6fb));
  --mms-muted:var(--yhlsm-muted,var(--medipharm-muted,#a9bdcc));
  --mms-line:var(--yhlsm-line,var(--medipharm-line,#294052));
  --mms-brand:var(--yhlsm-blue,#69c7e8);
  --mms-brand-dark:var(--yhlsm-blue-dark,#8bdce6);
  --mms-shadow:none;
  color:var(--mms-text);
  color-scheme:dark;
}

/* Integrated page shell: never recolor the host body/header/footer. */
:is(html.tvm-dark,html.yhlsm-dark) body.mmspot-page .mmspot-integrated-main{
  background:linear-gradient(180deg,#0b1724 0%,#0d1b2b 38%,#091521 100%)!important;
}
:is(html.tvm-dark,html.yhlsm-dark) body.mmspot-page .mmspot-scope{
  background:transparent!important;
  color:var(--mms-text)!important;
}

/* Core reading surfaces. */
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-magazine-head,
  .mmspot-sidebar,
  .mmspot-content,
  .mmspot-news-card,
  .mmspot-empty-card,
  .mmspot-disclaimer,
  .mmspot-widget,
  .mmspot-card,
  .mmspot-min-toolbar,
  .mmspot-detail-panel,
  .mmspot-detail-points
){
  border-color:var(--mms-line)!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-content,.mmspot-widget){
  background:var(--mms-bg)!important;
  color:var(--mms-text)!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-news-card,
  .mmspot-empty-card,
  .mmspot-card,
  .mmspot-sidebar-note,
  .mmspot-issue-btn:hover,
  .mmspot-issue-btn.is-active,
  .mmspot-detail-panel,
  .mmspot-detail-points
){
  background:var(--mms-card)!important;
  color:var(--mms-text)!important;
  box-shadow:none!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-sidebar{
  background:color-mix(in srgb,var(--mms-card) 88%,#091521)!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-magazine-head{
  background:color-mix(in srgb,var(--mms-card) 94%,transparent)!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-search-wrap input,.mmspot-v1617-landmark-filters select){
  background:#102337!important;
  border-color:#32475c!important;
  color:#eef6fb!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-search-wrap input,.mmspot-v1617-landmark-filters select)::placeholder{
  color:#91a9ba!important;
  opacity:1!important;
}

/* Canonical text contrast. Keep accent semantics, but never dark text on dark surfaces. */
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-scope,.mmspot-widget,.mmspot-home-module) :is(h1,h2,h3,h4){
  color:#f2f7fb!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-scope,.mmspot-widget,.mmspot-home-module) :is(p,li,time){
  color:#c2d1dc!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-kicker,.mmspot-side-title,.mmspot-magazine-brand p,.mmspot-intro,.mmspot-hero-meta,
  .mmspot-meta,.mmspot-cite,.mmspot-news-index,.mmspot-sidebar-note,.mmspot-card p,
  .mmspot-loading,.mmspot-empty,.mmspot-error,.mmspot-widget-empty p,.mmspot-footer
){
  color:#aebfcd!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-source-link,.mmspot-open,.mmspot-site-link,.mmspot-home-open,
  .mmspot-v15-row-open,.mmspot-v15-recent>header button,.mmspot-v17-insights article>button
){
  color:#8fd8ff!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-preview-badge,.mmspot-meta b,.mmspot-issue-btn em){
  background:#3a321b!important;
  color:#ffe3a1!important;
  border-color:#6a5830!important;
}

/* Homepage discovery module. */
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-home{
  background:linear-gradient(135deg,#101d2e 0%,#14263b 100%)!important;
  border-color:#2b3c52!important;
  box-shadow:none!important;
  color:#eef5fb!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-home-hero{
  background:linear-gradient(135deg,#12243a,#162b43)!important;
  border-color:#30465f!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v15-home-head h2,.mmspot-v15-home-copy h3,.mmspot-v15-home-recent>h3,
  .mmspot-v15-home-recent-card>span b,.mmspot-v15-home-featured .mmspot-v15-featured-list a
){color:#f1f6fb!important}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v15-home-head p,.mmspot-v15-home-meta,.mmspot-v15-home-recent-card>span em,
  .mmspot-v15-home-recent-card>span small
){color:#b8c9d7!important}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-home-recent-card{
  background:#142236!important;
  border-color:#2b3b50!important;
  color:#eef5fb!important;
  box-shadow:none!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-home-head>a{
  color:#9edfff!important;
}

/* Issue cover / recent issue / discovery surfaces. */
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-v15-page,.mmspot-v15-issue-copy){color:#eef5fb!important}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-issue-hero{
  background:linear-gradient(135deg,#101d2e,#14263b)!important;
  border-color:#2b3c52!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v15-issue-copy h1,.mmspot-v15-recent-info h3,.mmspot-v15-recent h2,.mmspot-v15-discover h2
){color:#f2f7fb!important}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v15-deck,.mmspot-v15-meta,.mmspot-v15-recent-info p,.mmspot-v15-recent-articles>strong,.mmspot-v15-foot
){color:#b7c8d6!important}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-featured-list button{
  color:#e9f1f8!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-featured-list li+li{
  border-top-color:#2b4058!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-recent-row{
  background:#122235!important;
  border-color:#2b3d52!important;
  box-shadow:none!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-discover{
  background:linear-gradient(135deg,#101f30,#181f35)!important;
  border:1px solid #2b3d52!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-v15-discover-grid .mmspot-v14-compact-row{
  background:#142236!important;
  border-color:#2b3b50!important;
}

/* v1.4/v1.6 editorial modules and cards. */
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v14-module,.mmspot-v14-compact-row,.mmspot-v161-dashboard,.mmspot-v161-featured,
  .mmspot-v161-issue-hero,.mmspot-v161-chart,.mmspot-v161-dashboard-note,.mmspot-v161-events,
  .mmspot-v161-specialties,.mmspot-v161-feature-card,.mmspot-v161-editorial-row,
  .mmspot-v1612-ticker,.mmspot-v1612-dashboard,.mmspot-v1612-kpi,.mmspot-v1612-event,
  .mmspot-v1612-event-controls,.mmspot-v1613-top-events,.mmspot-v1613-topic,.mmspot-v1613-top-event,
  .mmspot-v1617-dashboard,.mmspot-v1617-landmarks,.mmspot-v1617-landmark-hero,
  .mmspot-v1617-landmark-featured,.mmspot-v1617-landmark-browser,.mmspot-v1617-landmark-row button,
  .mmspot-v17-dashboard,.mmspot-v17-insights,.mmspot-v17-insights article,.mmspot-v17-charts article,
  .mmspot-v17-kpis button
){
  border-color:#2d4057!important;
  color:#eef5fb!important;
  box-shadow:none!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v14-module,.mmspot-v14-compact-row,.mmspot-v161-chart,.mmspot-v161-dashboard-note,
  .mmspot-v161-events,.mmspot-v161-specialties,.mmspot-v161-feature-card,.mmspot-v161-editorial-row,
  .mmspot-v1612-kpi,.mmspot-v1612-event,.mmspot-v1612-event-controls,.mmspot-v1613-top-event,
  .mmspot-v1617-landmark-featured,.mmspot-v1617-landmark-browser,.mmspot-v1617-landmark-row button,
  .mmspot-v17-insights article,.mmspot-v17-charts article,.mmspot-v17-kpis button
){background:#142236!important}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v161-dashboard,.mmspot-v161-featured,.mmspot-v161-issue-hero,.mmspot-v1612-ticker,
  .mmspot-v1612-dashboard,.mmspot-v1613-top-events,.mmspot-v1613-topic,
  .mmspot-v1617-dashboard,.mmspot-v1617-landmarks,.mmspot-v1617-landmark-hero,
  .mmspot-v17-dashboard,.mmspot-v17-insights
){background:linear-gradient(135deg,#101d2e,#14263b)!important}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v161-dashboard,.mmspot-v161-featured,.mmspot-v1612-dashboard,.mmspot-v1613-top-events,
  .mmspot-v1613-topic,.mmspot-v1617-dashboard,.mmspot-v1617-landmarks,.mmspot-v17-dashboard,.mmspot-v17-insights
) :is(h2,h3,strong,b){color:#eef5fb!important}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v161-dashboard,.mmspot-v161-featured,.mmspot-v1612-dashboard,.mmspot-v1613-top-events,
  .mmspot-v1613-topic,.mmspot-v1617-dashboard,.mmspot-v1617-landmarks,.mmspot-v17-dashboard,.mmspot-v17-insights
) :is(p,small,span,time){color:#b7c8d6}

/* Preserve accent labels at a readable dark-mode luminance. */
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v17-eyebrow,.mmspot-v17-insights>header>span,.mmspot-v17-insight-meta,
  .mmspot-v17-insight-meaning strong,.mmspot-v1617-landmark-copy>span,
  .mmspot-v1617-landmark-year b,.mmspot-v1617-landmark-row>button>i
){color:#82d8e6!important}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-v17-dashboard>header p,.mmspot-v17-kpis small,.mmspot-v17-charts article>header span,
  .mmspot-v17-insight-meaning span,.mmspot-v1617-landmark-browser>header p,.mmspot-v1617-landmark-copy p
){color:#b7c8d6!important}

/* Event strip / timeline. */
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-site-events{
  background:linear-gradient(90deg,#0c1724,#101d2e)!important;
  border-color:#27394d!important;
}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-site-event{
  background:#142236!important;
  border-color:#2b3b50!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-site-events header strong,.mmspot-site-event strong){color:#eef5fb!important}
:is(html.tvm-dark,html.yhlsm-dark) .mmspot-site-event small{color:#b4c7d8!important}

/* Nobel special page — cover gradients keep their artwork; reading cards use dark surfaces. */
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-nobel-features,.mmspot-nobel-timeline,.mmspot-nobel-directory){
  background:#101d2e!important;
  border-color:#2d4057!important;
  color:#eef5fb!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-nobel-feature-grid article,.mmspot-nobel-year button,.mmspot-nobel-laureate){
  background:#142236!important;
  border-color:#2b3b50!important;
  color:#eef5fb!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(
  .mmspot-nobel-features h2,.mmspot-nobel-timeline h2,.mmspot-nobel-directory h2,
  .mmspot-nobel-feature-grid h3,.mmspot-nobel-year strong,.mmspot-nobel-laureate strong
){color:#f1f6fb!important}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-nobel-feature-grid p,.mmspot-nobel-year small,.mmspot-nobel-laureate p,.mmspot-nobel-laureate small){
  color:#b8c9d7!important;
}

/* Detail modal is owned by Spotlines even though it is portaled under body. */
:is(html.tvm-dark,html.yhlsm-dark) body.mmspot-detail-open>.mmspot-detail-layer>.mmspot-detail-panel{
  background:#102638!important;
  background-color:#102638!important;
  border-color:#32475c!important;
  color:#ecf5fb!important;
  color-scheme:dark!important;
}
:is(html.tvm-dark,html.yhlsm-dark) body.mmspot-detail-open>.mmspot-detail-layer>.mmspot-detail-panel :is(h1,h2,h3,strong,b){
  color:#f3f9fd!important;
}
:is(html.tvm-dark,html.yhlsm-dark) body.mmspot-detail-open>.mmspot-detail-layer>.mmspot-detail-panel :is(p,li,small,time){
  color:#d0e0eb!important;
}
:is(html.tvm-dark,html.yhlsm-dark) body.mmspot-detail-open>.mmspot-detail-layer>.mmspot-detail-panel :is(.mmspot-detail-points,.mmspot-detail-close){
  background:#173249!important;
  border-color:rgba(255,255,255,.10)!important;
  color:#eef7fb!important;
}

/* Accessibility states. */
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-scope,.mmspot-widget,.mmspot-home-module) :focus-visible{
  outline:3px solid rgba(105,199,232,.55)!important;
  outline-offset:2px!important;
}
:is(html.tvm-dark,html.yhlsm-dark) :is(.mmspot-scope,.mmspot-widget,.mmspot-home-module) ::selection{
  background:#26678d!important;
  color:#fff!important;
}
