
/* =========================================================
   LIGHT / DARK THEME POLISH v100
   Loaded last to reconcile older fixed-color page designs with
   the current global theme variables.
   ========================================================= */

/* ---------- Theme control ---------- */
.theme{
  display:grid!important;
  place-items:center!important;
  font-size:1.05rem!important;
  line-height:1!important;
  transition:background .18s ease,border-color .18s ease,color .18s ease,transform .18s ease!important;
}
.theme:hover{transform:translateY(-1px)}
html[data-theme=dark] .theme{box-shadow:0 4px 14px rgba(0,0,0,.18)}

/* ---------- Shared dark map treatment ---------- */
html[data-theme=dark] .leaflet-tile-pane{
  filter:invert(.88) hue-rotate(155deg) brightness(.72) contrast(.92) saturate(.62);
}
html[data-theme=dark] .leaflet-control-zoom a,
html[data-theme=dark] .leaflet-control-layers,
html[data-theme=dark] .leaflet-control-attribution,
html[data-theme=dark] .leaflet-popup-content-wrapper,
html[data-theme=dark] .leaflet-popup-tip{
  background:var(--surface)!important;
  color:var(--text)!important;
  border-color:var(--line)!important;
}
html[data-theme=dark] .leaflet-control-zoom a{
  border-bottom-color:var(--line)!important;
}
html[data-theme=dark] .leaflet-control-zoom a:hover{background:var(--surface2)!important}
html[data-theme=dark] .leaflet-control-attribution a{color:var(--primary)!important}

/* ---------- Research StoryMap ---------- */
html[data-theme=dark] body[data-story-page="research"] .story-leaflet-icon span{
  background:#183b52!important;
  color:#f4fbfb!important;
  border-color:#dcebea!important;
  box-shadow:0 0 0 1px rgba(220,235,234,.12),0 5px 15px rgba(0,0,0,.42)!important;
}
html[data-theme=dark] body[data-story-page="research"] .story-leaflet-icon.active span{
  background:var(--accent)!important;
  color:#102635!important;
  border-color:#fff!important;
  box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 22%,transparent),0 7px 20px rgba(0,0,0,.48)!important;
}
html[data-theme=dark] body[data-story-page="research"] .leaflet-tooltip{
  background:rgba(13,32,36,.97)!important;
  color:var(--text)!important;
  border-color:var(--line)!important;
  box-shadow:0 5px 16px rgba(0,0,0,.34)!important;
}
html[data-theme=dark] body[data-story-page="research"] .leaflet-tooltip span{color:var(--muted)!important}

/* ---------- UAV / RTK field page ---------- */
html[data-theme=dark] .uav-field-page .platform-reference-card,
html[data-theme=dark] .uav-field-page .academic-map-card,
html[data-theme=dark] .uav-field-page .academic-map-card-wide,
html[data-theme=dark] .uav-field-page .evidence-record,
html[data-theme=dark] .uav-field-page .academic-method-note,
html[data-theme=dark] .uav-field-page .workflow-card,
html[data-theme=dark] .uav-field-page .flightplan-card,
html[data-theme=dark] .uav-field-page .compact-processing-hero{
  background:var(--surface)!important;
  border-color:var(--line)!important;
  box-shadow:none!important;
}
html[data-theme=dark] .uav-field-page .platform-reference-card:hover{background:var(--surface2)!important}
html[data-theme=dark] .uav-field-page .map-on-right .field-map-head button,
html[data-theme=dark] .uav-field-page .workflow-card figcaption,
html[data-theme=dark] .uav-field-page .flightplan-card figcaption,
html[data-theme=dark] .uav-field-page .compact-processing-hero figcaption{
  background:var(--surface2)!important;
  border-color:var(--line)!important;
  color:var(--muted)!important;
}
html[data-theme=dark] .uav-field-page .workflow-card figcaption strong,
html[data-theme=dark] .uav-field-page .flightplan-card figcaption strong{color:var(--primary2)!important}
html[data-theme=dark] .uav-field-page .workflow-card figcaption span,
html[data-theme=dark] .uav-field-page .flightplan-card figcaption span,
html[data-theme=dark] .uav-field-page .compact-section-head-academic p{color:var(--muted)!important}
html[data-theme=dark] .uav-field-page .field-map .leaflet-bar a{background:var(--surface)!important;color:var(--primary2)!important}
html[data-theme=dark] .uav-field-page .bangladesh-label span{
  background:rgba(13,32,36,.94)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
  box-shadow:0 4px 12px rgba(0,0,0,.28)!important;
}

/* ---------- Home page custom atlas palette ---------- */
html[data-theme=dark] .home-atlas-page{background:var(--bg)!important;color:var(--text)!important}
html[data-theme=dark] .home-atlas-page .ha-hero{
  background:linear-gradient(125deg,#0b1a1e 0%,#0d2024 52%,#10272b 100%)!important;
  border-color:var(--line)!important;
}
html[data-theme=dark] .home-atlas-page .ha-research-spread,
html[data-theme=dark] .home-atlas-page .ha-capability-atlas,
html[data-theme=dark] .home-atlas-page .ha-certification-gallery{background:var(--bg)!important;border-color:var(--line)!important}
html[data-theme=dark] .home-atlas-page .ha-academic-finale{background:var(--surface2)!important;border-color:var(--line)!important}
html[data-theme=dark] .home-atlas-page .ha-name-row h1,
html[data-theme=dark] .home-atlas-page .ha-identity h2,
html[data-theme=dark] .home-atlas-page .ha-section-line h2,
html[data-theme=dark] .home-atlas-page .ha-finale-title h2{color:var(--primary2)!important}
html[data-theme=dark] .home-atlas-page .ha-role,
html[data-theme=dark] .home-atlas-page .ha-intro,
html[data-theme=dark] .home-atlas-page .ha-section-line p,
html[data-theme=dark] .home-atlas-page .ha-finale-title p{color:var(--muted)!important}
html[data-theme=dark] .home-atlas-page .ha-actions a:not(.ha-primary),
html[data-theme=dark] .home-atlas-page .ha-certificate-grid>a{
  background:var(--surface)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
}
html[data-theme=dark] .home-atlas-page .ha-finale-track a:hover{background:var(--surface)!important}
html[data-theme=dark] .home-atlas-page .ha-logo-stat img{background:#fff!important}

/* ---------- Academic research detail pages ---------- */
html[data-theme=dark] .academic-research-page{background:var(--bg)!important;color:var(--text)!important}
html[data-theme=dark] .academic-research-page .academic-paper-hero{background:var(--surface2)!important;border-color:var(--line)!important}
html[data-theme=dark] .academic-research-page .academic-paper-heading h1,
html[data-theme=dark] .academic-research-page .academic-section h2,
html[data-theme=dark] .academic-research-page .academic-section h3{color:var(--primary2)!important}
html[data-theme=dark] .academic-research-page .academic-breadcrumbs a{color:var(--primary)!important}
html[data-theme=dark] .academic-research-page .academic-keywords span,
html[data-theme=dark] .academic-research-page .academic-cover-figure,
html[data-theme=dark] .academic-research-page .academic-manuscript,
html[data-theme=dark] .academic-research-page .academic-objectives>div,
html[data-theme=dark] .academic-research-page .academic-figure,
html[data-theme=dark] .academic-research-page .academic-authorship-box,
html[data-theme=dark] .academic-research-page .academic-sidebar-card{
  background:var(--surface)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
  box-shadow:none!important;
}
html[data-theme=dark] .academic-research-page .academic-cover-figure img,
html[data-theme=dark] .academic-research-page .academic-figure img{background:var(--surface2)!important}
html[data-theme=dark] .academic-research-page .academic-section,
html[data-theme=dark] .academic-research-page .academic-authorship-box dl>div,
html[data-theme=dark] .academic-research-page .academic-sidebar-dl>div,
html[data-theme=dark] .academic-research-page .academic-page-nav a{border-color:var(--line)!important}
html[data-theme=dark] .academic-research-page .academic-table th{background:var(--surface2)!important;color:var(--primary2)!important;border-color:var(--line)!important}
html[data-theme=dark] .academic-research-page .academic-table td{color:var(--muted)!important;border-color:var(--line)!important}
html[data-theme=dark] .academic-research-page .academic-page-nav a{color:var(--muted)!important}
html[data-theme=dark] .academic-research-page .academic-page-nav a:hover{color:var(--primary)!important}

/* ---------- GIS Automation ---------- */
html[data-theme=dark] .automation-compact-page{background:var(--bg)!important;color:var(--text)!important}
html[data-theme=dark] .automation-compact-page .automation-compact-hero{background:var(--surface2)!important;border-color:var(--line)!important}
html[data-theme=dark] .automation-compact-page .automation-compact-hero h1,
html[data-theme=dark] .automation-compact-page .automation-academic-title h1,
html[data-theme=dark] .automation-compact-page .automation-project-detail h2,
html[data-theme=dark] .automation-compact-page .automation-project-tab strong{color:var(--primary2)!important}
html[data-theme=dark] .automation-compact-page .automation-project-detail,
html[data-theme=dark] .automation-compact-page .automation-project-tab.active,
html[data-theme=dark] .automation-compact-page .automation-academic-section .automation-project-detail{
  background:var(--surface)!important;
  border-color:var(--line)!important;
  box-shadow:none!important;
}
html[data-theme=dark] .automation-compact-page .automation-project-tab:hover,
html[data-theme=dark] .automation-compact-page .automation-project-format,
html[data-theme=dark] .automation-compact-page .automation-project-reviewer,
html[data-theme=dark] .automation-compact-page .automation-project-tags span,
html[data-theme=dark] .automation-compact-page .automation-academic-domains span,
html[data-theme=dark] .automation-compact-page .automation-project-visual,
html[data-theme=dark] .automation-compact-page .automation-project-visual figcaption{
  background:var(--surface2)!important;
  border-color:var(--line)!important;
  color:var(--muted)!important;
}
html[data-theme=dark] .automation-compact-page .automation-project-visual img{background:var(--surface2)!important}
html[data-theme=dark] .automation-compact-page .automation-compact-metrics,
html[data-theme=dark] .automation-compact-page .automation-compact-metrics div+div,
html[data-theme=dark] .automation-compact-page .automation-project-facts,
html[data-theme=dark] .automation-compact-page .automation-project-facts>div+div,
html[data-theme=dark] .automation-compact-page .automation-project-code-panel,
html[data-theme=dark] .automation-compact-page .automation-project-notes{border-color:var(--line)!important}
html[data-theme=dark] .automation-compact-page .automation-compact-metrics strong{color:var(--primary2)!important}

/* ---------- Education ---------- */
html[data-theme=dark] .simple-education-page{background:var(--bg)!important;color:var(--text)!important}
html[data-theme=dark] .simple-education-page .education-simple-intro,
html[data-theme=dark] .simple-education-page .education-degree-body{border-color:var(--line)!important}
html[data-theme=dark] .simple-education-page .education-breadcrumbs{color:var(--muted)!important}
html[data-theme=dark] .simple-education-page .education-breadcrumbs a{color:var(--primary)!important}
html[data-theme=dark] .simple-education-page .education-simple-intro h1,
html[data-theme=dark] .simple-education-page .education-degree-card h2{color:var(--primary2)!important}
html[data-theme=dark] .simple-education-page .education-simple-intro>p,
html[data-theme=dark] .simple-education-page .education-institution{color:var(--muted)!important}
html[data-theme=dark] .simple-education-page .education-degree-card{background:var(--surface)!important;border-color:var(--line)!important}
html[data-theme=dark] .simple-education-page .education-degree-topline strong,
html[data-theme=dark] .simple-education-page .education-degree-body>div{
  background:var(--surface2)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
}
html[data-theme=dark] .simple-education-page .education-degree-index{background:#173f57!important;color:#fff!important}
html[data-theme=dark] .simple-education-page .education-simple-footer a+a{color:var(--primary)!important;border-color:var(--primary)!important}

/* ---------- Teaching ---------- */
html[data-theme=dark] .teaching-capacity-page .tc-lead,
html[data-theme=dark] .teaching-capacity-page .tc-profile-note{color:var(--muted)!important}
html[data-theme=dark] .teaching-capacity-page figcaption{background:var(--surface)!important;color:var(--muted)!important}
html[data-theme=dark] .teaching-capacity-page .tc-summary-meta span{background:var(--surface2)!important;border-color:var(--line)!important;color:var(--primary2)!important}

/* ---------- Urban planning ---------- */
html[data-theme=dark] .urban-planning-page,
html[data-theme=dark] .urban-planning-v53{background:var(--bg)!important;color:var(--text)!important}
html[data-theme=dark] .urban-planning-page .up-v53-intro,
html[data-theme=dark] .urban-planning-page .up-v50-map-section{border-color:var(--line)!important}
html[data-theme=dark] .urban-planning-page .up-v53-intro h1,
html[data-theme=dark] .urban-planning-page .up-v53-story-head h2,
html[data-theme=dark] .urban-planning-page .up-v53-map-status strong,
html[data-theme=dark] .urban-planning-page .up-v51-mini-grid strong{color:var(--primary2)!important}
html[data-theme=dark] .urban-planning-page .up-v53-story-card,
html[data-theme=dark] .urban-planning-page .up-v53-map-sticky,
html[data-theme=dark] .urban-planning-page .up-v51-media-row figure,
html[data-theme=dark] .urban-planning-page .up-v53-youtube-row a,
html[data-theme=dark] .urban-planning-page .up-v51-main-visual{
  background:var(--surface)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
}
html[data-theme=dark] .urban-planning-page .up-v51-mini-grid>div,
html[data-theme=dark] .urban-planning-page .up-v53-map-status{
  background:var(--surface2)!important;
  border-color:var(--line)!important;
}
html[data-theme=dark] .urban-planning-page .up-v53-map .leaflet-bar a{background:var(--surface)!important;color:var(--primary2)!important}

/* ---------- Credentials ---------- */
html[data-theme=dark] .credential-page .credential-preview{background:var(--surface2)!important;border-color:var(--line)!important}
/* Certificate pages are document previews; preserve white paper behind certificate images. */
html[data-theme=dark] .credential-page .credential-preview img{background:#fff!important}

/* ---------- Shared older image/card surfaces ---------- */
html[data-theme=dark] body[data-story-page="skills"] .story-chapter-media{background:var(--surface2)!important;border-color:var(--line)!important}
html[data-theme=dark] body[data-story-page="skills"] .story-chapter-media img{background:var(--surface)!important}
html[data-theme=dark] .story-more{background:var(--surface)!important;border-color:var(--line)!important;color:var(--text)!important}
html[data-theme=dark] .story-more:hover{background:var(--surface2)!important}

/* ---------- Footer + back-to-top ---------- */
html[data-theme=dark] .site-footer{background:color-mix(in srgb,var(--surface) 56%,var(--bg))!important}
html[data-theme=dark] .back-to-top{
  background:color-mix(in srgb,var(--surface) 96%,transparent)!important;
  border-color:var(--line)!important;
  box-shadow:0 7px 22px rgba(0,0,0,.34)!important;
}
html[data-theme=dark] .back-to-top:hover{background:var(--surface2)!important;border-color:var(--accent)!important}

/* ---------- Form / generic surfaces ---------- */
html[data-theme=dark] input,
html[data-theme=dark] textarea,
html[data-theme=dark] select{
  background:var(--surface)!important;
  color:var(--text)!important;
  border-color:var(--line)!important;
  color-scheme:dark;
}
html[data-theme=light] input,
html[data-theme=light] textarea,
html[data-theme=light] select{color-scheme:light}

/* Native controls and scrollbars align with active theme. */
html[data-theme=dark]{color-scheme:dark}
html[data-theme=light]{color-scheme:light}


/* ---------- Additional full-page dark audit refinements ---------- */

/* Home research-journey/map surfaces */
html[data-theme=dark] .home-atlas-page .ha-map-stage,
html[data-theme=dark] .home-atlas-page .ha-map,
html[data-theme=dark] .home-atlas-page .ha-map-option6{
  background:var(--surface2)!important;
}
html[data-theme=dark] .home-atlas-page .ha-map-title,
html[data-theme=dark] .home-atlas-page .ha-map-legend,
html[data-theme=dark] .home-atlas-page .ha-o6-header,
html[data-theme=dark] .home-atlas-page .ha-o6-steps button,
html[data-theme=dark] .home-atlas-page .ha-summary-card,
html[data-theme=dark] .home-atlas-page .ha-thesis-glimpse,
html[data-theme=dark] .home-atlas-page .ha-cert-glimpse,
html[data-theme=dark] .home-atlas-page .ha-cap-teaching-points li,
html[data-theme=dark] .home-atlas-page .ha-result-dials div{
  background:color-mix(in srgb,var(--surface) 92%,transparent)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
}
html[data-theme=dark] .home-atlas-page .ha-o6-panel{background:rgba(13,32,36,.68)!important}
html[data-theme=dark] .home-atlas-page .ha-o6-steps button:hover,
html[data-theme=dark] .home-atlas-page .ha-o6-steps button.active{
  background:#173f57!important;
  color:#fff!important;
  border-color:#173f57!important;
}
html[data-theme=dark] .home-atlas-page .ha-certificate-grid figure{background:var(--surface2)!important}

/* UAV map and platform glyph surfaces */
html[data-theme=dark] .uav-field-page .field-map-wrap,
html[data-theme=dark] .uav-field-page .compact-right-map,
html[data-theme=dark] .uav-field-page .compact-right-map-wide,
html[data-theme=dark] .uav-field-page .field-context-grid-single .field-map-wrap{
  background:var(--surface2)!important;
}
html[data-theme=dark] .uav-field-page .platform-glyph,
html[data-theme=dark] .uav-field-page .platform-glyph.lidar,
html[data-theme=dark] .uav-field-page .platform-glyph.jashore,
html[data-theme=dark] .uav-field-page .platform-glyph.multi,
html[data-theme=dark] .uav-field-page .record-number{
  background:var(--surface2)!important;
  color:var(--primary2)!important;
  border-color:var(--line)!important;
}
html[data-theme=dark] .uav-field-page .map-on-right .field-map-filters button{
  background:var(--surface2)!important;
  color:var(--muted)!important;
  border-color:var(--line)!important;
}
html[data-theme=dark] .uav-field-page .map-on-right .field-map-filters button.active{
  background:#173f57!important;
  color:#fff!important;
  border-color:#173f57!important;
}
html[data-theme=dark] .uav-field-page .workflow-card-image,
html[data-theme=dark] .uav-field-page .flightplan-card img{background:var(--surface2)!important}

/* Research-detail secondary text that previously used fixed dark gray. */
html[data-theme=dark] .academic-research-page .academic-breadcrumbs,
html[data-theme=dark] .academic-research-page .academic-affiliation,
html[data-theme=dark] .academic-research-page .academic-cover-figure figcaption,
html[data-theme=dark] .academic-research-page .academic-figure figcaption,
html[data-theme=dark] .academic-research-page .academic-section>p,
html[data-theme=dark] .academic-research-page .academic-section li,
html[data-theme=dark] .academic-research-page .academic-abstract>p:last-child,
html[data-theme=dark] .academic-research-page .academic-objectives p,
html[data-theme=dark] .academic-research-page .academic-authorship-box dd,
html[data-theme=dark] .academic-research-page .academic-authorship-box>p,
html[data-theme=dark] .academic-research-page .academic-sidebar-card p,
html[data-theme=dark] .academic-research-page .academic-sidebar-dl dd{
  color:var(--muted)!important;
}
html[data-theme=dark] .academic-research-page .academic-author-line,
html[data-theme=dark] .academic-research-page .academic-table td:first-child{color:var(--text)!important}
html[data-theme=dark] .academic-research-page .academic-record-label,
html[data-theme=dark] .academic-research-page .academic-section-label,
html[data-theme=dark] .academic-research-page .academic-objectives span,
html[data-theme=dark] .academic-research-page .academic-authorship-box dt,
html[data-theme=dark] .academic-research-page .academic-sidebar-dl dt{color:var(--accent)!important}

/* Actual Urban Planning v53 controls/chips/media */
html[data-theme=dark] .urban-planning-page .up-v53-chipwrap span,
html[data-theme=dark] .urban-planning-page .up-v53-keywords span,
html[data-theme=dark] .urban-planning-page .up-v53-inline-note,
html[data-theme=dark] .urban-planning-page .up-v53-mini-grid>div{
  background:var(--surface2)!important;
  border-color:var(--line)!important;
  color:var(--muted)!important;
}
html[data-theme=dark] .urban-planning-page .up-v53-mini-grid strong{color:var(--primary2)!important}
html[data-theme=dark] .urban-planning-page .up-v53-youtube-row a{color:var(--text)!important}

/* Contact and embedded maps */
html[data-theme=dark] .compact-contact-page .compact-contact-map{background:var(--surface2)!important;border-color:var(--line)!important}

/* Theme-transition polish without animating layout. */
body,
.site-header,
.site-footer,
.back-to-top,
.story-chapter,
.workflow-card,
.credential-card{
  transition:background-color .16s ease,color .16s ease,border-color .16s ease;
}
@media(prefers-reduced-motion:reduce){
  body,.site-header,.site-footer,.back-to-top,.story-chapter,.workflow-card,.credential-card{transition:none!important}
}
