/* Dark mode — activated by <html data-theme="dark"> (see js/theme.js) */

/* Toggle button (visible in both themes) */
#theme-toggle{
  position:fixed;right:16px;bottom:16px;z-index:9999;
  width:40px;height:40px;border-radius:50%;
  border:1px solid rgba(128,128,128,.45);
  background:#fff;color:#333;cursor:pointer;
  font-size:19px;line-height:1;padding:0;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 2px 8px rgba(0,0,0,.2);
  transition:transform .2s ease,background-color .2s ease;
}
#theme-toggle:hover{transform:scale(1.08)}
#theme-toggle:focus-visible{outline:2px solid #5b9bd5;outline-offset:2px}
html[data-theme="dark"] #theme-toggle{background:#23272e;color:#f0d36b;border-color:#444b55}

html[data-theme="dark"]{
  color-scheme:dark;
  --dk-bg:#14161a;
  --dk-card:#1c1f25;
  --dk-card2:#23272e;
  --dk-text:#e4e5e8;
  --dk-muted:#9aa3ae;
  --dk-line:#30353c;
  --dk-accent:#7fb6f5;
}
html[data-theme="dark"] *{
  --profile-accent:#7fb6f5;--profile-muted:#9aa3ae;--profile-line:#30353c;
  --education-accent:#7fb6f5;--education-muted:#9aa3ae;--education-line:#30353c;
  --experience-accent:#7fb6f5;--experience-muted:#9aa3ae;--experience-line:#30353c;
  --others-accent:#7fb6f5;--others-muted:#9aa3ae;
}

html[data-theme="dark"],
html[data-theme="dark"] body{background:var(--dk-bg);color:var(--dk-text)}

/* links */
html[data-theme="dark"] a{color:var(--dk-text)}
html[data-theme="dark"] a{text-decoration-color:#5b9bd5}
html[data-theme="dark"] a:hover{color:#8ec5ff;text-decoration-color:#8ec5ff}
html[data-theme="dark"] #author-name,
html[data-theme="dark"] #author-name a{color:#f2f2f4}
html[data-theme="dark"] .profile-page a,
html[data-theme="dark"] .others-details h3 a{color:var(--dk-accent)}
html[data-theme="dark"] .contact-button.primary,
html[data-theme="dark"] .contact-button.primary:hover{color:#14161a !important}

/* rules / tables / quotes */
html[data-theme="dark"] hr{border-top-color:var(--dk-line);border-bottom-color:transparent}
html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td{background-color:transparent;color:var(--dk-text)}
html[data-theme="dark"] .content blockquote{border-left-color:#666;color:var(--dk-muted)}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,
html[data-theme="dark"] h4,html[data-theme="dark"] strong,html[data-theme="dark"] b{color:inherit}
html[data-theme="dark"] .profile-page h3,
html[data-theme="dark"] .outer-label,
html[data-theme="dark"] .inner-label{color:#f0f0f2}

/* side section navigator */
html[data-theme="dark"] #navbar{background-color:var(--dk-card);border-color:var(--dk-line);box-shadow:0 2px 8px rgba(0,0,0,.6)}
html[data-theme="dark"] #navbar a{color:var(--dk-muted)}
html[data-theme="dark"] #navbar a.active,
html[data-theme="dark"] #navbar a:hover{color:#8ec5ff}

/* home-page publication stats (very dark navy) */
html[data-theme="dark"] .outer-box{background:#0e0f10;border-color:#27407a}
html[data-theme="dark"] .inner-box{background:#0e0f10;border-color:#27407a}
html[data-theme="dark"] .outer-label,
html[data-theme="dark"] .inner-label,
html[data-theme="dark"] .outer-label a,
html[data-theme="dark"] .inner-label a{color:#dbe4f8}
html[data-theme="dark"] .tag{background:#171c2a;color:#dbe4f8}
html[data-theme="dark"] .tag-x{background:#07163a;color:#fff}

/* paper hover: light yellow instead of purple */
html[data-theme="dark"] .single-paper:hover,
html[data-theme="dark"] .single-paper-f:hover{color:#f5e6a3}

/* profile pages (contact / cv) */
html[data-theme="dark"] .contact-callout,
html[data-theme="dark"] .cv-card,
html[data-theme="dark"] .contact-button{background:var(--dk-card);border-color:var(--dk-line);color:var(--dk-text)}
html[data-theme="dark"] .contact-button.primary{background:var(--dk-accent);border-color:var(--dk-accent)}
html[data-theme="dark"] .cv-toc a{color:var(--dk-muted)}
html[data-theme="dark"] .cv-toc a:hover,
html[data-theme="dark"] .cv-toc a:focus{color:var(--dk-accent)}

/* education / experience / others */
html[data-theme="dark"] .education-page a,
html[data-theme="dark"] .others-details a{text-decoration-color:#7a5a62}
html[data-theme="dark"] .education-content .degree-metrics > div,
html[data-theme="dark"] .education-content details,
html[data-theme="dark"] .education-content summary,
html[data-theme="dark"] .experience-content .experience-tags span,
html[data-theme="dark"] .experience-content details,
html[data-theme="dark"] .others-details details,
html[data-theme="dark"] .others-details summary,
html[data-theme="dark"] .others-details .others-cards > li,
html[data-theme="dark"] .others-details > ul > li,
html[data-theme="dark"] .others-details .others-interests > li,
html[data-theme="dark"] .education-content > ul > li,
html[data-theme="dark"] .experience-content > ul > li{background:transparent !important;border-color:var(--dk-line)}
html[data-theme="dark"] [class*="timeline"] > li::before,
html[data-theme="dark"] .travel-entry::before{box-shadow:0 0 0 4px var(--dk-bg)}
html[data-theme="dark"] [class*="timeline"] > li,
html[data-theme="dark"] .travel-entry{border-left-color:#444b55}

/* publications */
html[data-theme="dark"] .core-section ol > li p.single-paper-f{color:#d6d8dc}
html[data-theme="dark"] .core-section ol > li p.single-paper-f > a:first-child,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong:first-child,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong:first-child > a,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > a:first-of-type strong,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong > a:first-of-type{color:#f0f0f2 !important}
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong > a:first-of-type:hover,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > a:first-child:hover{color:#8ec5ff !important}
html[data-theme="dark"] .core-section ol > li p.single-paper-f a:not(:first-child){color:#a0a7b0 !important}
html[data-theme="dark"] .core-section ol > li p.single-paper-f span[style*="color"]{color:#7fb6f5 !important}
html[data-theme="dark"] .core-section ol > li p.single-paper-f span[id="wasi-inpub"]{color:#e4e5e8 !important}
html[data-theme="dark"] .core-section ol > li::before{background:transparent;color:#9aa3ae}
html[data-theme="dark"] .publication-action-button,
html[data-theme="dark"] .publication-resource-link{background:var(--dk-card2);color:#c3c8ce !important;border-color:var(--dk-line)}
html[data-theme="dark"] .publication-action-button:hover,
html[data-theme="dark"] .publication-action-button[aria-expanded="true"],
html[data-theme="dark"] .publication-action-button:focus-visible,
html[data-theme="dark"] .publication-resource-link:hover,
html[data-theme="dark"] .publication-resource-link:focus-visible{background:#1c2a45;border-color:#7fb6f5;color:#f0f0f2 !important}
html[data-theme="dark"] .publication-copy-button{background:#3a2d22;color:#f0c9a4 !important;border-color:#6b4a2e}
html[data-theme="dark"] .publication-box{background:var(--dk-card);color:#aab0b8;border-color:var(--dk-line)}
html[data-theme="dark"] .publication-placeholder{color:#7d858f}
html[data-theme="dark"] .publication-bibtex{color:#d6d8dc}

/* inline-styled dark-red / black text scattered through the pages */
html[data-theme="dark"] [style*="color:rgb(133, 3, 3)"],
html[data-theme="dark"] [style*="color: rgb(133, 3, 3)"],
html[data-theme="dark"] [style*="color:rgb(87, 2, 2)"],
html[data-theme="dark"] [style*="color:rgb(177, 0, 38)"],
html[data-theme="dark"] [style*="color:rgb(66, 1, 1)"],
html[data-theme="dark"] [style*="color:brown"],
html[data-theme="dark"] [style*="color: brown"]{color:#7fb6f5 !important}
html[data-theme="dark"] [style*="color:rgb(88, 1, 38)"],
html[data-theme="dark"] [style*="color:rgb(31, 4, 15)"],
html[data-theme="dark"] [style*="color:rgb(148, 69, 5)"]{color:#9cc4f0 !important}
html[data-theme="dark"] [style*="color:rgb(71, 1, 88)"],
html[data-theme="dark"] [style*="color:rgb(65, 0, 90)"],
html[data-theme="dark"] [style*="color:rgb(46, 2, 87)"],
html[data-theme="dark"] [style*="color: rgb(94, 18, 124)"],
html[data-theme="dark"] [style*="color: rgb(18, 46, 124)"]{color:#c3a3f0 !important}
html[data-theme="dark"] [style*="color:rgb(57, 0, 190)"],
html[data-theme="dark"] [style*="color:rgb(17, 87, 145)"]{color:#8fb4ff !important}
html[data-theme="dark"] [style*="color:black"],
html[data-theme="dark"] [style*="color: black"],
html[data-theme="dark"] [style*="color:#000"]{color:var(--dk-text) !important}
html[data-theme="dark"] [style*="color:#555"]{color:var(--dk-muted) !important}
/* keep text on coloured pills/buttons readable */
html[data-theme="dark"] .button-preprint,html[data-theme="dark"] .button-workshop,
html[data-theme="dark"] .button-conference,html[data-theme="dark"] .button-journal,
html[data-theme="dark"] .button-demo,html[data-theme="dark"] .review-badge{color:#111 !important}

/* images with white backgrounds: soften slightly */
html[data-theme="dark"] img{opacity:.92}
html[data-theme="dark"] img:hover{opacity:1}

/* blog */
html[data-theme="dark"] .blog-item a{color:var(--dk-text)}
html[data-theme="dark"] .blog-item{color:var(--dk-text)}

/* code */
html[data-theme="dark"] .highlight pre,html[data-theme="dark"] pre,
html[data-theme="dark"] .highlight .hll{background-color:#1b1e24;border-color:var(--dk-line);color:#d6d8dc}
html[data-theme="dark"] code{background:#1b1e24;color:#e6c07b}
html[data-theme="dark"] pre code{background:transparent;color:inherit}
html[data-theme="dark"] .highlight .n,html[data-theme="dark"] .highlight .nn,
html[data-theme="dark"] .highlight .gp{color:#c3c8ce}
html[data-theme="dark"] .highlight .c,html[data-theme="dark"] .highlight .cm,
html[data-theme="dark"] .highlight .c1{color:#7f8790}
html[data-theme="dark"] .highlight .s{color:#9cc4f0}
html[data-theme="dark"] .highlight .kt,html[data-theme="dark"] .highlight .nc{color:#8fb4ff}
html[data-theme="dark"] .highlight .nf,html[data-theme="dark"] .highlight .ne{color:#7fb6f5}
html[data-theme="dark"] .highlight .nt{color:#8fb4ff}

/* cards: make any text inside inherit light colour */
html[data-theme="dark"] .education-content .degree-metrics > div *,
html[data-theme="dark"] .education-content details *,
html[data-theme="dark"] .experience-content .experience-tags span,
html[data-theme="dark"] .others-details .others-cards > li,
html[data-theme="dark"] .others-details .others-interests > li{color:var(--dk-text) !important}
html[data-theme="dark"] .education-content .degree-metrics > div dt,
html[data-theme="dark"] .education-content .degree-metrics > div dt *{color:var(--dk-muted) !important}

/* inline light backgrounds / details blocks */
html[data-theme="dark"] .research-details,
html[data-theme="dark"] [style*="background-color: #f9f9f9"],
html[data-theme="dark"] [style*="background-color:#f9f9f9"]{background-color:var(--dk-card) !important;border-color:var(--dk-line);color:var(--dk-text)}
html[data-theme="dark"] .research-details *{color:var(--dk-text)}
html[data-theme="dark"] [style*="background-color:#f8f8f8"],
html[data-theme="dark"] [style*="background-color: #f8f8f8"],
html[data-theme="dark"] [style*="background-color:#f5f2f2"],
html[data-theme="dark"] [style*="background-color: #f5f2f2"],
html[data-theme="dark"] [style*="background-color:white"],
html[data-theme="dark"] [style*="background-color: white"],
html[data-theme="dark"] [style*="background:#fff"]{background-color:var(--dk-card) !important;color:var(--dk-text)}

/* gold badge: black text, even over link colour rules */
html[data-theme="dark"] .review-badge,
html[data-theme="dark"] .review-badge a,
html[data-theme="dark"] .review-badge a:hover{color:#000 !important;text-decoration-color:#000}

/* blog index project list */
html[data-theme="dark"] .blog-project-list > li{background:var(--dk-card);border-color:#2f4a75}
html[data-theme="dark"] .blog-project-list h3,
html[data-theme="dark"] .blog-project-list h3 a,
html[data-theme="dark"] .blog-project-list a[style*="color: #161616"]{color:#f0f0f2 !important}
html[data-theme="dark"] .blog-project-list a:hover{color:#8ec5ff !important}
html[data-theme="dark"] .blog-project-list li{color:var(--dk-text)}

/* any remaining green underline accents -> light blue */
html[data-theme="dark"] .core-section ol > li p.single-paper-f a,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong > a:first-of-type:hover{text-decoration-color:#8ec5ff}
html[data-theme="dark"] .navbar-ul a,
html[data-theme="dark"] .content a{text-decoration-color:#5b9bd5}
html[data-theme="dark"] .navbar-ul a:hover,
html[data-theme="dark"] .content a:hover{text-decoration-color:#8ec5ff}

/* red-ish borders / accents -> blue */
html[data-theme="dark"] .publication-action-button,
html[data-theme="dark"] .publication-resource-link,
html[data-theme="dark"] .publication-copy-button{border-color:#3b5f99}
html[data-theme="dark"] .publication-action-button:hover,
html[data-theme="dark"] .publication-action-button[aria-expanded="true"],
html[data-theme="dark"] .publication-resource-link:hover{border-color:#7fb6f5;background:#1c2a45}
html[data-theme="dark"] .education-content .degree-metrics > div,
html[data-theme="dark"] .blog-project-list > li,
html[data-theme="dark"] .others-details .others-cards > li{border-color:#2f4a75}
html[data-theme="dark"] .publication-copy-button{background:#1c2a45;color:#b9d6fa !important}
html[data-theme="dark"] .publication-box{border-color:#2f4a75}
html[data-theme="dark"] .others-details .travel-photo img,
html[data-theme="dark"] .others-details .travel-photo{border-color:#3b5f99}
html[data-theme="dark"] .education-content .degree-metrics > div,
html[data-theme="dark"] .others-details *{--others-accent:#7fb6f5}
html[data-theme="dark"] .cv-card h2{border-bottom-color:#3b5f99}
html[data-theme="dark"] .tag[style],html[data-theme="dark"] .others-details a{text-decoration-color:#5b9bd5}
html[data-theme="dark"] .education-content > ul > li::before,
html[data-theme="dark"] .experience-content > ul > li::before,
html[data-theme="dark"] .others-details .others-timeline > li::before,
html[data-theme="dark"] .others-details .travel-entry::before,
html[data-theme="dark"] .education-content li::before{background:#7fb6f5;border-color:#7fb6f5}
html[data-theme="dark"] .education-content > ul.education-timeline > li::before,
html[data-theme="dark"] [class*="timeline"] > li::before{background:#7fb6f5 !important;border-color:#7fb6f5}

/* publication hover: light sky blue */
html[data-theme="dark"] .core-section ol > li p.single-paper-f > a:first-child:hover,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong:first-child:hover,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong:first-child > a:hover,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > a:first-of-type strong:hover,
html[data-theme="dark"] .core-section ol > li p.single-paper-f > strong > a:first-of-type:hover,
html[data-theme="dark"] .core-section ol > li p.single-paper-f a:not(:first-child):hover,
html[data-theme="dark"] .core-section ol > li p.single-paper-f a:not(:first-child):hover span{color:#87ceeb !important;text-decoration-color:#87ceeb}
html[data-theme="dark"] .core-section ol > li p.single-paper-f span.author-name:hover{color:#87ceeb !important}
